Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the verbiage on the Serializer key #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Nemo Connect/Sources/NCNetworkPlistKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static NSString *const kNCWebServiceRequestSessionTypeDataTask = @"DataTask";
static NSString *const kNCWebServiceRequestSessionTypeUpload = @"Upload";
static NSString *const kNCWebServicePlist = @"plist";
static NSString *const kNCWebServiceSerialization = @"serialization";
static NSString *const kNCWebServiceSerializerClass = @"serializator";
static NSString *const kNCWebServiceSerializerClass = @"serializer";
static NSString *const kNCWebServiceSerializedObjectClass = @"serializedObject";
static NSString *const kNCNetworkHTTPHeaderFieldContentType = @"Content-Type";
static NSString *const kNCNetworkHTTPHeaderFieldContentTypeJSONApplication = @"application/json";
Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

This framework's main responsibility to download and upload data from an HTTP endpoint, parse, deserialize the data when it is possible and return with the data object.
This framework's main responsibility to download and upload data from an HTTP endpoint, parse, deserialize the data when it is possible and return with the data object.

The logic behind this approach is to create all the web service related calls and parsing logic in runtime to avoid the code duplication. Each method implementation is generated by the client, based on the plist file which belongs to the category extension.

Expand Down Expand Up @@ -48,19 +48,19 @@ Parameters must always be `NSObject`. Primitive types like `int`, `float`, `BOOL
- path
- method
- body
- header
- header
- serialization
- serializator
- serializer
- serializedObject

#### Request
Required parameter. All the request parameters like path, method, body will be sorted under it.
Required parameter. All the request parameters like path, method, body will be sorted under it.

#### Path
Always string value. You can add new request paths in here or you can substitute parameter indicators and this is the point where you can send the GET parameters to your HTTP endpoint.

#### Method
Optional parameter but always in string. Approved values are REST supported HTTP method names (`GET`, `POST`, `DELETE`, `PUT`) The default parameters is `GET`.
Optional parameter but always in string. Approved values are REST supported HTTP method names (`GET`, `POST`, `DELETE`, `PUT`) The default parameters is `GET`.

#### Body
Optional parameter. You can only pass `NSData` as a body object. Every request it is only 1 `NSData` object is supported in the parameter list.
Expand All @@ -69,9 +69,9 @@ Optional parameter. You can only pass `NSData` as a body object. Every request i
Optional parameter almost the same as the **Body** parameter. The only different between this one is only approve dictionaries.

#### Serialization
Required only when your network requests response needs to be deserialized. You have to set the serializer class name and the serialized object name.
Required only when your network requests response needs to be deserialized. You have to set the serializer class name and the serialized object name.

#### Serializator
#### serializer
Name of the serializer class. This class must conforms to `NCSerializer` protocol. With the framework we can use the `NCJSONSerializer` as a top level object mapper.

#### SerializedObject
Expand All @@ -83,18 +83,18 @@ String value, required for deserialization. The target model class name.

## Usage Examples

Below are some examples how to create an network request.
Below are some examples how to create an network request.

The first example shows how to download an image and how to setup the request. The second example will be another network request to request a JSON object with BASIC authentication. In the third example you will see a deserialization example.

### Download Request

1. First, you need to import the framework into you project and import the header file.
#import <Nemo Connect/NemoConnect.h>

#import <Nemo Connect/NemoConnect.h>

1. Then you have to create an web service instance and setup correctly with the designated initializers.

NSURL *apiURL = [NSURL URLWithString:@"http://HTTP_ENDPOINT"];
self.webService = [[NCWebService alloc] initWithBaseURL:apiURL processingQueue:self.workingQueue];
[self.webService setServiceName:@"Image"];
Expand All @@ -112,7 +112,7 @@ The first example shows how to download an image and how to setup the request. T
NCWebService+Image.plist

1. Fill the plist file as your web service required. More details about the right configuration us up in this page, under the **Configuration** section.

<img src="https://s3.amazonaws.com/f.cl.ly/items/0d2a443i0L2y3O0t2l2V/Screen%20Shot%202014-04-24%20at%2014.47.07.png" width="500px" />

1. Then, you have to just invoke this signature from you model manager implementation and you are done.
Expand All @@ -122,13 +122,13 @@ The first example shows how to download an image and how to setup the request. T

### Request with Authentication

In this example you have to create the required category header file and plist file pair as you did it in the download example.
In this example you have to create the required category header file and plist file pair as you did it in the download example.

1. First step is to setup a web service instance, create an authentication provider instance.

// create an authentication provider
NCBasicAuthentication *authenticationProvider = [[NCBasicAuthentication alloc] initWithUsername:@“USERNAME" password:@“PASSWORD”];

// setup web service
NSURL *apiURL = [NSURL URLWithString:@“http://HTTP_ENDPOINT"];
self.webService = [[NCWebService alloc] initWithBaseURL:apiURL processingQueue:self.workingQueue authenticationProvider:authenticationProvider];
Expand All @@ -140,12 +140,12 @@ In this example you have to create the required category header file and plist f

<img src="https://s3.amazonaws.com/f.cl.ly/items/2Z3A0x3Y3n0h34300z2S/Screen%20Shot%202014-04-24%20at%2015.09.14.png" width="500px" />

As you can see we are passing one parameter in here cross through the request path as a GET parameter. We marked this parameter indicator %0 - that means the first parameter from the signature.
As you can see we are passing one parameter in here cross through the request path as a GET parameter. We marked this parameter indicator %0 - that means the first parameter from the signature.

1. Invoke your signature

[self.webService searchWithZIPCode:zipCode completionBlock:^(id data, NSError *const error, NSHTTPURLResponse httpURLResponse) {

}];


Expand All @@ -157,7 +157,7 @@ Repeat the first steps, create the category header and the plist file. Then setu

- (NSOperation *)getUsersListWithCompletionBlock:(NCWebServiceCallbackBlock)completionBlock;

1. Setup the configuration file
1. Setup the configuration file

<img src="https://s3.amazonaws.com/f.cl.ly/items/1Q1P2s1K2D2T1I2V1E0j/Screen%20Shot%202014-04-24%20at%2015.18.07.png" width="500px" />

Expand All @@ -176,4 +176,4 @@ Repeat the first steps, create the category header and the plist file. Then setu

Nemo Connect is released under the MIT license. See LICENSE file for details.

<br >
<br >