-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Akash Kava
authored and
Akash Kava
committed
Apr 22, 2016
1 parent
cd213a9
commit a1a9bc5
Showing
14 changed files
with
178 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
app/src/main/java/com/neurospeech/hypercubesample/AppService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.neurospeech.hypercubesample; | ||
|
||
import android.content.Context; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.neurospeech.hypercube.service.Promise; | ||
|
||
import retrofit2.http.Body; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.PUT; | ||
import retrofit2.http.Path; | ||
|
||
/** | ||
* Created by akash.kava on 22-04-2016. | ||
*/ | ||
public class AppService extends com.neurospeech.hypercube.service.RestService { | ||
|
||
API api; | ||
|
||
protected AppService(Context context) { | ||
super(context); | ||
|
||
|
||
api = createAPIClient("http://jsonplaceholder.typicode.com",API.class); | ||
} | ||
|
||
|
||
public Promise<Post[]> posts(){ | ||
return api.posts(); | ||
} | ||
|
||
public Promise<Post> put(Post post){ | ||
return api.put(post.id,post); | ||
} | ||
|
||
|
||
|
||
|
||
public interface API{ | ||
|
||
@GET("/posts") | ||
Promise<Post[]> posts(); | ||
|
||
|
||
@PUT("/posts/{id}") | ||
Promise<Post> put(@Path("id") int id, @Body Post post); | ||
|
||
} | ||
|
||
public static class Post{ | ||
|
||
@JsonProperty("id") | ||
public int id; | ||
|
||
@JsonProperty("userId") | ||
public int userId; | ||
|
||
@JsonProperty("title") | ||
public String title; | ||
|
||
@JsonProperty("body") | ||
public String body; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/neurospeech/hypercubesample/MainApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.neurospeech.hypercubesample; | ||
|
||
import android.app.Application; | ||
|
||
import com.neurospeech.hypercube.HyperCubeApplication; | ||
|
||
/** | ||
* Created by akash.kava on 22-04-2016. | ||
*/ | ||
public class MainApplication extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
HyperCubeApplication.init(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Oct 21 11:34:03 PDT 2015 | ||
#Fri Apr 22 13:18:08 IST 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters