Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Jan 10, 2022
2 parents 2cac7d3 + 473c791 commit ff40c37
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@ It's designed to be a robust library to handle all the cycle of an REST API call

## Getting started

### Repository

Add it in your root build.gradle at the end of repositories:

```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

### Dependency

```
dependencies {
implementation 'com.ensoft-dev.restafari:restafari:0.4.1'
implementation 'com.github.SpartanJ:restafari:0.5.0'
}
```

Expand Down Expand Up @@ -160,7 +173,7 @@ Now that we have the model and the table we want to make a request to the server

All the requests will have 4 parameters: the requests parameters, the requests headers, the response success listener and the response error listener.

Since the request is created with reflection the constructor must be the same for all the requests.
Since the request is created with reflection the constructor must be the same for all the requests.

The library provides a variety of base kind of requests depending on the response format expected:

Expand Down Expand Up @@ -229,7 +242,7 @@ public class IpResponseProcessor extends ResponseProcessor<IpModel>
// This is the same as doing "new IpTable().insertOrUpdate( response );"
response.save();
}

@Override
public void handleError( Context context, RequestConfiguration request, int errorCode, String errorMessage )
{
Expand All @@ -244,7 +257,7 @@ public class IpResponseProcessor extends ResponseProcessor<IpModel>

We have everything ready to make a request, process it and save it to our database. Now we just need to create the request.

The `RequestConfiguration` class indicates to the request service who are the classes that will handle the whole process. And will return a request id that will be used later if we need to get notifications
The `RequestConfiguration` class indicates to the request service who are the classes that will handle the whole process. And will return a request id that will be used later if we need to get notifications


```java
Expand Down Expand Up @@ -312,8 +325,8 @@ public class IpHistoryActivity extends RequestResponseActivity implements Loader

// If you wan't to get a notification in the activty when the request is done ( succcesfully or not )
// you can use the `RequestReceiverService` that will handle that notifications for you. Remember to extend from a `RequestResponseActivity` activity ( you also have the Fragment equivalent `RequestResponseFragment` ).
// Add your request to the listener.
// You'll always receive the request response, but you'll receive always when the activity is active,
// Add your request to the listener.
// You'll always receive the request response, but you'll receive always when the activity is active,
// so, if a response was received when the activity was paused, it'll be received next time the activity is resumed.
getRequestReceiverService().addRequest( requestId );

Expand Down Expand Up @@ -388,7 +401,7 @@ The library also provides ways to make just simple requests without this many st
```
The MIT License (MIT)
Copyright (c) 2020 Martín Lucas Golini
Copyright (c) 2020 Martín Lucas Golini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk11
21 changes: 20 additions & 1 deletion restafari/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apply plugin: 'com.android.library'
plugins {
id 'com.android.library'
id 'maven-publish'
}

def versionMajor = 0
def versionMinor = 5
Expand Down Expand Up @@ -29,4 +32,20 @@ dependencies {
api 'com.google.code.gson:gson:2.8.8'
api 'com.android.volley:volley:1.2.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
}

task androidSourcesJar(type: Jar) {
classifier 'sources'
from android.sourceSets.main.java.srcDirs
}

project.afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
artifact androidSourcesJar // optional sources
}
}
}
}

0 comments on commit ff40c37

Please sign in to comment.