Horoscope API for android to get the horoscope according to the sunsign

Overview

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.

Comments
  • Importing does not work

    Importing does not work

    hello, I am currently trying to use your api to write a simple discord bot, who returns your daily horoscope upon request. My main problem is, that importing your files does not work, and I cant use any of the function calls. Some help how to resolve this issue would be greatly appreciated. thanks in advance:)

    my file looks like this

    plugins { id 'java' }

    group 'github.LennoxCode' version '1.0-SNAPSHOT'

    repositories { maven { url "https://dl.bintray.com/boxbotbarry/maven" } mavenCentral() jcenter() }

    dependencies { compile 'org.javacord:javacord:3.0.5' implementation 'the.bot.box:horoscope-api:1.0.2' //compile fileTree(dir: 'libs', include: ['*.jar']) }

    opened by LennoxCode 7
  • org.json.JSONException: No value for date

    org.json.JSONException: No value for date

    when i change date to any other than TODAY throws this Exception

    org.json.JSONException: No value for date

    `case R.id.layoutAries:
                        System.out.println("here is the aries 01");
                        Horoscope hAries = new Horoscope.Zodiac(MainActivity.this)
                                .requestSunSign(SUNSIGN.ARIES)
                                .requestDuration(DURATION.TOMORROW)
                                .showLoader(true)
                                .isDebuggable(true)
                                .fetchHoroscope();
    
    
                        HorologyController cAries = new HorologyController(new Response() {
                            @Override
                            public void onResponseObtained(Zodiac zodiac) {
                                showHoroscopeDialog(zodiac, true, "");
    
                            }
    
                            @Override
                            public void onErrorObtained(String errormsg) {
                                showHoroscopeDialog(null, false, errormsg);
    
                            }
                        });
                        cAries.requestConstellations(hAries);
                        break;`
    
    opened by hanynigma 3
  •  JSONException

    JSONException

    Every thing is working fine until I tried to get Weekly, Monthly or Yearly data its throwing an exception that says No value for date . My Code is

        Horoscope hGemini = new Horoscope.Zodiac(MainActivity.this)
                .requestSunSign(SUNSIGN.GEMINI)
                .requestDuration(DURATION.WEEK)
                .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();
                Log.e("Horoscope", horoscope);
            }
    
            @Override
            public void onErrorObtained(String errormsg) {
            }
        });
        cGemini.requestConstellations(hGemini);
    

    ====>Log message is as bellow

    W/System.err: org.json.JSONException: No value for date W/System.err: at org.json.JSONObject.get(JSONObject.java:392) at org.json.JSONObject.getString(JSONObject.java:553) at bot.box.horology.hanshake.HorologyClient$HoroscopeTask.onPostExecute(HorologyClient.java:102) at bot.box.horology.hanshake.HorologyClient$HoroscopeTask.onPostExecute(HorologyClient.java:41) at android.os.AsyncTask.finish(AsyncTask.java:695) at android.os.AsyncTask.access$600(AsyncTask.java:180) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:226)

    opened by Anvaarulhaq 1
  • java.io.Exception: ClearText http traffic

    java.io.Exception: ClearText http traffic

    I am attempting to use this API as apart of my final project for my android development course. I am running into an issue when requesting horoscopes. Screenshots below. Please get back to me, thanks! Debug1

    opened by auben2k 1
  • API SHOWING NULL VALUES

    API SHOWING NULL VALUES

    Is the API Dead. { "date": "2022-02-04", "horoscope": "[]", "sunsign": "Libra" } Whilw running the Raw Code Process but not showing any values Except Null as []

    opened by nanoakhi 0
Owner
TheBotBox
What I cannot build, I do not understand
TheBotBox
Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.

ReactiveLocation library for Android Small library that wraps Google Play Services API in brilliant RxJava Observables reducing boilerplate to minimum

Michał Charmas 2.1k Dec 4, 2022
realworld api 프로젝트입니다.

Real world author: chance0523 origin project : https://github.com/gothinkster/realworld/tree/master/api This application uses... Kotlin Spring Boot JP

서정준 4 Jul 19, 2021
CodingChallenge: A simple SDK. Which can provide you information related to Start Wars APi

CodingChallenge CodingChallenge is a simple SDK. Which can provide you informati

Wajahat Hussain 1 Feb 18, 2022
HubSpot Kotlin SDK 🧺 Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
Android Weather Library: android weather lib to develop weather based app fast and easily

WeatherLib Android weather lib is an android weather aggregator. The lib helps you getting weather data from the most importat weather provider. It su

Surviving with android (by Francesco Azzola) 641 Dec 23, 2022
Sdk-android - SnapOdds Android SDK

Documentation For the full API documentation go to https://snapodds.github.io/sd

Snapodds 0 Jan 30, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 976 Dec 29, 2022
Accept PayPal and credit cards in your Android app

Important: PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themse

PayPal 802 Dec 22, 2022
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Dec 29, 2022
Library for Android In-App Billing (Version 3+)

Checkout (Android In-App Billing Library) Description Checkout is an implementation of Android In-App Billing API (v3+). Its main goal is to make inte

Sergey Solovyev 1k Nov 26, 2022
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Countly Team 648 Dec 23, 2022
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Applozic 659 May 14, 2022
Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Evernote 424 Dec 9, 2022
SocialAuth repository which contains socialauth android version and samples

SocialAuth Android is an Android version of popular SocialAuth Java library. Now you do not need to integrate multiple SDKs if you want to integrate y

3Pillar Global Open Source 318 Dec 30, 2022
Android library project for providing multiple image selection from the device.

PolyPicker Android library project for selecting/capturing multiple images from the device. Result Caution! Eclipse library project structure has been

JW 407 Dec 27, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Android Donations Lib Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin. It is used in projects, such as Open

Sufficiently Secure 346 Jan 8, 2023
Android library that provides for multiple image selection.

#MultipleImageSelect An android library that allows selection of multiple images from gallery. It shows an initial album (buckets) chooser and then im

Darshan Dorai 299 Nov 14, 2022