GitXplorerGitXplorer
T

Horoscope-API

public
38 stars
15 forks
3 issues

Commits

List of commits on branch master.
Verified
2ad3df773876490ffced3c268492296d89970911

Update README.md

TTheBotBox committed 5 years ago
Verified
8573d3e075d43b5b9b077eb4cfcac7dd8669bd7b

Update README.md

TTheBotBox committed 5 years ago
Verified
6d46ede824e72c4f2fbf50d752997333409ecf44

Update README.md

TTheBotBox committed 5 years ago
Verified
dfe79cc4a446834b6a5d0ce31791ca1fe471b3d4

Merge pull request #4 from me40x1/patch-1

TTheBotBox committed 5 years ago
Verified
ed9a81f6c5421079a09745f9ce526b0478398a5a

Update README.md

mme40x1 committed 5 years ago
Verified
3d5df629227dbc9070e13286f4b740a5f46d4b73

Update DURATION.java

TTheBotBox committed 5 years ago

README

The README file for this repository.

Horoscope-API. Tweet

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

alt tag

Contents

Features
Implementation
API Usage
To-dos
Credits
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 = zodiac.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

  • Conversion to kotlin
  • 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

License

alt tag

Copyright (c) 2020 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.