Skip to content

Commit a6b10a5

Browse files
committed
Add code examples to the step-by-step overview
1 parent cdab238 commit a6b10a5

1 file changed

Lines changed: 32 additions & 7 deletions

File tree

README.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,43 @@ To do this, add the dependency to your pom.xml:
2424

2525
To use this API, first create a new `WebServiceClient` object. The constructor
2626
takes your MaxMind user ID, license key, and an optional options array as
27-
arguments.
27+
arguments. For example:
28+
29+
```java
30+
WebServiceClient client = new WebServiceClient.Builder(6, "ABCD567890").build();
31+
```
2832

2933
Then create a new `Transaction` object. This represents the transaction that
3034
you are sending to minFraud. The class is instantiated using an inner builder
3135
class, `Transaction.Builder`. Each builder method takes a corresponding
32-
request object. Each of these objects is similarly built up with corresponding
33-
builder classes.
36+
request model object. Each of these objects is similarly built up with
37+
corresponding builder classes. For example:
38+
39+
```java
40+
Transaction transaction = new Transaction.Builder(
41+
new Device.Builder(InetAddress.getByName("1.1.1.1")).build()
42+
).email(
43+
new Email.Builder()
44+
.address("fraud@ster.com")
45+
.build()
46+
).build();
47+
```
48+
49+
After creating the transaction object, send a Score request by calling the
50+
`score` method:
51+
52+
```java
53+
Score score = client.score(transaction);
54+
```
55+
56+
or an Insights request by calling `insights` method:
57+
58+
```java
59+
Insights score = client.insights(transaction);
60+
```
3461

35-
After creating the request object, send a Score request by calling the `score`
36-
method or an Insights request by calling `insights` method with the
37-
transaction as a parameter. If the request succeeds, a model object will be
38-
returned for the endpoint. If the request fails, an exception will be thrown.
62+
If the request succeeds, a model object will be returned for the endpoint.
63+
If the request fails, an exception will be thrown.
3964

4065
See the API documentation for more details.
4166

0 commit comments

Comments
 (0)