# GMNetworking

[![CI Status](http://img.shields.io/travis/wangyang/GMNetworking.svg?style=flat)](https://travis-ci.org/wangyang/GMNetworking)
[![Version](https://img.shields.io/cocoapods/v/GMNetworking.svg?style=flat)](http://cocoapods.org/pods/GMNetworking)
[![License](https://img.shields.io/cocoapods/l/GMNetworking.svg?style=flat)](http://cocoapods.org/pods/GMNetworking)
[![Platform](https://img.shields.io/cocoapods/p/GMNetworking.svg?style=flat)](http://cocoapods.org/pods/GMNetworking)

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements
Require Alamofire and EVReflection

## Installation

GMNetworking is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "GMNetworking"
```

# Usage
## Initialization
```swift
    private func setUpNetWorking() {
        GMNetworking.netErrorMsg = "网络错误"
        GMNetworking.apiHost = APIHost
        GMNetworking.urlCommonParameters = UrlCommonParams()
    }
```

## Response Handling
```swift
GMNetworking.request(.get, api, nil) { (response: GMResponse<JsonType>?, error) in
            if error != nil || (response?.error != nil && response?.error != .Success) {
                completion?(data: nil, error: true, message: response!.message)
                return
            }
            completion?(data: response!.data, error: false, message: response!.message)
        }
```
> For more cases or workground please see Example or Unit Test.



## Author

wangyang, wangyang@wanmeizhensuo.com

## License

GMNetworking is available under the MIT license. See the LICENSE file for more info.
