Giter Club home page Giter Club logo

shippo-java-client's Introduction

Shippo Java Bindings

You can sign up for a Shippo account at https://goshippo.com

Requirements

Java 1.5 and later

Installation

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>com.goshippo</groupId>
    <artifactId>shippo-java-client</artifactId>
    <version>1.1.4</version>
</dependency>

Others

You'll need to manually install the following JARs:

Developing with Eclipse

You can also load the source into Eclipse, simply clone this repository. Then open up Eclipse (the latest eclipse comes with maven). Within eclipse, File --> Import In the dialog window that appears, chose "Existing Maven Projects", from there on, follow the wizard, and you will have imported the project. You can then run Example.java, or any of the individual JUnit test cases.

Usage

Check out the file Example.java for more examples, alternatively you can look through all of the test classes for each particular model for examples. For useful debugging information including headers, server raw response etc, set Shippo.setDEBUG(true);

Below is a brief code example:

/* Code Example */
    public static void main(String[] args) {

    Shippo.apiKey = "<Your Shippo authToken>";
    
    Map<String, Object> addressMap = new HashMap<String, Object>();
	addressMap.put("object_purpose", "PURCHASE");
	addressMap.put("name", "Shippo Itle");
	addressMap.put("company", "Shippo");
	addressMap.put("street1", "215 Clayton St.");
	addressMap.put("city", "San Francisco");
	addressMap.put("state", "CA");
	addressMap.put("zip", "94117");
	addressMap.put("country", "US");
	addressMap.put("phone", "+1 555 341 9393");
	addressMap.put("email", "[email protected]")

    try {
        Address address = Address.create(addressMap);
        System.out.println(address.toString());
        System.out.println("Zip code: " + address.getZip());
    } catch (ShippoException e) {
        e.printStackTrace();
    }
}

Testing

You must have Maven installed. To run the tests, simply run mvn test. You can run particular tests by passing -D test=Class#method -- for example, -D test=ShippoTest#testAddressCreate.

You can also run the tests in eclipse.

shippo-java-client's People

Contributors

assislucas avatar sbeidas avatar

Watchers

 avatar  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.