Coder Social home page Coder Social logo

horoscopeapp's Introduction

Horoscope-API. Tweet

Simple Java API to get the horoscope according to the sunsign.

alt tag

Contents

Features
Implementation
API Usage
To-dos
Credits
Apps Using Horoscope Api
License

Features

  • Get Horoscope based on sunsign
  • Get Horoscope for today, weekly, monthly & yearly

Implementation

Library is available on JCenter, simply add the following line in your app build.gradle

implementation'the.bot.box:horoscope-api:{latest-version}'

where {latest-version} corresponds to latest published version

API Usage

To request for any horoscope, simply call,

Horoscope hGemini = new Horoscope.Zodiac(mContext)
                        .requestSunSign(SUNSIGN.GEMINI) 

and also, don't forget to request for duration of horoscope simultaneously i.e TODAY, WEEKLY, MONTHLY, YEARLY
request for it like below,

Horoscope hGemini = new Horoscope.Zodiac(mContext)
                        .requestSunSign(SUNSIGN.GEMINI).
                          .requestDuration((DURATION.TODAY)

therefore, the final request will may seem like the one below,

Horoscope hGemini = new Horoscope.Zodiac(MainActivity.this)
                        .requestSunSign(SUNSIGN.GEMINI)
                           .requestDuration(DURATION.TODAY)
                            .showLoader(true)                            
                              .isDebuggable(true)
                               .fetchHoroscope();

Mandatory Functions
requestSunSign(SUNSIGN)
Access all the zodiacs like this SUNSIGN.ARIES SUNSIGN.TAURUS SUNSIGN.GEMINI SUNSIGN.CANCER ... SUNSIGN.PISCES

requestDuration(DURATION)
Access duration like this DURATION.TODAY DURATION.TOMORROW DURATION.WEEK DURATION.YEAR

Not calling above two function will throw IllegalStateException()

Optional Functions
showLoader(boolean) - pass true in param to displays a loader when fetching horoscope from server, by default its disable.
isDebuggable(boolean) - pass true to enable library logs & exception printStackTrace() or else they are disabled

calling both the above function is totally optional and default value for both is false

Handling Response

Horoscope hGemini = new Horoscope.Zodiac(MainActivity.this)
                        .requestSunSign(SUNSIGN.GEMINI)
                           .requestDuration(DURATION.TODAY)
                            .showLoader(true)                            
                              .isDebuggable(true)
                               .fetchHoroscope();
 HorologyController cGemini = new HorologyController(new Response() {
                        @Override
                        public void onResponseObtained(Zodiac zodiac) {
                           String horoscope = zodiac.getHoroscope();
                           String sunsign = zodiac.getSunSign();
                           String date = getDate();
                        }

                        @Override
                        public void onErrorObtained(String errormsg) {
                                                   }
                    });
                    cGemini.requestConstellations(hGemini);

where, String horoscpe is the response from the server correspoding to the sunsign requested;
String sunsign is the same sunsign for which request has been made;
String date is the same duration for which request has been made.

In case of no internet connection, callback will come in onErrorObtained() with errormsg "No internet connection"

To-Dos

  • Facts About a Sunsign
  • Practical Side of a Sunsign
  • Astrological Perspective of a Sunsign

Credits

This java library is working on top of Horoscope-API by Tapasweni Pathak

Apps Using Horoscope Api

License

alt tag

Copyright (c) 2018 TheBotBox

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
documentation files (the "Software"), to deal in the Software without restriction, including without
limitation the rights to use, copy, 
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to 
whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions 
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
CONTRACT, TORT OR OTHERWISE,ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
IN THE SOFTWARE.

horoscopeapp's People

Contributors

fab16b avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.