Skip to content

Commit

Permalink
version 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
angelodipaolo committed May 17, 2016
1 parent 9840bdc commit 987b99b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
# [3.2.0](https://github.com/Electrode-iOS/ELWebService/releases/tag/v3.2.0)

### Deprecations

- Deprecated `ServiceTaskResult.Failure`. [Use `throw` to propagate errors instead](#throwing-errors).
- Deprecated `setParameters(parameters:encoding:)` and `setParameterEncoding(encoding:)` methods of `ServiceTask`. [Use `setQueryParameters(parameters:)` and `setFormParameters(parameters:)` instead](#request-parameters).

### New Features

- Added `setQueryParameters(parameters:)` method to `ServiceTask` for setting key/value pairs in the URL query string. [Fixes #40](https://github.com/Electrode-iOS/ELWebService/issues/40).
- Added `setFormParameters(parameters:)` method to `ServiceTask` for setting key/value pairs in the request body as form encoded data. [Fixes #40](https://github.com/Electrode-iOS/ELWebService/issues/40).
- Response handler closures can throw errors to propagate errors instead of return `.Failure(error)`.

### Fixes

- Make `updateUI()` and `updateErrorUI` handlers block handler chain execution. [Fixes #38](https://github.com/Electrode-iOS/ELWebService/issues/38).

##### Throwing Errors

Previously, response handlers returned a`.Failure(error)` value to indiciate that a handler failed.

```
.responseJSON { json, response in
if let models: [Brewer] = JSONDecoder<Brewer>.decode(json) {
return .Value(models)
} else {
// any value conforming to ErrorType
return .Failure(JSONDecoderError.FailedToDecodeBrewer)
}
}
```

Response handlers should now use Swift's `throw` keyword to propagate errors.

```
.responseJSON { json, response in
guard let models: [Brewer] = JSONDecoder<Brewer>.decode(json) {
throw JSONDecoderError.FailedToDecodeBrewer
}
return .Value(models)
}
```

##### Request Parameters

GET, DELETE, or HEAD request that use `setParameters(parameters:encoding:)` to encode parameter data in the URL query string should move to using `setQueryParameters(parameters:)` to set parameter data instead.

POST and PUT requests that use `setParameters(parameters:encoding:)` to send form data, _not JSON_, in the request body should instead use `setFormParameters(parameters:)`.


# [3.1.0](https://github.com/Electrode-iOS/ELWebService/releases/tag/v3.1.0)

- Force-downcast `updateUIObjC` handler's value to avoid silent failure. Fixes [#34](https://github.com/Electrode-iOS/ELWebService/issues/34).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ELWebService requires Swift 2.2 and Xcode 7.3.
Install with [Carthage](https://github.com/Carthage/Carthage) by adding the framework to your project's [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).

```
github "Electrode-iOS/ELWebService" ~> 3.1.0
github "Electrode-iOS/ELWebService" ~> 3.2.0
```

### Manual
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.0</string>
<string>3.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 987b99b

Please sign in to comment.