You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ToopherJava is a Toopher API library that simplifies the task of interfacing with the Toopher API from Java code. This project wrangles all the dependency libraries and handles the required OAuth and JSON functionality so you can focus on just using the API.
5
4
6
-
#### Introduction
7
-
ToopherJava is a Toopher API library that simplifies the task of interfacing with the Toopher API from Java code. This project includes all the dependency libraries and handles the required OAuth and JSON functionality so you can focus on just using the API.
5
+
*Note: ToopherJava is not meant for use in Android.*
8
6
9
-
Note: ToopherJava is not meant for use in Android.
7
+
### Java Version
8
+
\>=5.0
10
9
11
-
#### Learn the Toopher API
12
-
Make sure you visit (http://dev.toopher.com) to get acquainted with the Toopher API fundamentals. The documentation there will tell you the details about the operations this API wrapper library provides.
10
+
###Documentation
11
+
Make sure you visit [https://dev.toopher.com](https://dev.toopher.com) to get acquainted with the Toopher API fundamentals. The documentation there will tell you the details about the operations this API wrapper library provides.
13
12
14
-
#### OAuth Authentication
13
+
##ToopherApi Workflow
15
14
16
-
The first step to accessing the Toopher API is to sign up for an account at the development portal (http://dev.toopher.com) and create a "requester". When that process is complete, your requester is issued OAuth 1.0a credentials in the form of a consumer key and secret. Your key is used to identify your requester when Toopher interacts with your customers, and the secret is used to sign each request so that we know it is generated by you. This library properly formats each request with your credentials automatically.
17
-
18
-
#### The Toopher Two-Step
19
-
Interacting with the Toopher web service involves two steps: pairing and authenticating.
20
-
21
-
##### Pair
22
-
Before you can enhance your website's actions with Toopher, your customers will need to pair their phone's Toopher app with your website. To do this, they generate a unique, nonsensical "pairing phrase" from within the app on their phone. You will need to prompt them for a pairing phrase as part of the Toopher enrollment process. Once you have a pairing phrase, just send it to the Toopher API along with your requester credentials and we'll return a pairing ID that you can use whenever you want to authenticate an action for that user.
23
-
24
-
##### Authenticate
25
-
You have complete control over what actions you want to authenticate using Toopher (for example: logging in, changing account information, making a purchase, etc.). Just send us the user's pairing ID, a name for the terminal they're using, and a description of the action they're trying to perform and we'll make sure they actually want it to happen.
26
-
27
-
#### Librarified
28
-
This library makes it super simple to do the Toopher two-step. Check it out:
15
+
### Step 1: Pair
16
+
Before you can enhance your website's actions with Toopher, your customers will need to pair their mobile device's Toopher app with your website. To do this, they generate a unique pairing phrase from within the app on their mobile device. You will need to prompt them for a pairing phrase as part of the Toopher enrollment process. Once you have a pairing phrase, just send it to the Toopher API along with their username and we'll return a pairing ID that you can use whenever you want to authenticate an action for that user.
29
17
30
18
```java
31
19
importcom.toopher.*;
32
20
33
21
// Create an API object using your credentials
34
22
ToopherAPI api =newToopherAPI("<your consumer key>", "<your consumer secret>");
35
23
36
-
// Step 1 - Pair with their phone's Toopher app
37
-
// With pairing phrase
24
+
// Step 1 - Pair with their mobile device's Toopher app
You have complete control over what actions you want to authenticate using Toopher (logging in, changing account information, making a purchase, etc.). Just send us the username or pairing ID and we'll make sure they actually want it to happen. You can also choose to provide the following optional parameters: terminal name, requester specified ID and action name (*default: "Log in"*).
30
+
31
+
```java
32
+
// Create an optional Map of extra parameters to provide to the API
If any request runs into an error a `RequestError` will be thrown with more details on what went wrong.
63
83
64
-
#### Dependencies
84
+
### Demo
85
+
Check out `com.toopher.ToopherAPIDemo.java` for an example program that walks you through the whole process! Just download the contents of this repo, make sure you have the dependencies installed, and run the command below:
Toopher uses [Maven](https://maven.apache.org/index.html). To install Maven with Homebrew run:
94
+
95
+
```shell
96
+
$ brew install maven
97
+
```
98
+
65
99
This library uses the Apache Commons HttpClient and OAuth-Signpost libraries, which are included as JARs in the "lib" directory. Please add these JARs to your classpath when using our library.
66
100
67
-
#####Maven
101
+
#### Maven
68
102
Alternatively, you can consume this library using Maven:
69
103
70
104
<dependency>
@@ -73,21 +107,17 @@ Alternatively, you can consume this library using Maven:
73
107
<version>1.0.0-SNAPSHOT</version>
74
108
</dependency>
75
109
76
-
#### Try it out
77
-
Check out `com.toopher.ToopherAPIDemo.java` for an example program that walks you through the whole process!
78
-
79
-
#####Ant
80
-
A runnable jar for the demo can be built and executed in Ant as follows:
110
+
### Tests
111
+
To run the tests using Maven enter:
81
112
```shell
82
-
$ ant
83
-
$ java -jar dist/toopher-1.0.0.jar
113
+
$ mvn test
84
114
```
85
115
86
-
#####Maven
87
-
The demo can be executed in Maven as follows:
116
+
To get coverage reports with the JaCoCo Maven Plugin enter:
0 commit comments