forismatic-api-java

Additional

Language
Java
Version
N/A
Created
Feb 8, 2014
Updated
Apr 7, 2022 (Retired)
Owner
Boris Korogvich (VEINHORN)
Contributors
Boris Korogvich (VEINHORN)
Dmitry Mazuro (t3chnoboy)
2
Activity
Badge
Generate
Download
Source code

Advertisement

forismatic-api-java

It's an Java client for the forismatic.com API. You can use this library in your Java project to get access to the best quotes of famous people.

Dependency

Using JitPack

Step 1. Add the JitPack repository to your build file:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 2. Add the dependency

<dependency>
    <groupId>com.github.VEINHORN.forismatic-api-java</groupId>
    <artifactId>forismatic-client</artifactId>
    <version>3a7c2c856e</version>
</dependency>

You can specify version from JitPack label above or use master-SNAPSHOT to get latest.

Usage

To get a Quote object you need to call getQuote() method:

Quote quote = new Forismatic().getQuote();

API supports English & Russian languages. The default language for quotes is English. You can change it by putting constant to constructor:

Quote quote = new Forismatic(Language.ENGLISH).getQuote();

or call setLanguage() method:

Forismatic forismatic = new Forismatic();
forismatic.setLanguage(Language.ENGLISH);
Quote quote = forismatic.getQuote();

To get quote text and author, call getQuoteText() and getQuoteAuthor() methods:

String quoteText = quote.getQuoteText();
Optional<String> quoteAuthor = quote.getQuoteAuthor();

For Android developers

To use this library you need the minimum api level 8. Also add the following to your Manifest:

<uses-permission android:name="android.permission.INTERNET"/>

Applications using forismatic-api-java

License

Copyright 2014, 2022 Boris Korogvich

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.