Skip to content

Commit

Permalink
Merge pull request #107 from inaka/OpenPrivacyParser
Browse files Browse the repository at this point in the history
Open privacy parser
  • Loading branch information
Pablo Villar authored Apr 3, 2017
2 parents 79d664c + f3aab6b commit 0bb9477
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Jayme.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = "Jayme"
s.version = "4.0.0"
s.version = "4.0.1"
s.summary = "An abstraction layer that eases RESTful interconnections in Swift"
s.description = <<-DESC
Jayme is a Swift library that provides you with a set of tools which reduce drastically the amount of code you have to write to perform CRUD operations to a RESTful API. It also encapsulates networking code, encouraging you to separate networking and business logic code out of your view controllers.
Expand Down
6 changes: 3 additions & 3 deletions Jayme/HTTPResponseParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

import Foundation

typealias FullHTTPResponse = (data: Data?, urlResponse: URLResponse?, error: Error?)
typealias HTTPResponseParserResult = Result<(data: Data?, pageInfo: PageInfo?), JaymeError>
public typealias FullHTTPResponse = (data: Data?, urlResponse: URLResponse?, error: Error?)
public typealias HTTPResponseParserResult = Result<(data: Data?, pageInfo: PageInfo?), JaymeError>

/// A parser that converts raw response data (as they come from `URLSession`) into other type of data that is more Jayme-architectured.
open class HTTPResponseParser {

/// Turns response data as it comes from `URLSession` (a.k.a. `FullHTTPResponse`) into a different format, which is more useful from Jayme's perspective (a.k.a. `HTTPResponseParserResult`).
func parse(_ response: FullHTTPResponse) -> HTTPResponseParserResult {
open func parse(_ response: FullHTTPResponse) -> HTTPResponseParserResult {
if let error = response.error {
return .failure(.other(error))
}
Expand Down
7 changes: 7 additions & 0 deletions Jayme/PageInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ public struct PageInfo {
/// The total amount of items.
public let total: Int

/// Public initializer
public init(number: Int, size: Int, total: Int) {
self.number = number
self.size = size
self.total = total
}

}

public extension PageInfo {
Expand Down

0 comments on commit 0bb9477

Please sign in to comment.