Skip to content
Java client for Objectia API
Java Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
.gitignore
.travis.yml
LICENSE
Makefile
README.md
pom.xml

README.md

objectia-java

Build Status

Java client for Objectia API®

Documentation

See the Java API docs.

Requirements

Java 1.8 or later.

Installation

Maven

Add this dependency to your project's POM:

<dependency>
  <groupId>com.objectia</groupId>
  <artifactId>objectia-java</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle

Add this dependency to your project's build file:

compile "com.objectia:objectia-java:1.0.0"

Others

You'll need to manually install the following JARs:

ProGuard

If you're planning on using ProGuard, make sure that you exclude the objectia bindings. You can do this by adding the following to your proguard.cfg file:

-keep class com.objectia.** { *; }

Usage

Example.java

package examples;

import com.objectia.ObjectiaClient;
import com.objectia.api.GeoLocation;
import com.objectia.exceptions.APIException;
import com.objectia.exceptions.ResponseException;
import com.objectia.models.IPLocation;

public class Example {
    public static void main(String[] args) {
        String apiKey = System.getenv("OBJECTIA_APIKEY");

        try {
            ObjectiaClient.init(apiKey);
            IPLocation location = GeoLocation.get("8.8.8.8");
            System.err.println("Country code: " + location.getCountryCode());
        } catch (ResponseException e) {
            System.err.println("Response error: " + e.getMessage());
        } catch (APIException e) {
            System.err.println("API error: " + e.getMessage());
        } catch (IllegalArgumentException e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}

License and Trademarks

Copyright (c) 2018-19 UAB Salesfly.

Licensed under the MIT license.

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.

Objectia is a registered trademark of UAB Salesfly.

You can’t perform that action at this time.