Skip to content

Commit

Permalink
v1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
orhanobut committed Jun 29, 2015
1 parent 14621ea commit a6cefee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Wasp aims :

###Add dependency
```groovy
compile 'com.orhanobut:wasp:1.10'
compile 'com.orhanobut:wasp:1.12'
```

####Create a service interface
Expand All @@ -36,7 +36,7 @@ compile 'com.orhanobut:wasp:1.10'
public interface GitHubService {

@GET("/repos/{user}/{repo}")
void fetchRepo(
void getRepo(
@Path("user") String user,
@Path("repo") String repo,
Callback<Repo> callback
Expand Down Expand Up @@ -202,6 +202,42 @@ Use @Field annotation to provide key-value pairs
})
```

##### Request cancel
Use WaspRequest as return type and take the advantage of features such as cancel.
```java

@GET("/repos/{user}/{repo}")
WaspRequest getRepo(
@Path("user") String user,
@Path("repo") String repo,
Callback<Repo> callback
);


WaspRequest request = service.getRepo();
request.cancel();
```

for multiple request, use the request manager to cancel all request at once
```java
private final RequestManager requestManager = new SimpleRequestManager();

public void onRefreshData(){
WaspRequest request = service.getData();
requestManager.addRequest(request);
}

public void onAnotherNetworkCall() {
WaspRequest request = service.getFoo();
requestManager.addRequest(request);
}

public void onDestroy(){
requestManager.cancelAll();
}

```

##### Request Interceptor
You can intercept each request and add some additional information. You can either implement RequestInterceptor interface or use the SimpleInterceptor class. Use SimpleInterceptor if you don't need to implement each feature.

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

# VERSION_NAME=1.7-SNAPSHOT
# VERSION_CODE=8
VERSION_NAME=1.10
VERSION_CODE=11
VERSION_NAME=1.11
VERSION_CODE=12
GROUP=com.orhanobut

POM_DESCRIPTION=Android Network Solution
Expand Down

0 comments on commit a6cefee

Please sign in to comment.