├── LICENSE ├── Mockingdrive.podspec ├── Mockingdrive.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Mockingdrive.xcworkspace └── contents.xcworkspacedata ├── Mockingdrive ├── Info.plist ├── Mockingdrive.h └── Mockingdrive.swift ├── MockingdriveTests ├── Info.plist └── MockingdriveTests.swift ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ └── Private │ │ ├── Mockingjay │ │ └── Mockingjay.h │ │ ├── Representor │ │ └── Representor.h │ │ └── URITemplate │ │ └── URITemplate.h ├── Hyperdrive │ ├── Hyperdrive │ │ ├── HyperBlueprint.swift │ │ └── Hyperdrive.swift │ ├── LICENSE │ └── README.md ├── Manifest.lock ├── Mockingjay │ ├── LICENSE │ ├── Mockingjay │ │ ├── Builders.swift │ │ ├── Matchers.swift │ │ ├── Mockingjay.h │ │ ├── Mockingjay.swift │ │ ├── MockingjayProtocol.swift │ │ ├── NSURLSessionConfiguration.swift │ │ └── XCTest.swift │ └── README.md ├── Pods.xcodeproj │ └── project.pbxproj ├── Representor │ ├── LICENSE │ ├── README.md │ └── Representor │ │ ├── Builder │ │ ├── RepresentorBuilder.swift │ │ └── TransitionBuilder.swift │ │ ├── HTTP │ │ ├── APIBlueprint │ │ │ ├── Blueprint.swift │ │ │ └── BlueprintTransition.swift │ │ ├── Adapters │ │ │ ├── HTTPHALAdapter.swift │ │ │ └── HTTPSirenAdapter.swift │ │ ├── HTTPDeserialization.swift │ │ ├── HTTPTransition.swift │ │ └── HTTPTransitionBuilder.swift │ │ ├── Representor.h │ │ ├── Representor.swift │ │ └── Transition.swift ├── Result │ ├── LICENSE │ ├── README.md │ └── Result │ │ ├── Result.swift │ │ └── ResultType.swift ├── Target Support Files │ ├── Hyperdrive │ │ ├── Hyperdrive-Private.xcconfig │ │ ├── Hyperdrive-dummy.m │ │ ├── Hyperdrive-prefix.pch │ │ ├── Hyperdrive-umbrella.h │ │ ├── Hyperdrive.modulemap │ │ ├── Hyperdrive.xcconfig │ │ └── Info.plist │ ├── Mockingjay │ │ ├── Info.plist │ │ ├── Mockingjay-Private.xcconfig │ │ ├── Mockingjay-dummy.m │ │ ├── Mockingjay-prefix.pch │ │ ├── Mockingjay-umbrella.h │ │ ├── Mockingjay.modulemap │ │ └── Mockingjay.xcconfig │ ├── Pods-Mockingdrive │ │ ├── Info.plist │ │ ├── Pods-Mockingdrive-acknowledgements.markdown │ │ ├── Pods-Mockingdrive-acknowledgements.plist │ │ ├── Pods-Mockingdrive-dummy.m │ │ ├── Pods-Mockingdrive-frameworks.sh │ │ ├── Pods-Mockingdrive-resources.sh │ │ ├── Pods-Mockingdrive-umbrella.h │ │ ├── Pods-Mockingdrive.debug.xcconfig │ │ ├── Pods-Mockingdrive.modulemap │ │ └── Pods-Mockingdrive.release.xcconfig │ ├── Pods-MockingdriveTests │ │ ├── Info.plist │ │ ├── Pods-MockingdriveTests-acknowledgements.markdown │ │ ├── Pods-MockingdriveTests-acknowledgements.plist │ │ ├── Pods-MockingdriveTests-dummy.m │ │ ├── Pods-MockingdriveTests-frameworks.sh │ │ ├── Pods-MockingdriveTests-resources.sh │ │ ├── Pods-MockingdriveTests-umbrella.h │ │ ├── Pods-MockingdriveTests.debug.xcconfig │ │ ├── Pods-MockingdriveTests.modulemap │ │ └── Pods-MockingdriveTests.release.xcconfig │ ├── Representor │ │ ├── Info.plist │ │ ├── Representor-Private.xcconfig │ │ ├── Representor-dummy.m │ │ ├── Representor-prefix.pch │ │ ├── Representor-umbrella.h │ │ ├── Representor.modulemap │ │ └── Representor.xcconfig │ ├── Result │ │ ├── Info.plist │ │ ├── Result-Private.xcconfig │ │ ├── Result-dummy.m │ │ ├── Result-prefix.pch │ │ ├── Result-umbrella.h │ │ ├── Result.modulemap │ │ └── Result.xcconfig │ ├── URITemplate │ │ ├── Info.plist │ │ ├── URITemplate-Private.xcconfig │ │ ├── URITemplate-dummy.m │ │ ├── URITemplate-prefix.pch │ │ ├── URITemplate-umbrella.h │ │ ├── URITemplate.modulemap │ │ └── URITemplate.xcconfig │ └── WebLinking │ │ ├── Info.plist │ │ ├── WebLinking-Private.xcconfig │ │ ├── WebLinking-dummy.m │ │ ├── WebLinking-prefix.pch │ │ ├── WebLinking-umbrella.h │ │ ├── WebLinking.modulemap │ │ └── WebLinking.xcconfig ├── URITemplate │ ├── LICENSE │ ├── README.md │ └── URITemplate │ │ ├── URITemplate.h │ │ └── URITemplate.swift └── WebLinking │ ├── LICENSE │ ├── README.md │ └── WebLinking │ └── WebLinking.swift └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kyle Fuller. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Mockingdrive.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'Mockingdrive' 3 | spec.version = '0.1.0' 4 | spec.summary = 'Testing framework for stubbing Hypermedia HTTP requests' 5 | spec.homepage = 'https://github.com/kylef/Mockingdrive' 6 | spec.license = { :type => 'MIT', :file => 'LICENSE' } 7 | spec.author = { 'Kyle Fuller' => 'kyle@fuller.li' } 8 | spec.social_media_url = 'http://twitter.com/kylefuller' 9 | spec.source = { :git => 'https://github.com/kylef/Mockingdrive.git', :tag => spec.version } 10 | spec.source_files = 'Mockingdrive/*.{h,swift}' 11 | spec.frameworks = 'XCTest' 12 | spec.ios.deployment_target = '8.0' 13 | spec.osx.deployment_target = '10.9' 14 | spec.requires_arc = true 15 | spec.dependency 'Representor' 16 | spec.dependency 'Mockingjay', '~> 1.0' 17 | end 18 | 19 | -------------------------------------------------------------------------------- /Mockingdrive.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Mockingdrive.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Mockingdrive/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSHumanReadableCopyright 24 | Copyright © 2015 Cocode. All rights reserved. 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Mockingdrive/Mockingdrive.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | //! Project version number for Mockingdrive. 4 | FOUNDATION_EXPORT double MockingdriveVersionNumber; 5 | 6 | //! Project version string for Mockingdrive. 7 | FOUNDATION_EXPORT const unsigned char MockingdriveVersionString[]; 8 | -------------------------------------------------------------------------------- /Mockingdrive/Mockingdrive.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Mockingjay 3 | import Representor 4 | 5 | 6 | let representorSerializers = [ 7 | "application/vnd.siren+json": serializeSiren, 8 | "application/hal+json": serializeHAL, 9 | "application/vnd.hal+json": serializeHAL, 10 | ] 11 | 12 | 13 | /// Extensions to XCTest to provide stubbing Hypermedia responses 14 | extension XCTest { 15 | /// Stub any requests matching the matcher with the given Representor 16 | public func stub(matcher:Matcher, contentType:String = "application/hal+json", representor:Representor) -> Stub { 17 | return stub(matcher) { request in 18 | let acceptHeader = request.valueForHTTPHeaderField("Accept") ?? contentType 19 | let contentTypes = acceptHeader.componentsSeparatedByString(",") 20 | .map { $0.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) } 21 | .filter { representorSerializers.keys.contains($0) } 22 | 23 | if let contentType = contentTypes.first, serializer = representorSerializers[contentType] { 24 | let representation = serializer(representor) 25 | return json(representation, headers: ["Content-Type": contentType])(request: request) 26 | } 27 | 28 | let errorDescription = "Unknown or unsupported content types (Accept: \(acceptHeader))" 29 | return .Failure(NSError(domain: "Mockingdrive", code: 0, userInfo: [NSLocalizedDescriptionKey: errorDescription])) 30 | } 31 | } 32 | 33 | /// Stub any requests matching the matcher with the given Representor builder 34 | public func stubRepresentor(matcher:Matcher, contentType:String = "application/hal+json", closure:(RepresentorBuilder -> ())) -> Stub { 35 | return stub(matcher, contentType: contentType, representor: Representor(closure)) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /MockingdriveTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MockingdriveTests/MockingdriveTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Hyperdrive 3 | import Mockingjay 4 | import Mockingdrive 5 | import Representor 6 | 7 | 8 | class MockingdriveTests: XCTestCase { 9 | func testStubHALRepresentor() { 10 | stub(uri("https://fuller.li/"), representor: Representor { builder in 11 | builder.addAttribute("name", value: "Kyle Fuller") 12 | }) 13 | 14 | let expectation = expectationWithDescription("HAL Request") 15 | let hyperdrive = Hyperdrive(preferredContentTypes: ["application/hal+json"]) 16 | 17 | hyperdrive.enter("https://fuller.li/") { result in 18 | switch result { 19 | case .Success(let representor): 20 | XCTAssertEqual(representor.attributes as! [String:String], ["name": "Kyle Fuller"]) 21 | expectation.fulfill() 22 | case .Failure(let error): 23 | XCTFail("Unexpected failure: \(error)") 24 | } 25 | } 26 | 27 | waitForExpectationsWithTimeout(1.0, handler: nil) 28 | } 29 | 30 | func testStubSirenRepresentor() { 31 | stub(uri("https://fuller.li/"), representor: Representor { builder in 32 | builder.addAttribute("name", value: "Kyle Fuller") 33 | }) 34 | 35 | let expectation = expectationWithDescription("Siren Request") 36 | let hyperdrive = Hyperdrive(preferredContentTypes: ["application/vnd.siren+json"]) 37 | 38 | hyperdrive.enter("https://fuller.li/") { result in 39 | switch result { 40 | case .Success(let representor): 41 | XCTAssertEqual(representor.attributes as! [String:String], ["name": "Kyle Fuller"]) 42 | expectation.fulfill() 43 | case .Failure(let error): 44 | XCTFail("Unexpected failure: \(error)") 45 | } 46 | } 47 | 48 | waitForExpectationsWithTimeout(1.0, handler: nil) 49 | } 50 | 51 | func testStubRepresentor() { 52 | stubRepresentor(uri("https://fuller.li/")) { builder in 53 | builder.addAttribute("name", value: "Kyle Fuller") 54 | } 55 | 56 | let expectation = expectationWithDescription("Representor Request") 57 | let hyperdrive = Hyperdrive(preferredContentTypes: ["application/hal+json"]) 58 | 59 | hyperdrive.enter("https://fuller.li/") { result in 60 | switch result { 61 | case .Success(let representor): 62 | XCTAssertEqual(representor.attributes as! [String:String], ["name": "Kyle Fuller"]) 63 | expectation.fulfill() 64 | case .Failure(let error): 65 | XCTFail("Unexpected failure: \(error)") 66 | } 67 | } 68 | 69 | waitForExpectationsWithTimeout(1.0, handler: nil) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'Mockingdrive' do 4 | podspec 5 | end 6 | 7 | target 'MockingdriveTests' do 8 | podspec 9 | pod 'Hyperdrive' 10 | end 11 | 12 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Hyperdrive (0.2.0): 3 | - Representor (~> 0.7.0) 4 | - Result (~> 0.6-beta.1) 5 | - URITemplate (~> 1.3) 6 | - WebLinking (~> 1.0.0) 7 | - Mockingjay (1.0.0): 8 | - Mockingjay/Core (= 1.0.0) 9 | - Mockingjay/Session (= 1.0.0) 10 | - Mockingjay/XCTest (= 1.0.0) 11 | - Mockingjay/Core (1.0.0): 12 | - URITemplate (~> 1.3) 13 | - Mockingjay/Session (1.0.0): 14 | - Mockingjay/Core 15 | - Mockingjay/XCTest (1.0.0): 16 | - Mockingjay/Core 17 | - Representor (0.7.0): 18 | - Representor/Core (= 0.7.0) 19 | - Representor/HTTP (= 0.7.0) 20 | - Representor/Core (0.7.0) 21 | - Representor/HTTP (0.7.0): 22 | - Representor/HTTP/Adapters (= 0.7.0) 23 | - Representor/HTTP/Deserialization (= 0.7.0) 24 | - Representor/HTTP/Transition (= 0.7.0) 25 | - Representor/HTTP/Adapters (0.7.0): 26 | - Representor/HTTP/Adapters/APIBlueprint (= 0.7.0) 27 | - Representor/HTTP/Adapters/HAL (= 0.7.0) 28 | - Representor/HTTP/Adapters/Siren (= 0.7.0) 29 | - Representor/HTTP/Adapters/APIBlueprint (0.7.0): 30 | - Representor/HTTP/Transition 31 | - Representor/HTTP/Adapters/HAL (0.7.0): 32 | - Representor/HTTP/Transition 33 | - Representor/HTTP/Adapters/Siren (0.7.0): 34 | - Representor/HTTP/Transition 35 | - Representor/HTTP/Deserialization (0.7.0): 36 | - Representor/HTTP/Adapters/HAL 37 | - Representor/HTTP/Adapters/Siren 38 | - Representor/HTTP/Transition 39 | - Representor/HTTP/Transition (0.7.0): 40 | - Representor/Core 41 | - Result (0.6-beta.1) 42 | - URITemplate (1.3.0) 43 | - WebLinking (1.0.0) 44 | 45 | DEPENDENCIES: 46 | - Hyperdrive 47 | - Mockingjay (~> 1.0) 48 | - Representor 49 | 50 | SPEC CHECKSUMS: 51 | Hyperdrive: 7362f6cf0f450db9af34fb5cdf54ef4ff8f06322 52 | Mockingjay: 6aae9ba836a873caba2e1e2b5eaeb155f6a4514f 53 | Representor: 487b4efb0a39c2c2db258d40846d9915cd69b770 54 | Result: af24e3e57ab81005ec4221a53fd36dc1e7a52869 55 | URITemplate: 0ebbec80d1eb59a89e29db9b14c99d5908d3e574 56 | WebLinking: d5b5ab4f7305bcf29821deb5cecd775f6c37efae 57 | 58 | COCOAPODS: 0.38.2 59 | -------------------------------------------------------------------------------- /Pods/Headers/Private/Mockingjay/Mockingjay.h: -------------------------------------------------------------------------------- 1 | ../../../Mockingjay/Mockingjay/Mockingjay.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Representor/Representor.h: -------------------------------------------------------------------------------- 1 | ../../../Representor/Representor/Representor.h -------------------------------------------------------------------------------- /Pods/Headers/Private/URITemplate/URITemplate.h: -------------------------------------------------------------------------------- 1 | ../../../URITemplate/URITemplate/URITemplate.h -------------------------------------------------------------------------------- /Pods/Hyperdrive/Hyperdrive/Hyperdrive.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Hyperdrive.swift 3 | // Hyperdrive 4 | // 5 | // Created by Kyle Fuller on 08/04/2015. 6 | // Copyright (c) 2015 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Representor 11 | import URITemplate 12 | import Result 13 | 14 | 15 | /// Map a dictionaries values 16 | func map(source:[K:V], transform:(V -> V)) -> [K:V] { 17 | var result = [K:V]() 18 | 19 | for (key, value) in source { 20 | result[key] = transform(value) 21 | } 22 | 23 | return result 24 | } 25 | 26 | /// Returns an absolute URI for a URI given a base URL 27 | func absoluteURI(baseURL:NSURL?)(uri:String) -> String { 28 | return NSURL(string: uri, relativeToURL: baseURL)?.absoluteString ?? uri 29 | } 30 | 31 | /// Traverses a representor and ensures that all URIs are absolute given a base URL 32 | func absoluteRepresentor(baseURL:NSURL?)(original:Representor) -> Representor { 33 | let transitions = map(original.transitions) { transition in 34 | return HTTPTransition(uri: absoluteURI(baseURL)(uri: transition.uri)) { builder in 35 | builder.method = transition.method 36 | builder.suggestedContentTypes = transition.suggestedContentTypes 37 | 38 | for (name, attribute) in transition.attributes { 39 | builder.addAttribute(name, value: attribute.value, defaultValue: attribute.defaultValue) 40 | } 41 | 42 | for (name, parameter) in transition.parameters { 43 | builder.addParameter(name, value: parameter.value, defaultValue: parameter.defaultValue) 44 | } 45 | } 46 | } 47 | 48 | let representors = map(original.representors) { representors in 49 | representors.map(absoluteRepresentor(baseURL)) 50 | } 51 | 52 | return Representor(transitions: transitions, representors: representors, attributes: original.attributes, metadata: original.metadata) 53 | } 54 | 55 | 56 | public typealias RepresentorResult = Result, NSError> 57 | public typealias RequestResult = Result 58 | public typealias ResponseResult = Result 59 | 60 | 61 | /// A hypermedia API client 62 | public class Hyperdrive { 63 | public static var errorDomain:String { 64 | return "Hyperdrive" 65 | } 66 | 67 | private let session:NSURLSession 68 | 69 | /// An array of the supported content types in order of preference 70 | let preferredContentTypes:[String] 71 | 72 | /** Initialize hyperdrive 73 | - parameter preferredContentTypes: An optional array of the supported content types in order of preference, when this is nil. All types supported by the Representor will be used. 74 | */ 75 | public init(preferredContentTypes:[String]? = nil) { 76 | let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() 77 | session = NSURLSession(configuration: configuration) 78 | self.preferredContentTypes = preferredContentTypes ?? HTTPDeserialization.preferredContentTypes 79 | } 80 | 81 | // MARK: - 82 | 83 | /// Enter a hypermedia API given the root URI 84 | public func enter(uri:String, completion:(RepresentorResult -> Void)) { 85 | request(uri, completion:completion) 86 | } 87 | 88 | // MARK: Subclass hooks 89 | 90 | /// Construct a request from a URI and parameters 91 | public func constructRequest(uri:String, parameters:[String:AnyObject]? = nil) -> RequestResult { 92 | let expandedURI = URITemplate(template: uri).expand(parameters ?? [:]) 93 | 94 | let error = NSError(domain: Hyperdrive.errorDomain, code: 0, userInfo: [NSLocalizedDescriptionKey: "Creating NSURL from given URI failed"]) 95 | return Result(NSURL(string: expandedURI), failWith: error).map { URL in 96 | let request = NSMutableURLRequest(URL: URL) 97 | request.setValue(preferredContentTypes.joinWithSeparator("; "), forHTTPHeaderField: "Accept") 98 | return request 99 | } 100 | } 101 | 102 | public func constructRequest(transition:HTTPTransition, parameters:[String:AnyObject]? = nil, attributes:[String:AnyObject]? = nil) -> RequestResult { 103 | return constructRequest(transition.uri, parameters:parameters).map { request in 104 | request.HTTPMethod = transition.method 105 | 106 | if let attributes = attributes { 107 | request.HTTPBody = self.encodeAttributes(attributes, suggestedContentTypes: transition.suggestedContentTypes) 108 | } 109 | 110 | return request 111 | } 112 | } 113 | 114 | func encodeAttributes(attributes:[String:AnyObject], suggestedContentTypes:[String]) -> NSData? { 115 | let JSONEncoder = { (attributes:[String:AnyObject]) -> NSData? in 116 | return try? NSJSONSerialization.dataWithJSONObject(attributes, options: NSJSONWritingOptions(rawValue: 0)) 117 | } 118 | 119 | let encoders:[String:([String:AnyObject] -> NSData?)] = [ 120 | "application/json": JSONEncoder 121 | ] 122 | 123 | for contentType in suggestedContentTypes { 124 | if let encoder = encoders[contentType] { 125 | return encoder(attributes) 126 | } 127 | } 128 | 129 | return JSONEncoder(attributes) 130 | } 131 | 132 | public func constructResponse(request:NSURLRequest, response:NSHTTPURLResponse, body:NSData?) -> Representor? { 133 | if let body = body { 134 | let representor = HTTPDeserialization.deserialize(response, body: body) 135 | if let representor = representor { 136 | return absoluteRepresentor(response.URL)(original: representor) 137 | } 138 | } 139 | 140 | return nil 141 | } 142 | 143 | // MARK: Perform requests 144 | 145 | func request(request:NSURLRequest, completion:(RepresentorResult -> Void)) { 146 | let dataTask = session.dataTaskWithRequest(request, completionHandler: { (body, response, error) -> Void in 147 | if let error = error { 148 | dispatch_async(dispatch_get_main_queue()) { 149 | completion(.Failure(error)) 150 | } 151 | } else { 152 | let representor = self.constructResponse(request, response:response as! NSHTTPURLResponse, body: body) ?? Representor() 153 | dispatch_async(dispatch_get_main_queue()) { 154 | completion(.Success(representor)) 155 | } 156 | } 157 | }) 158 | 159 | dataTask.resume() 160 | } 161 | 162 | /// Perform a request with a given URI and parameters 163 | public func request(uri:String, parameters:[String:AnyObject]? = nil, completion:(RepresentorResult -> Void)) { 164 | switch constructRequest(uri, parameters: parameters) { 165 | case .Success(let request): 166 | self.request(request, completion:completion) 167 | case .Failure(let error): 168 | completion(.Failure(error)) 169 | } 170 | } 171 | 172 | /// Perform a transition with a given parameters and attributes 173 | public func request(transition:HTTPTransition, parameters:[String:AnyObject]? = nil, attributes:[String:AnyObject]? = nil, completion:(RepresentorResult -> Void)) { 174 | let result = constructRequest(transition, parameters: parameters, attributes: attributes) 175 | 176 | switch result { 177 | case .Success(let request): 178 | self.request(request, completion:completion) 179 | case .Failure(let error): 180 | completion(.Failure(error)) 181 | } 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /Pods/Hyperdrive/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Apiary, LTD. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Pods/Hyperdrive/README.md: -------------------------------------------------------------------------------- 1 | Hyperdrive Logo 2 | 3 | # Hyperdrive 4 | 5 | Hyperdrive is a generic Hypermedia API client in Swift. Hyperdrive allows 6 | you to build an application which can evolve at run-time and does not 7 | hard-code implementation details such as URIs and HTTP methods into your 8 | application. You simply enter your API using the root URI and explore it's 9 | funcitonality at run-time by understanding the semantics of the domain 10 | instead of knowledge about the implementation. 11 | 12 | ## Usage 13 | 14 | Below is a short example of using Hyperdrive to communicate with a Hypermedia API. 15 | An API that offers information about how it works at run-time using hyperlinks. 16 | 17 | We're going to connect to a [Polls API](https://github.com/apiaryio/polls-api), 18 | an API which allows you to view questions, vote for them and create new 19 | questions with multiple-choice answers. 20 | 21 | ```swift 22 | let hyperdrive = Hyperdrive() 23 | ``` 24 | 25 | To get started, we will enter the API from its root URI. We will pass it an 26 | asynchronous function to be executed with a result from the API. 27 | 28 | ```swift 29 | hyperdrive.enter("https://polls.apiblueprint.org/") { result in 30 | switch result { 31 | case Success(let representor): 32 | println("The API has offered us the following transitions: \(representor.transitions)") 33 | 34 | case Failure(let error): 35 | println("Unfortunately there was an error: \(error)") 36 | } 37 | } 38 | ``` 39 | 40 | On success, we have a Representor, this is a structure representing the API 41 | resource. It includes relations to other resources along with information 42 | about how we can transition from the current state to another. 43 | 44 | Our client understands the semantics behind “questions” and explicitly 45 | looks for a transition to them on our API. 46 | 47 | ```swift 48 | if let questions = representor.transitions["questions"] { 49 | println("Our API has a transition to a questions resource.") 50 | } else { 51 | println("Looks like this API doesn’t support questions, or " + 52 | "the feature was removed.") 53 | } 54 | ``` 55 | 56 | Since our API has a transition to a collection of questions, let’s retrieve 57 | them and take a look: 58 | 59 | ```swift 60 | hyperdrive.request(questions) { result in 61 | switch result { 62 | case Success(let representor): 63 | println("We’ve received a representor for the questions.") 64 | 65 | case Failure(let error): 66 | println("There was a problem retreiving the questions: \(error)") 67 | } 68 | } 69 | ``` 70 | 71 | On success, we have another representor representing the questions resource in 72 | our API. 73 | 74 | ```swift 75 | if let questions = representor.representors["questions"] { 76 | // Our representor includes a collection of Question resources. 77 | // Let’s use map to call viewQuestion for each one 78 | map(questions, viewQuestion) 79 | } else { 80 | println("Looks like there are no questions yet.") 81 | println("Perhaps the API offers us the ability to create a question?") 82 | } 83 | ``` 84 | 85 | With every question in this resource, we will call our `viewQuestion` function: 86 | 87 | ```swift 88 | func viewQuestion(question:Representor) { 89 | println(question.attributes["question"]) 90 | 91 | if let choices = question.representors["choices"] { 92 | for choice in choices { 93 | let text = choice.attributes["choice"] 94 | let votes = choice.attributes["votes"] 95 | println('-> \(text) (\(votes))') 96 | } 97 | } else { 98 | println("-> This question does not have any choices.") 99 | } 100 | } 101 | ``` 102 | 103 | ### Transitioning from one state to another 104 | 105 | A representor includes information on how to transition from one state to 106 | another. For example, we might be presented with the ability to delete 107 | one of our questions: 108 | 109 | ```swift 110 | if let delete = question.transitions["delete"] { 111 | // We can perform this transition with Hyperdrive 112 | hyperdrive.request(delete) 113 | } else { 114 | println("The API doesn’t offer us the ability to delete a question.") 115 | println("Let’s gracefully handle the lack of this feature and " + 116 | "remove deletion from our user interface.") 117 | } 118 | ``` 119 | 120 | We may also be presented with an option to vote on a choice: 121 | 122 | ```swift 123 | if let vote = choice.transitions["vote"] { 124 | hyperdrive.request(vote) 125 | } 126 | ``` 127 | 128 | #### Transitions with attributes 129 | 130 | A transition may also provide attributes for performing the transition. For 131 | example, our API may afford us to perform a transition to create a new 132 | question. 133 | 134 | ```swift 135 | if let create = questions.transitions["create"] { 136 | let attributes = [ 137 | "question": "Favourite programming language?", 138 | "choices": [ 139 | "Swift", 140 | "Python", 141 | "Ruby", 142 | ] 143 | ] 144 | 145 | hyperdrive.request(create, attributes) 146 | } else { 147 | // Our API doesn’t allow us to create a question. We should remove the 148 | // ability to create a question in our user interface. 149 | // This transition may only be available to certain users. 150 | } 151 | ``` 152 | 153 | Transitions also include the available attributes you can send for run-time 154 | introspection. 155 | 156 | ```swift 157 | create.attributes 158 | ``` 159 | 160 | This allows you to generate user interface that can adapt to changes from the 161 | API. You can also use validation for an attribute. 162 | 163 | ## Content Types 164 | 165 | Hyperdrive supports the following Hypermedia content-types: 166 | 167 | - [Siren](https://github.com/kevinswiber/siren) (`application/vnd.siren+json`) 168 | - [HAL](http://stateless.co/hal_specification.html) (`application/hal+json`) 169 | 170 | For APIs which do not support Hypermedia content types, you may use an API 171 | description in form of an [API Blueprint](Blueprint.md) to load these controls. 172 | 173 | ## Installation 174 | 175 | [CocoaPods](http://cocoapods.org/) is the recommended installation method. 176 | 177 | ```ruby 178 | pod 'Hyperdrive' 179 | ``` 180 | 181 | ## License 182 | 183 | Hyperdrive is released under the MIT license. See [LICENSE](LICENSE). 184 | 185 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Hyperdrive (0.2.0): 3 | - Representor (~> 0.7.0) 4 | - Result (~> 0.6-beta.1) 5 | - URITemplate (~> 1.3) 6 | - WebLinking (~> 1.0.0) 7 | - Mockingjay (1.0.0): 8 | - Mockingjay/Core (= 1.0.0) 9 | - Mockingjay/Session (= 1.0.0) 10 | - Mockingjay/XCTest (= 1.0.0) 11 | - Mockingjay/Core (1.0.0): 12 | - URITemplate (~> 1.3) 13 | - Mockingjay/Session (1.0.0): 14 | - Mockingjay/Core 15 | - Mockingjay/XCTest (1.0.0): 16 | - Mockingjay/Core 17 | - Representor (0.7.0): 18 | - Representor/Core (= 0.7.0) 19 | - Representor/HTTP (= 0.7.0) 20 | - Representor/Core (0.7.0) 21 | - Representor/HTTP (0.7.0): 22 | - Representor/HTTP/Adapters (= 0.7.0) 23 | - Representor/HTTP/Deserialization (= 0.7.0) 24 | - Representor/HTTP/Transition (= 0.7.0) 25 | - Representor/HTTP/Adapters (0.7.0): 26 | - Representor/HTTP/Adapters/APIBlueprint (= 0.7.0) 27 | - Representor/HTTP/Adapters/HAL (= 0.7.0) 28 | - Representor/HTTP/Adapters/Siren (= 0.7.0) 29 | - Representor/HTTP/Adapters/APIBlueprint (0.7.0): 30 | - Representor/HTTP/Transition 31 | - Representor/HTTP/Adapters/HAL (0.7.0): 32 | - Representor/HTTP/Transition 33 | - Representor/HTTP/Adapters/Siren (0.7.0): 34 | - Representor/HTTP/Transition 35 | - Representor/HTTP/Deserialization (0.7.0): 36 | - Representor/HTTP/Adapters/HAL 37 | - Representor/HTTP/Adapters/Siren 38 | - Representor/HTTP/Transition 39 | - Representor/HTTP/Transition (0.7.0): 40 | - Representor/Core 41 | - Result (0.6-beta.1) 42 | - URITemplate (1.3.0) 43 | - WebLinking (1.0.0) 44 | 45 | DEPENDENCIES: 46 | - Hyperdrive 47 | - Mockingjay (~> 1.0) 48 | - Representor 49 | 50 | SPEC CHECKSUMS: 51 | Hyperdrive: 7362f6cf0f450db9af34fb5cdf54ef4ff8f06322 52 | Mockingjay: 6aae9ba836a873caba2e1e2b5eaeb155f6a4514f 53 | Representor: 487b4efb0a39c2c2db258d40846d9915cd69b770 54 | Result: af24e3e57ab81005ec4221a53fd36dc1e7a52869 55 | URITemplate: 0ebbec80d1eb59a89e29db9b14c99d5908d3e574 56 | WebLinking: d5b5ab4f7305bcf29821deb5cecd775f6c37efae 57 | 58 | COCOAPODS: 0.38.2 59 | -------------------------------------------------------------------------------- /Pods/Mockingjay/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Kyle Fuller 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Mockingjay nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/Builders.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Builders.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 01/03/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // Collection of generic builders 12 | 13 | /// Generic builder for returning a failure 14 | public func failure(error:NSError)(request:NSURLRequest) -> Response { 15 | return .Failure(error) 16 | } 17 | 18 | public func http(status:Int = 200, headers:[String:String]? = nil, data:NSData? = nil)(request:NSURLRequest) -> Response { 19 | if let response = NSHTTPURLResponse(URL: request.URL!, statusCode: status, HTTPVersion: nil, headerFields: headers) { 20 | return Response.Success(response, data) 21 | } 22 | 23 | return .Failure(NSError(domain: NSInternalInconsistencyException, code: 0, userInfo: [NSLocalizedDescriptionKey: "Failed to construct response for stub."])) 24 | } 25 | 26 | public func json(body:AnyObject, status:Int = 200, headers:[String:String]? = nil)(request:NSURLRequest) -> Response { 27 | do { 28 | let data = try NSJSONSerialization.dataWithJSONObject(body, options: NSJSONWritingOptions()) 29 | var headers = headers ?? [String:String]() 30 | if headers["Content-Type"] == nil { 31 | headers["Content-Type"] = "application/json; charset=utf-8" 32 | } 33 | 34 | return http(status, headers: headers, data: data)(request:request) 35 | } catch { 36 | return .Failure(error as NSError) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/Matchers.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Matchers.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 28/02/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import URITemplate 11 | 12 | // Collection of generic matchers 13 | 14 | /// Mockingjay matcher which returns true for every request 15 | public func everything(request:NSURLRequest) -> Bool { 16 | return true 17 | } 18 | 19 | /// Mockingjay matcher which matches URIs 20 | public func uri(uri:String)(request:NSURLRequest) -> Bool { 21 | let template = URITemplate(template:uri) 22 | 23 | if let URLString = request.URL?.absoluteString { 24 | if template.extract(URLString) != nil { 25 | return true 26 | } 27 | } 28 | 29 | if let path = request.URL?.path { 30 | if template.extract(path) != nil { 31 | return true 32 | } 33 | } 34 | 35 | return false 36 | } 37 | 38 | public enum HTTPMethod : CustomStringConvertible { 39 | case GET 40 | case POST 41 | case PATCH 42 | case PUT 43 | case DELETE 44 | case OPTIONS 45 | case HEAD 46 | 47 | public var description : String { 48 | switch self { 49 | case .GET: 50 | return "GET" 51 | case .POST: 52 | return "POST" 53 | case .PATCH: 54 | return "PATCH" 55 | case .PUT: 56 | return "PUT" 57 | case .DELETE: 58 | return "DELETE" 59 | case .OPTIONS: 60 | return "OPTIONS" 61 | case .HEAD: 62 | return "HEAD" 63 | } 64 | } 65 | } 66 | 67 | public func http(method:HTTPMethod, uri:String)(request:NSURLRequest) -> Bool { 68 | if let requestMethod = request.HTTPMethod { 69 | if requestMethod == method.description { 70 | return Mockingjay.uri(uri)(request: request) 71 | } 72 | } 73 | 74 | return false 75 | } 76 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/Mockingjay.h: -------------------------------------------------------------------------------- 1 | // 2 | // Mockingjay.h 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 21/01/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Mockingjay. 12 | FOUNDATION_EXPORT double MockingjayVersionNumber; 13 | 14 | //! Project version string for Mockingjay. 15 | FOUNDATION_EXPORT const unsigned char MockingjayVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/Mockingjay.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mockingjay.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 28/02/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum Response : Equatable { 12 | case Success(NSURLResponse, NSData?) 13 | case Failure(NSError) 14 | } 15 | 16 | public func ==(lhs:Response, rhs:Response) -> Bool { 17 | switch (lhs, rhs) { 18 | case let (.Failure(lhsError), .Failure(rhsError)): 19 | return lhsError == rhsError 20 | case let (.Success(lhsResponse, lhsData), .Success(rhsResponse, rhsData)): 21 | return lhsResponse == rhsResponse && lhsData == rhsData 22 | default: 23 | return false 24 | } 25 | } 26 | 27 | public typealias Matcher = (NSURLRequest) -> (Bool) 28 | public typealias Builder = (NSURLRequest) -> (Response) 29 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/MockingjayProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockingjayProtocol.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 28/02/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /// Structure representing a registered stub 13 | public struct Stub : Equatable { 14 | let matcher:Matcher 15 | let builder:Builder 16 | let uuid:NSUUID 17 | 18 | init(matcher:Matcher, builder:Builder) { 19 | self.matcher = matcher 20 | self.builder = builder 21 | uuid = NSUUID() 22 | } 23 | } 24 | 25 | public func ==(lhs:Stub, rhs:Stub) -> Bool { 26 | return lhs.uuid == rhs.uuid 27 | } 28 | 29 | var stubs = [Stub]() 30 | 31 | public class MockingjayProtocol : NSURLProtocol { 32 | // MARK: Stubs 33 | 34 | class func addStub(stub:Stub) -> Stub { 35 | stubs.append(stub) 36 | 37 | var token: dispatch_once_t = 0 38 | dispatch_once(&token) { 39 | NSURLProtocol.registerClass(self) 40 | return 41 | } 42 | 43 | return stub 44 | } 45 | 46 | /// Register a matcher and a builder as a new stub 47 | public class func addStub(matcher:Matcher, builder:Builder) -> Stub { 48 | return addStub(Stub(matcher: matcher, builder: builder)) 49 | } 50 | 51 | /// Unregister the given stub 52 | public class func removeStub(stub:Stub) { 53 | if let index = stubs.indexOf(stub) { 54 | stubs.removeAtIndex(index) 55 | } 56 | } 57 | 58 | /// Remove all registered stubs 59 | public class func removeAllStubs() { 60 | stubs.removeAll(keepCapacity: false) 61 | } 62 | 63 | class func stubForRequest(request:NSURLRequest) -> Stub? { 64 | for stub in stubs { 65 | if stub.matcher(request) { 66 | return stub 67 | } 68 | } 69 | 70 | return nil 71 | } 72 | 73 | // MARK: NSURLProtocol 74 | 75 | override public class func canInitWithRequest(request:NSURLRequest) -> Bool { 76 | return stubForRequest(request) != nil 77 | } 78 | 79 | override public class func canonicalRequestForRequest(request: NSURLRequest) -> NSURLRequest { 80 | return request 81 | } 82 | 83 | override public func startLoading() { 84 | if let stub = MockingjayProtocol.stubForRequest(request) { 85 | switch stub.builder(request) { 86 | case .Failure(let error): 87 | client?.URLProtocol(self, didFailWithError: error) 88 | case .Success(let response, let data): 89 | client?.URLProtocol(self, didReceiveResponse: response, cacheStoragePolicy: .NotAllowed) 90 | 91 | if let data = data { 92 | client?.URLProtocol(self, didLoadData: data) 93 | } 94 | 95 | client?.URLProtocolDidFinishLoading(self) 96 | } 97 | } else { 98 | let error = NSError(domain: NSInternalInconsistencyException, code: 0, userInfo: [ NSLocalizedDescriptionKey: "Handling request without a matching stub." ]) 99 | client?.URLProtocol(self, didFailWithError: error) 100 | } 101 | } 102 | 103 | override public func stopLoading() {} 104 | } 105 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/NSURLSessionConfiguration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLSessionConfiguration.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 01/03/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension NSURLSessionConfiguration { 12 | override public class func initialize() { 13 | if (self === NSURLSessionConfiguration.self) { 14 | let defaultSessionConfiguration = class_getClassMethod(self, "defaultSessionConfiguration") 15 | let mockingjayDefaultSessionConfiguration = class_getClassMethod(self, "mockingjayDefaultSessionConfiguration") 16 | method_exchangeImplementations(defaultSessionConfiguration, mockingjayDefaultSessionConfiguration) 17 | 18 | let ephemeralSessionConfiguration = class_getClassMethod(self, "ephemeralSessionConfiguration") 19 | let mockingjayEphemeralSessionConfiguration = class_getClassMethod(self, "mockingjayEphemeralSessionConfiguration") 20 | method_exchangeImplementations(ephemeralSessionConfiguration, mockingjayEphemeralSessionConfiguration) 21 | } 22 | } 23 | 24 | class func mockingjayDefaultSessionConfiguration() -> NSURLSessionConfiguration { 25 | let configuration = mockingjayDefaultSessionConfiguration() 26 | configuration.protocolClasses = [MockingjayProtocol.self] as [AnyClass] + configuration.protocolClasses! 27 | return configuration 28 | } 29 | 30 | class func mockingjayEphemeralSessionConfiguration() -> NSURLSessionConfiguration { 31 | let configuration = mockingjayEphemeralSessionConfiguration() 32 | configuration.protocolClasses = [MockingjayProtocol.self] as [AnyClass] + configuration.protocolClasses! 33 | return configuration 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/Mockingjay/Mockingjay/XCTest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XCTest.swift 3 | // Mockingjay 4 | // 5 | // Created by Kyle Fuller on 28/02/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import XCTest 11 | 12 | extension XCTest { 13 | // MARK: Stubbing 14 | 15 | public func stub(matcher:Matcher, builder:Builder) -> Stub { 16 | return MockingjayProtocol.addStub(matcher, builder: builder) 17 | } 18 | 19 | public func removeStub(stub:Stub) { 20 | MockingjayProtocol.removeStub(stub) 21 | } 22 | 23 | public func removeAllStubs() { 24 | MockingjayProtocol.removeAllStubs() 25 | } 26 | 27 | // MARK: Teardown 28 | 29 | override public class func initialize() { 30 | if (self === XCTest.self) { 31 | let tearDown = class_getInstanceMethod(self, "tearDown") 32 | let mockingjayTearDown = class_getInstanceMethod(self, "mockingjayTearDown") 33 | method_exchangeImplementations(tearDown, mockingjayTearDown) 34 | } 35 | } 36 | 37 | func mockingjayTearDown() { 38 | mockingjayTearDown() 39 | MockingjayProtocol.removeAllStubs() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Pods/Mockingjay/README.md: -------------------------------------------------------------------------------- 1 | # Mockingjay 2 | 3 | An elegant library for stubbing HTTP requests in Swift, allowing you to stub any HTTP/HTTPS using `NSURLConnection` or `NSURLSession`. That includes any request made from libraries such as [Alamofire](https://github.com/Alamofire/Alamofire) and [AFNetworking](https://github.com/AFNetworking/AFNetworking). 4 | 5 | ## Installation 6 | 7 | [CocoaPods](http://cocoapods.org/) is the recommended installation method. 8 | 9 | ```ruby 10 | pod 'Mockingjay' 11 | ``` 12 | 13 | ## Usage 14 | 15 | Mockingjay has full integration to XCTest and you simply just need to register a stub, it will automatically be unloaded at the end of your test case. It will also work with the [Quick](https://github.com/Quick/Quick) behaviour-driven development framework. 16 | 17 | #### Simple stub using a URI Template, returning a response with the given JSON encoded structure 18 | 19 | ```swift 20 | let body = [ "user": "Kyle" ] 21 | stub(uri("/{user}/{repository}"), json(body)) 22 | ``` 23 | 24 | The `uri` function takes a URL or path which can have a [URI Template](https://github.com/kylef/URITemplate.swift). Such as the following: 25 | 26 | - `https://github.com/kylef/WebLinking.swift` 27 | - `https://github.com/kylef/{repository}` 28 | - `/kylef/{repository}` 29 | - `/kylef/URITemplate.swift` 30 | 31 | #### Stubbing a specific HTTP method with a JSON structure 32 | 33 | ```swift 34 | let body = [ "description": "Kyle" ] 35 | stub(http(.PUT, "/kylef/Mockingjay"), json(body)) 36 | ``` 37 | 38 | #### Stubbing everything request to result in an error 39 | 40 | ```swift 41 | let error = NSError() 42 | stub(everything, failure(error)) 43 | ``` 44 | 45 | #### Stub with a specific HTTP response 46 | 47 | ```swift 48 | stub(everything, http(status: 404)) 49 | ``` 50 | 51 | *Note, the `http` builder can take a set of headers and a body too.* 52 | 53 | ## Stub 54 | 55 | The `stub` method in Mockingjay takes two functions or closures, one to match the request and another to build the response. This allows you to easily extend the syntax to provide your own specific functions. 56 | 57 | ```swift 58 | stub(matcher, builder) 59 | ``` 60 | 61 | ### Matchers 62 | 63 | A matcher is simply a function that takes a request and returns a boolean value for if the stub matches the request. 64 | 65 | ```swift 66 | func matcher(request:NSURLRequest) -> Bool { 67 | return true // Let's match this request 68 | } 69 | 70 | stub(matcher, failure(error)) 71 | ``` 72 | 73 | ### Builders 74 | 75 | Builders are very similar to a matcher, it takes a request, and it returns either a success or failure response. 76 | 77 | ```swift 78 | func builder(request:NSURLRequest) -> Response { 79 | let response = NSHTTPURLResponse(URL: request.URL, statusCode: 200, HTTPVersion: nil, headerFields: nil)! 80 | let data:NSData? = nil 81 | return .Success(response, data) 82 | } 83 | 84 | stub(matcher, builder) 85 | ``` 86 | 87 | ### Generics 88 | 89 | You can make use of the builtin generic matchers and builders. These can be used alone, or in conjunction with custom components. 90 | 91 | ### Builtin Matchers 92 | 93 | - `everything` - Matches every given request. 94 | - `uri(template)` - Matches using a URI Template. 95 | - `http(method, template)` - Matches using a HTTP Method and URI Template. 96 | 97 | ### Builtin Builders 98 | 99 | - `failure(error)` - Builds a response using the given error. 100 | - `http(status, headers, data)` - Constructs a HTTP response using the given status, headers and data. 101 | - `json(body, status, headers)` - Constructs a JSON HTTP response after serialising the given body as JSON data. 102 | 103 | ## License 104 | 105 | Mockingjay is licensed under the BSD license. See [LICENSE](LICENSE) for more 106 | info. 107 | 108 | -------------------------------------------------------------------------------- /Pods/Representor/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Zdenek Nemec 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/Representor/README.md: -------------------------------------------------------------------------------- 1 | # Representor in Swift 2 | 3 | Swift library for building and consuming Hypermedia messages. See [The Hypermedia Project Charter](https://github.com/the-hypermedia-project/charter) for details. 4 | 5 | ## Installation 6 | 7 | Installation with CocoaPods is recommended using CocoaPods 0.36. 8 | 9 | ```ruby 10 | pod 'Representor' 11 | ``` 12 | 13 | ### Sub-projects 14 | 15 | Alternatively, you can clone Representor via git or as a submodule and 16 | include Representor.xcodeproj inside your project and add 17 | Representor.framework as a target dependency. 18 | 19 | ## Usage 20 | 21 | ### Using the builder pattern to build a representor 22 | 23 | ```swift 24 | import Representor 25 | 26 | let representor = Representor { builder in 27 | builder.addTransition("self", uri:"/notes/2/") 28 | builder.addTransition("previous", uri:"/notes/1/") 29 | builder.addTransition("next", uri:"/notes/3/") 30 | 31 | builder.addMetaData("title", "Customer Details") 32 | 33 | builder.addTransition("create", uri:"/notes/") { transitionBuilder in 34 | transitionBuilder.method = "POST" 35 | transitionBuilder.addAttribute("title") 36 | transitionBuilder.addAttribute("note") 37 | } 38 | } 39 | ``` 40 | 41 | ### Consuming a representor 42 | 43 | ```swift 44 | if let create = representor.transitions["create"] { 45 | println("You can create with the URI: \(create.uri).") 46 | } 47 | 48 | if let next = representor.transitions["next"] { 49 | println("The next representor can be found at: \(next).") 50 | } 51 | 52 | if let prev = representor.transitions["previous"] { 53 | println("The previous representor can be found at: \(prev).") 54 | } 55 | ``` 56 | 57 | ### Adapters 58 | 59 | The representor includes adapters to convert between other hypermedia types. 60 | 61 | #### NSHTTPURLResponse 62 | 63 | You can initialise a representor using a `NSHTTPURLResponse` and the body (`NSData`). It will use the content-type from the response and deserialise the body payload into a format. For unsupported/unknown types, nil will returned. 64 | 65 | ```swift 66 | let representor = HTTPDeserialization.deserialize(response, body: body) 67 | ``` 68 | 69 | You can register your own, or overide an existing HTTP deserializer for a 70 | specific content type. 71 | 72 | ```swift 73 | HTTPDeserialization.deserializers["application/json"] = { response, body in 74 | return Representor(...) 75 | } 76 | ``` 77 | 78 | ##### Supported Media Types 79 | 80 | - [HAL](http://stateless.co/hal_specification.html) JSON (application/hal+json) 81 | - [Siren](https://github.com/kevinswiber/siren) JSON (application/vnd.siren+json) 82 | 83 | #### HAL 84 | 85 | You can explicitly convert to and from a [HAL](http://stateless.co/hal_specification.html) representation using the following. 86 | 87 | ```swift 88 | let representor = deserializeHAL(representation) 89 | ``` 90 | 91 | ```swift 92 | let representation = serializeHAL(representor) 93 | ``` 94 | 95 | #### Siren 96 | 97 | Conversion to and from a [Siren](https://github.com/kevinswiber/siren) representation can also be done using the following. 98 | 99 | ```swift 100 | let representor = deserializeSiren(representation) 101 | ``` 102 | 103 | ```swift 104 | let representation = serializeSiren(representor) 105 | ``` 106 | 107 | ## License 108 | 109 | Representor is released under the MIT license. See [LICENSE](LICENSE). 110 | 111 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/Builder/RepresentorBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RepresentorBuilder.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 05/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// A class used to build a representor using a builder pattern 12 | public class RepresentorBuilder { 13 | /// The added transitions 14 | private(set) public var transitions = [String:Transition]() 15 | 16 | /// The added representors 17 | private(set) public var representors = [String:[Representor]]() 18 | 19 | /// The added attributes 20 | private(set) public var attributes = [String:AnyObject]() 21 | 22 | /// The added metadata 23 | private(set) public var metadata = [String:String]() 24 | 25 | /// Adds an attribute 26 | /// 27 | /// - parameter name: The name of the attribute 28 | /// - parameter value: The value of the attribute 29 | public func addAttribute(name:String, value:AnyObject) { 30 | attributes[name] = value 31 | } 32 | 33 | // MARK: Representors 34 | 35 | /// Adds an embedded representor 36 | /// 37 | /// - parameter name: The name of the representor 38 | /// - parameter representor: The representor 39 | public func addRepresentor(name:String, representor:Representor) { 40 | if var representorSet = representors[name] { 41 | representorSet.append(representor) 42 | representors[name] = representorSet 43 | } else{ 44 | representors[name] = [representor] 45 | } 46 | } 47 | 48 | /// Adds an embedded representor using the builder pattern 49 | /// 50 | /// - parameter name: The name of the representor 51 | /// - parameter builder: A builder to build the representor 52 | public func addRepresentor(name:String, block:((builder:RepresentorBuilder) -> ())) { 53 | addRepresentor(name, representor:Representor(block)) 54 | } 55 | 56 | // MARK: Transition 57 | 58 | /// Adds a transition 59 | /// 60 | /// - parameter name: The name (or relation) for the transition 61 | /// - parameter transition: The transition 62 | public func addTransition(name:String, _ transition:Transition) { 63 | transitions[name] = transition 64 | } 65 | 66 | /// Adds a transition with a URI 67 | /// 68 | /// - parameter name: The name (or relation) for the transition 69 | /// - parameter uri: The URI of the transition 70 | public func addTransition(name:String, uri:String) { 71 | let transition = Transition(uri: uri, attributes:[:], parameters:[:]) 72 | transitions[name] = transition 73 | } 74 | 75 | /// Adds a transition with a URI using a builder 76 | /// 77 | /// - parameter name: The name (or relation) for the transition 78 | /// - parameter uri: The URI of the transition 79 | /// - parameter builder: The builder used to create the transition 80 | public func addTransition(name:String, uri:String, builder:((Transition.Builder) -> ())) { 81 | let transition = Transition(uri: uri, builder) 82 | transitions[name] = transition 83 | } 84 | 85 | // MARK: Metadata 86 | 87 | /// Adds an piece of metadata 88 | /// 89 | /// - parameter key: The key for the metadata 90 | /// - parameter value: The value of the key 91 | public func addMetaData(key:String, value:String) { 92 | metadata[key] = value 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/Builder/TransitionBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TransitionBuilder.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 05/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// A base protocol used for building transition using a builder pattern 12 | public protocol TransitionBuilderType { 13 | } 14 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/APIBlueprint/Blueprint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Blueprint.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 06/01/2015. 6 | // Copyright (c) 2015 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // MARK: Models 12 | 13 | public typealias Metadata = (name:String, value:String) 14 | 15 | /// A structure representing an API Blueprint AST 16 | public struct Blueprint { 17 | /// Name of the API 18 | public let name:String 19 | 20 | /// Top-level description of the API in Markdown (.raw) or HTML (.html) 21 | public let description:String? 22 | 23 | /// The collection of resource groups 24 | public let resourceGroups:[ResourceGroup] 25 | 26 | public let metadata:[Metadata] 27 | 28 | public init(name:String, description:String?, resourceGroups:[ResourceGroup]) { 29 | self.metadata = [] 30 | self.name = name 31 | self.description = description 32 | self.resourceGroups = resourceGroups 33 | } 34 | 35 | public init(ast:[String:AnyObject]) { 36 | metadata = parseMetadata(ast["metadata"] as? [[String:String]]) 37 | name = ast["name"] as? String ?? "" 38 | description = ast["description"] as? String 39 | resourceGroups = parseBlueprintResourceGroups(ast) 40 | } 41 | 42 | public init?(named:String, bundle:NSBundle? = nil) { 43 | func loadFile(named:String, bundle:NSBundle) -> [String:AnyObject]? { 44 | if let url = bundle.URLForResource(named, withExtension: nil) { 45 | if let data = NSData(contentsOfURL: url) { 46 | let object: AnyObject? = try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue: 0)) 47 | return object as? [String:AnyObject] 48 | } 49 | } 50 | 51 | return nil 52 | } 53 | 54 | let ast = loadFile(named, bundle: bundle ?? NSBundle.mainBundle()) 55 | if let ast = ast { 56 | self.init(ast: ast) 57 | } else { 58 | return nil 59 | } 60 | } 61 | } 62 | 63 | /// Logical group of resources. 64 | public struct ResourceGroup { 65 | /// Name of the Resource Group 66 | public let name:String 67 | 68 | /// Description of the Resource Group (.raw or .html) 69 | public let description:String? 70 | 71 | /// Array of the respective resources belonging to the Resource Group 72 | public let resources:[Resource] 73 | 74 | public init(name:String, description:String?, resources:[Resource]) { 75 | self.name = name 76 | self.description = description 77 | self.resources = resources 78 | } 79 | } 80 | 81 | /// Description of one resource, or a cluster of resources defined by its URI template 82 | public struct Resource { 83 | /// Name of the Resource 84 | public let name:String 85 | 86 | /// Description of the Resource (.raw or .html) 87 | public let description:String? 88 | 89 | /// URI Template as defined in RFC6570 90 | // TODO, make this a URITemplate object 91 | public let uriTemplate:String 92 | 93 | /// Array of URI parameters 94 | public let parameters:[Parameter] 95 | 96 | /// Array of actions available on the resource each defining at least one complete HTTP transaction 97 | public let actions:[Action] 98 | 99 | public let content:[[String:AnyObject]] 100 | 101 | public init(name:String, description:String?, uriTemplate:String, parameters:[Parameter], actions:[Action], content:[[String:AnyObject]]? = nil) { 102 | self.name = name 103 | self.description = description 104 | self.uriTemplate = uriTemplate 105 | self.actions = actions 106 | self.parameters = parameters 107 | self.content = content ?? [] 108 | } 109 | } 110 | 111 | /// Description of one URI template parameter 112 | public struct Parameter { 113 | /// Name of the parameter 114 | public let name:String 115 | 116 | /// Description of the Parameter (.raw or .html) 117 | public let description:String? 118 | 119 | /// An arbitrary type of the parameter (a string) 120 | public let type:String? 121 | 122 | /// Boolean flag denoting whether the parameter is required (true) or not (false) 123 | public let required:Bool 124 | 125 | /// A default value of the parameter (a value assumed when the parameter is not specified) 126 | public let defaultValue:String? 127 | 128 | /// An example value of the parameter 129 | public let example:String? 130 | 131 | /// An array enumerating possible parameter values 132 | public let values:[String]? 133 | 134 | public init(name:String, description:String?, type:String?, required:Bool, defaultValue:String?, example:String?, values:[String]?) { 135 | self.name = name 136 | self.description = description 137 | self.type = type 138 | self.required = required 139 | self.defaultValue = defaultValue 140 | self.example = example 141 | self.values = values 142 | } 143 | } 144 | 145 | // An HTTP transaction (a request-response transaction). Actions are specified by an HTTP request method within a resource 146 | public struct Action { 147 | /// Name of the Action 148 | public let name:String 149 | 150 | /// Description of the Action (.raw or .html) 151 | public let description:String? 152 | 153 | /// HTTP request method defining the action 154 | public let method:String 155 | 156 | /// Array of URI parameters 157 | public let parameters:[Parameter] 158 | 159 | /// URI Template for the action, if it differs from the resource's URI 160 | public let uriTemplate:String? 161 | 162 | /// Link relation identifier of the action 163 | public let relation:String? 164 | 165 | /// HTTP transaction examples for the relevant HTTP request method 166 | public let examples:[TransactionExample] 167 | 168 | public let content:[[String:AnyObject]] 169 | 170 | public init(name:String, description:String?, method:String, parameters:[Parameter], uriTemplate:String? = nil, relation:String? = nil, examples:[TransactionExample]? = nil, content:[[String:AnyObject]]? = nil) { 171 | self.name = name 172 | self.description = description 173 | self.method = method 174 | self.parameters = parameters 175 | self.uriTemplate = uriTemplate 176 | self.relation = relation 177 | self.examples = examples ?? [] 178 | self.content = content ?? [] 179 | } 180 | } 181 | 182 | /// An HTTP transaction example with expected HTTP message request and response payload 183 | public struct TransactionExample { 184 | /// Name of the Transaction Example 185 | public let name:String 186 | 187 | /// Description of the Transaction Example (.raw or .html) 188 | public let description:String? 189 | 190 | /// Example transaction request payloads 191 | public let requests:[Payload] 192 | 193 | /// Example transaction response payloads 194 | public let responses:[Payload] 195 | 196 | public init(name:String, description:String? = nil, requests:[Payload]? = nil, responses:[Payload]? = nil) { 197 | self.name = name 198 | self.description = description 199 | self.requests = requests ?? [] 200 | self.responses = responses ?? [] 201 | } 202 | } 203 | 204 | 205 | /// An API Blueprint payload. 206 | public struct Payload { 207 | public typealias Header = (name:String, value:String) 208 | 209 | /// Name of the payload 210 | public let name:String 211 | 212 | /// Description of the Payload (.raw or .html) 213 | public let description:String? 214 | 215 | /// HTTP headers that are expected to be transferred with HTTP message represented by this payload 216 | public let headers:[Header] 217 | 218 | /// An entity body to be transferred with HTTP message represented by this payload 219 | public let body:NSData? 220 | 221 | public let content:[[String:AnyObject]] 222 | 223 | public init(name:String, description:String? = nil, headers:[Header]? = nil, body:NSData? = nil, content:[[String:AnyObject]]? = nil) { 224 | self.name = name 225 | self.description = description 226 | self.headers = headers ?? [] 227 | self.body = body 228 | self.content = content ?? [] 229 | } 230 | } 231 | 232 | 233 | // MARK: AST Parsing 234 | 235 | func compactMap(source: C, transform: (C.Generator.Element) -> T?) -> [T] { 236 | var collection = [T]() 237 | 238 | for element in source { 239 | if let item = transform(element) { 240 | collection.append(item) 241 | } 242 | } 243 | 244 | return collection 245 | } 246 | 247 | func parseMetadata(source:[[String:String]]?) -> [Metadata] { 248 | if let source = source { 249 | return compactMap(source) { item in 250 | if let name = item["name"] { 251 | if let value = item["value"] { 252 | return (name: name, value: value) 253 | } 254 | } 255 | 256 | return nil 257 | } 258 | } 259 | 260 | return [] 261 | } 262 | 263 | func parseParameter(source:[[String:AnyObject]]?) -> [Parameter] { 264 | if let source = source { 265 | return source.map { item in 266 | let name = item["name"] as? String ?? "" 267 | let description = item["description"] as? String 268 | let type = item["type"] as? String 269 | let required = item["required"] as? Bool 270 | let defaultValue = item["default"] as? String 271 | let example = item["example"] as? String 272 | let values = item["values"] as? [String] 273 | return Parameter(name: name, description: description, type: type, required: required ?? true, defaultValue: defaultValue, example: example, values: values) 274 | } 275 | } 276 | 277 | return [] 278 | } 279 | 280 | func parseActions(source:[[String:AnyObject]]?) -> [Action] { 281 | if let source = source { 282 | return compactMap(source) { item in 283 | let name = item["name"] as? String 284 | let description = item["description"] as? String 285 | let method = item["method"] as? String 286 | let parameters = parseParameter(item["parameters"] as? [[String:AnyObject]]) 287 | let attributes = item["attributes"] as? [String:String] 288 | let uriTemplate = attributes?["uriTemplate"] 289 | let relation = attributes?["relation"] 290 | let examples = parseExamples(item["examples"] as? [[String:AnyObject]]) 291 | let content = item["content"] as? [[String:AnyObject]] 292 | 293 | if let name = name { 294 | if let method = method { 295 | return Action(name: name, description: description, method: method, parameters: parameters, uriTemplate:uriTemplate, relation:relation, examples:examples, content:content) 296 | } 297 | } 298 | 299 | return nil 300 | } 301 | } 302 | 303 | return [] 304 | } 305 | 306 | func parseExamples(source:[[String:AnyObject]]?) -> [TransactionExample] { 307 | if let source = source { 308 | return compactMap(source) { item in 309 | let name = item["name"] as? String 310 | let description = item["description"] as? String 311 | let requests = parsePayloads(item["requests"] as? [[String:AnyObject]]) 312 | let responses = parsePayloads(item["responses"] as? [[String:AnyObject]]) 313 | 314 | if let name = name { 315 | return TransactionExample(name: name, description: description, requests: requests, responses: responses) 316 | } 317 | 318 | return nil 319 | } 320 | } 321 | 322 | return [] 323 | } 324 | 325 | func parsePayloads(source:[[String:AnyObject]]?) -> [Payload] { 326 | if let source = source { 327 | return compactMap(source) { item in 328 | let name = item["name"] as? String 329 | let description = item["description"] as? String 330 | let headers = parseHeaders(item["headers"] as? [[String:String]]) 331 | let bodyString = item["body"] as? String 332 | let body = bodyString?.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true) 333 | let content = item["content"] as? [[String:AnyObject]] 334 | 335 | if let name = name { 336 | return Payload(name: name, description: description, headers: headers, body: body, content: content) 337 | } 338 | 339 | return nil 340 | } 341 | } 342 | 343 | return [] 344 | } 345 | 346 | func parseHeaders(source:[[String:String]]?) -> [Payload.Header] { 347 | if let source = source { 348 | return compactMap(source) { item in 349 | if let name = item["name"] { 350 | if let value = item["value"] { 351 | return (name, value) 352 | } 353 | } 354 | 355 | return nil 356 | } 357 | } 358 | 359 | return [] 360 | } 361 | 362 | func parseResources(source:[[String:AnyObject]]?) -> [Resource] { 363 | if let source = source { 364 | return compactMap(source) { item in 365 | let name = item["name"] as? String 366 | let description = item["description"] as? String 367 | let uriTemplate = item["uriTemplate"] as? String 368 | let actions = parseActions(item["actions"] as? [[String:AnyObject]]) 369 | let parameters = parseParameter(item["parameters"] as? [[String:AnyObject]]) 370 | let content = item["content"] as? [[String:AnyObject]] 371 | 372 | if let name = name { 373 | if let uriTemplate = uriTemplate { 374 | return Resource(name: name, description: description, uriTemplate: uriTemplate, parameters: parameters, actions: actions, content: content) 375 | } 376 | } 377 | 378 | return nil 379 | } 380 | } 381 | 382 | return [] 383 | } 384 | 385 | private func parseBlueprintResourceGroups(blueprint:[String:AnyObject]) -> [ResourceGroup] { 386 | if let resourceGroups = blueprint["resourceGroups"] as? [[String:AnyObject]] { 387 | return compactMap(resourceGroups) { dictionary in 388 | if let name = dictionary["name"] as? String { 389 | let resources = parseResources(dictionary["resources"] as? [[String:AnyObject]]) 390 | let description = dictionary["description"] as? String 391 | return ResourceGroup(name: name, description: description, resources: resources) 392 | } 393 | 394 | return nil 395 | } 396 | } 397 | 398 | return [] 399 | } 400 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/APIBlueprint/BlueprintTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BlueprintTransition.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 28/01/2015. 6 | // Copyright (c) 2015 Apiary LTD. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Array { 12 | func contains(obj: T) -> Bool { 13 | let filtered = self.filter {$0 as? T == obj} 14 | return filtered.count > 0 15 | } 16 | } 17 | 18 | extension Resource { 19 | func transition(actionName:String) -> HTTPTransition? { 20 | func filterAction(action:Action) -> Bool { 21 | if let relationName = action.relation { 22 | if relationName == actionName { 23 | return true 24 | } 25 | } 26 | 27 | if action.name == actionName { 28 | return true 29 | } 30 | 31 | return false 32 | } 33 | 34 | if let action = actions.filter(filterAction).first { 35 | return HTTPTransition.from(resource: self, action: action) 36 | } 37 | 38 | return nil 39 | } 40 | } 41 | 42 | func parseAttributes(dataStructure:[String:AnyObject], builder:HTTPTransitionBuilder) { 43 | func isPropertyRequired(property:[String:AnyObject]) -> Bool? { 44 | if let valueDefinition = property["valueDefinition"] as? [String:AnyObject] { 45 | if let typeDefinition = valueDefinition["typeDefinition"] as? [String:AnyObject] { 46 | if let attributes = typeDefinition["attributes"] as? [String] { 47 | return attributes.contains("required") 48 | } 49 | } 50 | } 51 | 52 | return nil 53 | } 54 | 55 | if let sections = dataStructure["sections"] as? [[String:AnyObject]] { 56 | if let section = sections.first { 57 | if (section["class"] as? String) ?? "" == "memberType" { 58 | if let content = section["content"] as? [[String:AnyObject]] { 59 | for property in content { 60 | if ((property["class"] as? String) ?? "") != "property" { 61 | continue 62 | } 63 | 64 | if let content = property["content"] as? [String:AnyObject] { 65 | if let name = content["name"] as? [String:AnyObject] { 66 | if let literal = name["literal"] as? String { 67 | builder.addAttribute(literal, value: "", defaultValue: "", required: isPropertyRequired(content)) 68 | } 69 | } 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } 76 | } 77 | 78 | extension HTTPTransition { 79 | public static func from(resource resource:Resource, action:Action, URL:String? = nil) -> HTTPTransition { 80 | return HTTPTransition(uri: URL ?? action.uriTemplate ?? resource.uriTemplate) { builder in 81 | builder.method = action.method 82 | 83 | func addParameter(parameter:Parameter) { 84 | let value = parameter.example 85 | let defaultValue = (parameter.defaultValue ?? nil) as NSObject? 86 | builder.addParameter(parameter.name, value:value, defaultValue:defaultValue, required:parameter.required) 87 | } 88 | 89 | action.parameters.forEach(addParameter) 90 | 91 | let parameters = action.parameters.map { $0.name } 92 | let missingParentParameters = resource.parameters.filter { 93 | !parameters.contains($0.name) 94 | } 95 | missingParentParameters.forEach(addParameter) 96 | 97 | // Let's look at the MSON structure, we currently only look for the members 98 | // of an object since that's only what we can put in a transitions 99 | // attributes in the Representor 100 | let dataStructure = action.content.filter { ($0["element"] as? String) == "dataStructure" }.first 101 | if let dataStructure = dataStructure { 102 | parseAttributes(dataStructure, builder: builder) 103 | } 104 | } 105 | } 106 | } 107 | 108 | /// An extension to Blueprint providing transition conversion 109 | extension Blueprint { 110 | /// Returns a HTTPTransition representation of an action in a resource 111 | public func transition(resourceName:String, action actionName:String) -> HTTPTransition? { 112 | let resources = resourceGroups.map { resourceGroup in resourceGroup.resources }.reduce([], combine: +) 113 | let resource = resources.filter { resource in resource.name == resourceName }.first 114 | if let resource = resource { 115 | return resource.transition(actionName) 116 | } 117 | 118 | return nil 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/Adapters/HTTPHALAdapter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPHALAdapter.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 08/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | func parseHALLinks(halLinks:[String:[String:AnyObject]]) -> [String:HTTPTransition] { 12 | var links = [String:HTTPTransition]() 13 | 14 | for (link, options) in halLinks { 15 | if let href = options["href"] as? String { 16 | links[link] = HTTPTransition(uri: href) 17 | } 18 | } 19 | 20 | return links 21 | } 22 | 23 | 24 | func parseEmbeddedHALs(embeddedHALs:[String:AnyObject]) -> [String:[Representor]] { 25 | var representors = [String:[Representor]]() 26 | 27 | func parseEmbedded(embedded:[String:AnyObject]) -> Representor { 28 | return deserializeHAL(embedded) 29 | } 30 | 31 | for (name, embedded) in embeddedHALs { 32 | if let embedded = embedded as? [[String:AnyObject]] { 33 | representors[name] = embedded.map(deserializeHAL) 34 | } else if let embedded = embedded as? [String:AnyObject] { 35 | representors[name] = [deserializeHAL(embedded)] 36 | } 37 | } 38 | 39 | return representors 40 | } 41 | 42 | /// A function to deserialize a HAL structure into a HTTP Transition. 43 | public func deserializeHAL(hal:[String:AnyObject]) -> Representor { 44 | var hal = hal 45 | 46 | var links = [String:HTTPTransition]() 47 | if let halLinks = hal.removeValueForKey("_links") as? [String:[String:AnyObject]] { 48 | links = parseHALLinks(halLinks) 49 | } 50 | 51 | var representors = [String:[Representor]]() 52 | if let embedded = hal.removeValueForKey("_embedded") as? [String:AnyObject] { 53 | representors = parseEmbeddedHALs(embedded) 54 | } 55 | 56 | return Representor(transitions: links, representors: representors, attributes: hal) 57 | } 58 | 59 | /// A function to serialize a HTTP Representor into a Siren structure 60 | public func serializeHAL(representor:Representor) -> [String:AnyObject] { 61 | var representation = representor.attributes 62 | 63 | if representor.transitions.count > 0 { 64 | var links = [String:[String:String]]() 65 | 66 | for (relation, transition) in representor.transitions { 67 | links[relation] = ["href": transition.uri] 68 | } 69 | 70 | representation["_links"] = links 71 | } 72 | 73 | if representor.representors.count > 0 { 74 | var embeddedHALs = [String:[[String:AnyObject]]]() 75 | 76 | for (name, representorSet) in representor.representors { 77 | embeddedHALs[name] = representorSet.map(serializeHAL) 78 | } 79 | 80 | representation["_embedded"] = embeddedHALs 81 | } 82 | 83 | return representation 84 | } 85 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/Adapters/HTTPSirenAdapter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SirenAdapter.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 08/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private func sirenFieldToAttribute(builder: HTTPTransitionBuilder)(field:[String:AnyObject]) { 12 | if let name = field["name"] as? String { 13 | let title = field["title"] as? String 14 | let value:AnyObject? = field["value"] 15 | 16 | builder.addAttribute(name, title: title, value: value, defaultValue: nil) 17 | } 18 | } 19 | 20 | private func sirenActionToTransition(action:[String: AnyObject]) -> (name:String, transition:HTTPTransition)? { 21 | if let name = action["name"] as? String { 22 | if let href = action["href"] as? String { 23 | let transition = HTTPTransition(uri: href) { builder in 24 | if let method = action["method"] as? String { 25 | builder.method = method 26 | } 27 | 28 | if let contentType = action["type"] as? String { 29 | builder.suggestedContentTypes = [contentType] 30 | } 31 | 32 | if let fields = action["fields"] as? [[String:AnyObject]] { 33 | fields.forEach(sirenFieldToAttribute(builder)) 34 | } 35 | } 36 | 37 | return (name, transition) 38 | } 39 | } 40 | 41 | return nil 42 | } 43 | 44 | private func inputPropertyToSirenField(name:String, inputProperty:InputProperty) -> [String:AnyObject] { 45 | var field = [ 46 | "name": name 47 | ] 48 | 49 | if let value: AnyObject = inputProperty.value { 50 | field["value"] = "\(value)" 51 | } 52 | 53 | if let title = inputProperty.title { 54 | field["title"] = title 55 | } 56 | 57 | return field 58 | } 59 | 60 | private func transitionToSirenAction(relation:String, transition:HTTPTransition) -> [String:AnyObject] { 61 | var action:[String:AnyObject] = [ 62 | "href": transition.uri, 63 | "name": relation, 64 | "method": transition.method 65 | ] 66 | 67 | if let contentType = transition.suggestedContentTypes.first { 68 | action["type"] = contentType 69 | } 70 | 71 | if transition.attributes.count > 0 { 72 | action["fields"] = transition.attributes.map(inputPropertyToSirenField) 73 | } 74 | 75 | return action 76 | } 77 | 78 | /// A function to deserialize a Siren structure into a HTTP Transition. 79 | public func deserializeSiren(siren:[String:AnyObject]) -> Representor { 80 | var representors = [String:[Representor]]() 81 | var transitions = [String:HTTPTransition]() 82 | var attributes = [String:AnyObject]() 83 | 84 | if let sirenLinks = siren["links"] as? [[String:AnyObject]] { 85 | for link in sirenLinks { 86 | if let href = link["href"] as? String { 87 | if let relations = link["rel"] as? [String] { 88 | for relation in relations { 89 | transitions[relation] = HTTPTransition(uri: href) 90 | } 91 | } 92 | } 93 | } 94 | } 95 | 96 | if let entities = siren["entities"] as? [[String:AnyObject]] { 97 | for entity in entities { 98 | let representor = deserializeSiren(entity) 99 | 100 | if let relations = entity["rel"] as? [String] { 101 | for relation in relations { 102 | if var reps = representors[relation] { 103 | reps.append(representor) 104 | representors[relation] = reps 105 | } else { 106 | representors[relation] = [representor] 107 | } 108 | } 109 | } 110 | } 111 | } 112 | 113 | if let actions = siren["actions"] as? [[String:AnyObject]] { 114 | for action in actions { 115 | if let (name, transition) = sirenActionToTransition(action) { 116 | transitions[name] = transition 117 | } 118 | } 119 | } 120 | 121 | if let properties = siren["properties"] as? [String:AnyObject] { 122 | attributes = properties 123 | } 124 | 125 | return Representor(transitions: transitions, representors: representors, attributes: attributes, metadata: [:]) 126 | } 127 | 128 | /// A function to serialize a HTTP Representor into a Siren structure 129 | public func serializeSiren(representor:Representor) -> [String:AnyObject] { 130 | var representation = [String:AnyObject]() 131 | 132 | if representor.representors.count > 0 { 133 | var entities = [[String:AnyObject]]() 134 | 135 | for (relation, representorSet) in representor.representors { 136 | for representor in representorSet { 137 | var representation = serializeSiren(representor) 138 | representation["rel"] = [relation] 139 | entities.append(representation) 140 | } 141 | } 142 | 143 | representation["entities"] = entities 144 | } 145 | 146 | if representor.attributes.count > 0 { 147 | representation["properties"] = representor.attributes 148 | } 149 | 150 | let links = representor.transitions.filter { $1.method == "GET" } 151 | let actions = representor.transitions.filter { $1.method != "GET" } 152 | 153 | if links.count > 0 { 154 | representation["links"] = links.map { relation, transition in 155 | return ["rel": [relation], "href": transition.uri] 156 | } 157 | } 158 | 159 | if actions.count > 0 { 160 | representation["actions"] = actions.map(transitionToSirenAction) 161 | } 162 | 163 | return representation 164 | } 165 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/HTTPDeserialization.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPDeserialization.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 23/01/2015. 6 | // Copyright (c) 2015 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | func jsonDeserializer(closure:([String:AnyObject] -> Representor?)) -> ((response:NSHTTPURLResponse, body:NSData) -> Representor?) { 12 | return { (response, body) in 13 | let object: AnyObject? = try? NSJSONSerialization.JSONObjectWithData(body, options: NSJSONReadingOptions(rawValue: 0)) 14 | 15 | if let object = object as? [String:AnyObject] { 16 | return closure(object) 17 | } 18 | 19 | return nil 20 | } 21 | } 22 | 23 | public struct HTTPDeserialization { 24 | public typealias Deserializer = (response:NSHTTPURLResponse, body:NSData) -> (Representor?) 25 | 26 | /// A dictionary storing the registered HTTP deserializer's and their corresponding content type. 27 | public static var deserializers:[String:Deserializer] = [ 28 | "application/hal+json": jsonDeserializer { payload in 29 | return deserializeHAL(payload) 30 | }, 31 | 32 | "application/vnd.siren+json": jsonDeserializer { payload in 33 | return deserializeSiren(payload) 34 | }, 35 | ] 36 | 37 | /// An array of the supported content types in order of preference 38 | public static var preferredContentTypes:[String] = [ 39 | "application/vnd.siren+json", 40 | "application/hal+json", 41 | ] 42 | 43 | /** Deserialize an NSHTTPURLResponse and body into a Representor. 44 | Uses the deserializers defined in HTTPDeserializers. 45 | - parameter response: The response to deserialize 46 | - parameter body: The HTTP Body 47 | :return: representor 48 | */ 49 | public static func deserialize(response:NSHTTPURLResponse, body:NSData) -> Representor? { 50 | if let contentType = response.MIMEType { 51 | if let deserializer = HTTPDeserialization.deserializers[contentType] { 52 | return deserializer(response: response, body: body) 53 | } 54 | } 55 | 56 | return nil 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/HTTPTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPTransition.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 23/01/2015. 6 | // Copyright (c) 2015 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /** An implementation of the Transition protocol for HTTP. */ 12 | public struct HTTPTransition : TransitionType { 13 | public typealias Builder = HTTPTransitionBuilder 14 | 15 | public let uri:String 16 | 17 | /// The HTTP Method that should be used to make the request 18 | public let method:String 19 | /// The suggested contentType that should be used to make the request 20 | public let suggestedContentTypes:[String] 21 | 22 | public let attributes:InputProperties 23 | public let parameters:InputProperties 24 | 25 | public init(uri:String, attributes:InputProperties? = nil, parameters:InputProperties? = nil) { 26 | self.uri = uri 27 | self.attributes = attributes ?? [:] 28 | self.parameters = parameters ?? [:] 29 | self.method = "GET" 30 | self.suggestedContentTypes = [String]() 31 | } 32 | 33 | public init(uri:String, _ block:((builder:Builder) -> ())) { 34 | let builder = Builder() 35 | 36 | block(builder: builder) 37 | 38 | self.uri = uri 39 | self.attributes = builder.attributes 40 | self.parameters = builder.parameters 41 | self.method = builder.method 42 | self.suggestedContentTypes = builder.suggestedContentTypes 43 | } 44 | 45 | public var hashValue:Int { 46 | return uri.hashValue 47 | } 48 | } 49 | 50 | public func ==(lhs:HTTPTransition, rhs:HTTPTransition) -> Bool { 51 | return ( 52 | lhs.uri == rhs.uri && 53 | lhs.attributes == rhs.attributes && 54 | lhs.parameters == rhs.parameters && 55 | lhs.method == rhs.method && 56 | lhs.suggestedContentTypes == rhs.suggestedContentTypes 57 | ) 58 | } 59 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/HTTP/HTTPTransitionBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPTransitionBuilder.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 23/01/2015. 6 | // Copyright (c) 2015 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// An implementation of TransitionBuilder used by the HTTPTransition 12 | public class HTTPTransitionBuilder : TransitionBuilderType { 13 | var attributes = InputProperties() 14 | var parameters = InputProperties() 15 | 16 | /// The suggested contentType that should be used to make the request 17 | public var method = "POST" 18 | /// The suggested contentType that should be used to make the request 19 | public var suggestedContentTypes = [String]() 20 | 21 | init() { 22 | 23 | } 24 | 25 | // MARK: Attributes 26 | 27 | /// Adds an attribute with a value or default value 28 | /// 29 | /// - parameter name: The name of the attribute 30 | /// - parameter title: The human readable title of the attribute 31 | /// - parameter value: The value of the attribute 32 | /// - parameter defaultValue: The default value of the attribute 33 | public func addAttribute(name:String, title:String? = nil, value:T? = nil, defaultValue:T? = nil, required:Bool? = nil) { 34 | let property = InputProperty(title:title, value:value, defaultValue:defaultValue, required:required) 35 | attributes[name] = property 36 | } 37 | 38 | /// Adds an attribute 39 | /// 40 | /// - parameter name: The name of the attribute 41 | /// - parameter title: The human readable title of the attribute 42 | public func addAttribute(name:String, title:String? = nil, required:Bool? = nil) { 43 | let property = InputProperty(title:title, required:required) 44 | attributes[name] = property 45 | } 46 | 47 | // MARK: Parameters 48 | 49 | /// Adds a parameter without a value or default value 50 | /// 51 | /// - parameter name: The name of the attribute 52 | public func addParameter(name:String) { 53 | let property = InputProperty(value:nil, defaultValue:nil) 54 | parameters[name] = property 55 | } 56 | 57 | /// Adds a parameter with a value or default value 58 | /// 59 | /// - parameter name: The name of the attribute 60 | /// - parameter value: The value of the attribute 61 | /// - parameter value: The default value of the attribute 62 | public func addParameter(name:String, value:T?, defaultValue:T?, required:Bool? = nil) { 63 | let property = InputProperty(value:value, defaultValue:defaultValue, required:required) 64 | parameters[name] = property 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/Representor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Representor.h 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 04/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Representor. 12 | FOUNDATION_EXPORT double RepresentorVersionNumber; 13 | 14 | //! Project version string for Representor. 15 | FOUNDATION_EXPORT const unsigned char RepresentorVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/Representor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Representor.swift 3 | // Representor 4 | // 5 | // Created by Zdenek Nemec on 8/17/14. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Representor : Equatable, Hashable { 12 | public typealias Builder = RepresentorBuilder 13 | 14 | /// The transitions available for the representor 15 | public let transitions:[String:Transition] 16 | 17 | /// The separate representors embedded in the current representor. 18 | public let representors:[String:[Representor]] 19 | 20 | public let metadata:[String:String] 21 | 22 | /// The attributes of the representor 23 | public let attributes:[String:AnyObject] 24 | 25 | public init(transitions:[String:Transition]? = nil, representors:[String:[Representor]]? = nil, attributes:[String:AnyObject]? = nil, metadata:[String:String]? = nil) { 26 | self.transitions = transitions ?? [:] 27 | self.representors = representors ?? [:] 28 | self.attributes = attributes ?? [:] 29 | self.metadata = metadata ?? [:] 30 | } 31 | 32 | public var hashValue:Int { 33 | return transitions.count + representors.count + metadata.count + attributes.count 34 | } 35 | 36 | /// An extension to Representor to provide a builder interface for creating a Representor. 37 | public init(_ block:((builder:Builder) -> ())) { 38 | // This should belong in an extension, but due to a bug in the symbol 39 | // mangler in the Swift compiler it results in the symbol being incorrectly 40 | // mangled when being used from an extension. 41 | // 42 | // Swift ¯\_(ツ)_/¯ 43 | let builder = Builder() 44 | 45 | block(builder:builder) 46 | 47 | self.transitions = builder.transitions 48 | self.representors = builder.representors 49 | self.attributes = builder.attributes 50 | self.metadata = builder.metadata 51 | } 52 | } 53 | 54 | public func ==(lhs:[String:[Representor]], rhs:[String:[Representor]]) -> Bool { 55 | // There is a strange Swift bug where you cannot compare a 56 | // dictionary which has an array of objects which conform to Equatable. 57 | // So to be clear, that's comparing the following: 58 | // 59 | // [Equatable: [Equatable]] 60 | // 61 | // If one day this problem is solved in a newer version of Swift, 62 | // this method can be removed and the default == implementation can be used. 63 | // 64 | // Swift ¯\_(ツ)_/¯ 65 | 66 | if lhs.count != rhs.count { 67 | return false 68 | } 69 | 70 | for (key, value) in lhs { 71 | if let rhsValue = rhs[key] { 72 | if (value != rhsValue) { 73 | return false 74 | } 75 | } else { 76 | return false 77 | } 78 | } 79 | 80 | return true 81 | } 82 | 83 | public func ==(lhs:Representor, rhs:Representor) -> Bool { 84 | return ( 85 | lhs.transitions == rhs.transitions && 86 | lhs.representors == rhs.representors && 87 | lhs.metadata == rhs.metadata && 88 | (lhs.attributes as NSObject) == (rhs.attributes as NSObject) 89 | ) 90 | } 91 | -------------------------------------------------------------------------------- /Pods/Representor/Representor/Transition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Transition.swift 3 | // Representor 4 | // 5 | // Created by Kyle Fuller on 04/11/2014. 6 | // Copyright (c) 2014 Apiary. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct InputProperty : Equatable { 12 | public let title:String? 13 | 14 | public let defaultValue:T? 15 | public let value:T? 16 | public let required:Bool? 17 | 18 | // TODO: Define validators 19 | 20 | public init(title:String? = nil, value:T? = nil, defaultValue:T? = nil, required:Bool? = nil) { 21 | self.title = title 22 | self.value = value 23 | self.defaultValue = defaultValue 24 | self.required = required 25 | } 26 | } 27 | 28 | public func ==(lhs:InputProperty, rhs:InputProperty) -> Bool { 29 | return ( 30 | lhs.title == rhs.title && 31 | lhs.defaultValue as? NSObject == rhs.defaultValue as? NSObject && 32 | lhs.value as? NSObject == rhs.value as? NSObject && 33 | lhs.required == rhs.required 34 | ) 35 | } 36 | 37 | public typealias InputProperties = [String:InputProperty] 38 | 39 | /** Transition instances encapsulate information about interacting with links and forms. */ 40 | public protocol TransitionType : Equatable, Hashable { 41 | typealias Builder = TransitionBuilderType 42 | 43 | init(uri:String, attributes:InputProperties?, parameters:InputProperties?) 44 | init(uri:String, _ block:((builder:Builder) -> ())) 45 | 46 | var uri:String { get } 47 | 48 | var attributes:InputProperties { get } 49 | var parameters:InputProperties { get } 50 | } 51 | -------------------------------------------------------------------------------- /Pods/Result/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Rob Rix 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Pods/Result/README.md: -------------------------------------------------------------------------------- 1 | # Result 2 | 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![CocoaPods](https://img.shields.io/cocoapods/v/Result.svg)](https://cocoapods.org/) 5 | 6 | This is a Swift µframework providing `Result`. 7 | 8 | `Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type, with the addition of an error value to pass some error code, message, or object along to be logged or displayed to the user. 9 | 10 | 11 | ## Use 12 | 13 | [API documentation](http://cocoadocs.org/docsets/Result/) is in the source. 14 | 15 | 16 | ## Integration 17 | 18 | 1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies. 19 | 2. Drag `Result.xcodeproj` into your project or workspace. 20 | 3. Link your target against `Result.framework`. 21 | 4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.) 22 | -------------------------------------------------------------------------------- /Pods/Result/Result/Result.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Rob Rix. All rights reserved. 2 | 3 | /// An enum representing either a failure with an explanatory error, or a success with a result value. 4 | public enum Result: ResultType, CustomStringConvertible, CustomDebugStringConvertible { 5 | case Success(T) 6 | case Failure(Error) 7 | 8 | // MARK: Constructors 9 | 10 | /// Constructs a success wrapping a `value`. 11 | public init(value: T) { 12 | self = .Success(value) 13 | } 14 | 15 | /// Constructs a failure wrapping an `error`. 16 | public init(error: Error) { 17 | self = .Failure(error) 18 | } 19 | 20 | /// Constructs a result from an Optional, failing with `Error` if `nil` 21 | public init(_ value: T?, @autoclosure failWith: () -> Error) { 22 | self = value.map(Result.Success) ?? .Failure(failWith()) 23 | } 24 | 25 | /// Constructs a result from a function that uses `throw`, failing with `Error` if throws 26 | public init(@autoclosure _ f: () throws -> T) { 27 | do { 28 | self = .Success(try f()) 29 | } catch { 30 | self = .Failure(error as! Error) 31 | } 32 | } 33 | 34 | 35 | // MARK: Deconstruction 36 | 37 | /// Returns the value from `Success` Results or `throw`s the error 38 | public func dematerialize() throws -> T { 39 | switch self { 40 | case let .Success(value): 41 | return value 42 | case let .Failure(error): 43 | throw error 44 | } 45 | } 46 | 47 | /// Case analysis for Result. 48 | /// 49 | /// Returns the value produced by applying `ifFailure` to `Failure` Results, or `ifSuccess` to `Success` Results. 50 | public func analysis(@noescape ifSuccess ifSuccess: T -> Result, @noescape ifFailure: Error -> Result) -> Result { 51 | switch self { 52 | case let .Success(value): 53 | return ifSuccess(value) 54 | case let .Failure(value): 55 | return ifFailure(value) 56 | } 57 | } 58 | 59 | 60 | // MARK: Higher-order functions 61 | 62 | /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. 63 | public func map(@noescape transform: T -> U) -> Result { 64 | return flatMap { .Success(transform($0)) } 65 | } 66 | 67 | /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. 68 | public func flatMap(@noescape transform: T -> Result) -> Result { 69 | return analysis( 70 | ifSuccess: transform, 71 | ifFailure: Result.Failure) 72 | } 73 | 74 | /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` 75 | public func recover(@autoclosure value: () -> T) -> T { 76 | return self.value ?? value() 77 | } 78 | 79 | /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` 80 | public func recoverWith(@autoclosure result: () -> Result) -> Result { 81 | return analysis( 82 | ifSuccess: { _ in self }, 83 | ifFailure: { _ in result() }) 84 | } 85 | 86 | /// Transform a function from one that uses `throw` to one that returns a `Result` 87 | // public static func materialize(f: T throws -> U) -> T -> Result { 88 | // return { x in 89 | // do { 90 | // return .Success(try f(x)) 91 | // } catch { 92 | // return .Failure(error) 93 | // } 94 | // } 95 | // } 96 | 97 | 98 | // MARK: Errors 99 | 100 | /// The domain for errors constructed by Result. 101 | public static var errorDomain: String { return "com.antitypical.Result" } 102 | 103 | /// The userInfo key for source functions in errors constructed by Result. 104 | public static var functionKey: String { return "\(errorDomain).function" } 105 | 106 | /// The userInfo key for source file paths in errors constructed by Result. 107 | public static var fileKey: String { return "\(errorDomain).file" } 108 | 109 | /// The userInfo key for source file line numbers in errors constructed by Result. 110 | public static var lineKey: String { return "\(errorDomain).line" } 111 | 112 | /// Constructs an error. 113 | public static func error(message: String? = nil, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__) -> NSError { 114 | var userInfo: [String: AnyObject] = [ 115 | functionKey: function, 116 | fileKey: file, 117 | lineKey: line, 118 | ] 119 | 120 | if let message = message { 121 | userInfo[NSLocalizedDescriptionKey] = message 122 | } 123 | 124 | return NSError(domain: errorDomain, code: 0, userInfo: userInfo) 125 | } 126 | 127 | 128 | // MARK: CustomStringConvertible 129 | 130 | public var description: String { 131 | return analysis( 132 | ifSuccess: { ".Success(\($0))" }, 133 | ifFailure: { ".Failure(\($0))" }) 134 | } 135 | 136 | 137 | // MARK: CustomDebugStringConvertible 138 | 139 | public var debugDescription: String { 140 | return description 141 | } 142 | } 143 | 144 | 145 | /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. 146 | public func == (left: Result, right: Result) -> Bool { 147 | if let left = left.value, right = right.value { 148 | return left == right 149 | } else if let left = left.error, right = right.error { 150 | return left == right 151 | } 152 | return false 153 | } 154 | 155 | /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. 156 | public func != (left: Result, right: Result) -> Bool { 157 | return !(left == right) 158 | } 159 | 160 | 161 | /// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. 162 | public func ?? (left: Result, @autoclosure right: () -> T) -> T { 163 | return left.recover(right()) 164 | } 165 | 166 | /// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. 167 | public func ?? (left: Result, @autoclosure right: () -> Result) -> Result { 168 | return left.recoverWith(right()) 169 | } 170 | 171 | // MARK: - Derive result from failable closure 172 | 173 | // Disable until http://www.openradar.me/21341337 is fixed. 174 | //public func materialize(f: () throws -> T) -> Result { 175 | // do { 176 | // return .Success(try f()) 177 | // } catch { 178 | // return .Failure(error) 179 | // } 180 | //} 181 | 182 | // MARK: - Cocoa API conveniences 183 | 184 | /// Constructs a Result with the result of calling `try` with an error pointer. 185 | /// 186 | /// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: 187 | /// 188 | /// Result.try { NSData(contentsOfURL: URL, options: .DataReadingMapped, error: $0) } 189 | public func `try`(function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, `try`: NSErrorPointer -> T?) -> Result { 190 | var error: NSError? 191 | return `try`(&error).map(Result.Success) ?? .Failure(error ?? Result.error(function: function, file: file, line: line)) 192 | } 193 | 194 | /// Constructs a Result with the result of calling `try` with an error pointer. 195 | /// 196 | /// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: 197 | /// 198 | /// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } 199 | public func `try`(function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, `try`: NSErrorPointer -> Bool) -> Result<(), NSError> { 200 | var error: NSError? 201 | return `try`(&error) ? 202 | .Success(()) 203 | : .Failure(error ?? Result<(), NSError>.error(function: function, file: file, line: line)) 204 | } 205 | 206 | 207 | // MARK: - Operators 208 | 209 | infix operator >>- { 210 | // Left-associativity so that chaining works like you’d expect, and for consistency with Haskell, Runes, swiftz, etc. 211 | associativity left 212 | 213 | // Higher precedence than function application, but lower than function composition. 214 | precedence 100 215 | } 216 | 217 | infix operator &&& { 218 | /// Same associativity as &&. 219 | associativity left 220 | 221 | /// Same precedence as &&. 222 | precedence 120 223 | } 224 | 225 | /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. 226 | /// 227 | /// This is a synonym for `flatMap`. 228 | public func >>- (result: Result, @noescape transform: T -> Result) -> Result { 229 | return result.flatMap(transform) 230 | } 231 | 232 | /// Returns a Result with a tuple of `left` and `right` values if both are `Success`es, or re-wrapping the error of the earlier `Failure`. 233 | public func &&& (left: Result, @autoclosure right: () -> Result) -> Result<(T, U), Error> { 234 | return left.flatMap { left in right().map { right in (left, right) } } 235 | } 236 | 237 | 238 | import Foundation 239 | -------------------------------------------------------------------------------- /Pods/Result/Result/ResultType.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Rob Rix. All rights reserved. 2 | 3 | /// A type that can represent either failure with an error or success with a result value. 4 | public protocol ResultType { 5 | typealias Value 6 | typealias Error: ErrorType 7 | 8 | /// Constructs a successful result wrapping a `value`. 9 | init(value: Value) 10 | 11 | /// Constructs a failed result wrapping an `error`. 12 | init(error: Error) 13 | 14 | /// Case analysis for ResultType. 15 | /// 16 | /// Returns the value produced by appliying `ifFailure` to the error if self represents a failure, or `ifSuccess` to the result value if self represents a success. 17 | func analysis(@noescape ifSuccess ifSuccess: Value -> U, @noescape ifFailure: Error -> U) -> U 18 | } 19 | 20 | public extension ResultType { 21 | 22 | /// Returns the value if self represents a success, `nil` otherwise. 23 | var value: Value? { 24 | return analysis(ifSuccess: { $0 }, ifFailure: { _ in nil }) 25 | } 26 | 27 | /// Returns the error if self represents a failure, `nil` otherwise. 28 | var error: Error? { 29 | return analysis(ifSuccess: { _ in nil }, ifFailure: { $0 }) 30 | } 31 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Hyperdrive.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Hyperdrive" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Hyperdrive : NSObject 3 | @end 4 | @implementation PodsDummy_Hyperdrive 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double HyperdriveVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char HyperdriveVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive.modulemap: -------------------------------------------------------------------------------- 1 | framework module Hyperdrive { 2 | umbrella header "Hyperdrive-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Hyperdrive.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylef-archive/Mockingdrive/678e450b3b5739bf8f5cb823ff10295205b3e5e6/Pods/Target Support Files/Hyperdrive/Hyperdrive.xcconfig -------------------------------------------------------------------------------- /Pods/Target Support Files/Hyperdrive/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Mockingjay.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | FRAMEWORK_SEARCH_PATHS = ${MOCKINGJAY_FRAMEWORK_SEARCH_PATHS} 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Mockingjay" "${PODS_ROOT}/Headers/Public" 6 | OTHER_LDFLAGS = ${MOCKINGJAY_OTHER_LDFLAGS} 7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 8 | PODS_ROOT = ${SRCROOT} 9 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Mockingjay : NSObject 3 | @end 4 | @implementation PodsDummy_Mockingjay 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "Mockingjay.h" 4 | 5 | FOUNDATION_EXPORT double MockingjayVersionNumber; 6 | FOUNDATION_EXPORT const unsigned char MockingjayVersionString[]; 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay.modulemap: -------------------------------------------------------------------------------- 1 | framework module Mockingjay { 2 | umbrella header "Mockingjay-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Mockingjay/Mockingjay.xcconfig: -------------------------------------------------------------------------------- 1 | MOCKINGJAY_FRAMEWORK_SEARCH_PATHS = $(inherited) "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(PLATFORM_DIR)/Developer/Library/Frameworks" 2 | MOCKINGJAY_OTHER_LDFLAGS = -framework "XCTest" -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Mockingjay 5 | 6 | Copyright (c) 2015, Kyle Fuller 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | * Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 15 | * Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | * Neither the name of Mockingjay nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 27 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | 36 | ## Representor 37 | 38 | The MIT License (MIT) 39 | 40 | Copyright (c) 2014 Zdenek Nemec 41 | 42 | Permission is hereby granted, free of charge, to any person obtaining a copy 43 | of this software and associated documentation files (the "Software"), to deal 44 | in the Software without restriction, including without limitation the rights 45 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 46 | copies of the Software, and to permit persons to whom the Software is 47 | furnished to do so, subject to the following conditions: 48 | 49 | The above copyright notice and this permission notice shall be included in all 50 | copies or substantial portions of the Software. 51 | 52 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 53 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 54 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 55 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 57 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 58 | SOFTWARE. 59 | 60 | 61 | ## URITemplate 62 | 63 | The MIT License (MIT) 64 | 65 | Copyright (c) 2014 Kyle Fuller 66 | 67 | Permission is hereby granted, free of charge, to any person obtaining a copy 68 | of this software and associated documentation files (the "Software"), to deal 69 | in the Software without restriction, including without limitation the rights 70 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 71 | copies of the Software, and to permit persons to whom the Software is 72 | furnished to do so, subject to the following conditions: 73 | 74 | The above copyright notice and this permission notice shall be included in all 75 | copies or substantial portions of the Software. 76 | 77 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 78 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 79 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 80 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 81 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 82 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 83 | SOFTWARE. 84 | 85 | 86 | Generated by CocoaPods - http://cocoapods.org 87 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2015, Kyle Fuller 18 | All rights reserved. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are met: 22 | 23 | * Redistributions of source code must retain the above copyright notice, this 24 | list of conditions and the following disclaimer. 25 | 26 | * Redistributions in binary form must reproduce the above copyright notice, 27 | this list of conditions and the following disclaimer in the documentation 28 | and/or other materials provided with the distribution. 29 | 30 | * Neither the name of Mockingjay nor the names of its 31 | contributors may be used to endorse or promote products derived from 32 | this software without specific prior written permission. 33 | 34 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 38 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 40 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 41 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 42 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | 45 | 46 | Title 47 | Mockingjay 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | FooterText 53 | The MIT License (MIT) 54 | 55 | Copyright (c) 2014 Zdenek Nemec 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy 58 | of this software and associated documentation files (the "Software"), to deal 59 | in the Software without restriction, including without limitation the rights 60 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 61 | copies of the Software, and to permit persons to whom the Software is 62 | furnished to do so, subject to the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included in all 65 | copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 68 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 69 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 70 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 71 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 72 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 73 | SOFTWARE. 74 | 75 | Title 76 | Representor 77 | Type 78 | PSGroupSpecifier 79 | 80 | 81 | FooterText 82 | The MIT License (MIT) 83 | 84 | Copyright (c) 2014 Kyle Fuller 85 | 86 | Permission is hereby granted, free of charge, to any person obtaining a copy 87 | of this software and associated documentation files (the "Software"), to deal 88 | in the Software without restriction, including without limitation the rights 89 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 90 | copies of the Software, and to permit persons to whom the Software is 91 | furnished to do so, subject to the following conditions: 92 | 93 | The above copyright notice and this permission notice shall be included in all 94 | copies or substantial portions of the Software. 95 | 96 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 97 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 98 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 99 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 100 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 101 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 102 | SOFTWARE. 103 | 104 | 105 | Title 106 | URITemplate 107 | Type 108 | PSGroupSpecifier 109 | 110 | 111 | FooterText 112 | Generated by CocoaPods - http://cocoapods.org 113 | Title 114 | 115 | Type 116 | PSGroupSpecifier 117 | 118 | 119 | StringsTable 120 | Acknowledgements 121 | Title 122 | Acknowledgements 123 | 124 | 125 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Mockingdrive : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Mockingdrive 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | else 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | fi 16 | 17 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | 19 | if [ -L "${source}" ]; then 20 | echo "Symlinked..." 21 | source="$(readlink "${source}")" 22 | fi 23 | 24 | # use filter instead of exclude so missing patterns dont' throw errors 25 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 26 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 27 | 28 | # Resign the code if required by the build settings to avoid unstable apps 29 | code_sign_if_enabled "${destination}/$(basename "$1")" 30 | 31 | # Embed linked Swift runtime libraries 32 | local basename 33 | basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})" 34 | local swift_runtime_libs 35 | swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 36 | for lib in $swift_runtime_libs; do 37 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 38 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 39 | code_sign_if_enabled "${destination}/${lib}" 40 | done 41 | } 42 | 43 | # Signs a framework with the provided identity 44 | code_sign_if_enabled() { 45 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 46 | # Use the current code_sign_identitiy 47 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 48 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 49 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 50 | fi 51 | } 52 | 53 | 54 | if [[ "$CONFIGURATION" == "Debug" ]]; then 55 | install_framework 'Pods-Mockingdrive/Mockingjay.framework' 56 | install_framework 'Pods-Mockingdrive/Representor.framework' 57 | install_framework 'Pods-Mockingdrive/URITemplate.framework' 58 | fi 59 | if [[ "$CONFIGURATION" == "Release" ]]; then 60 | install_framework 'Pods-Mockingdrive/Mockingjay.framework' 61 | install_framework 'Pods-Mockingdrive/Representor.framework' 62 | install_framework 'Pods-Mockingdrive/URITemplate.framework' 63 | fi 64 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_MockingdriveVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_MockingdriveVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Mockingjay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Representor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/URITemplate.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Mockingjay" -framework "Representor" -framework "URITemplate" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Mockingdrive 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Mockingdrive { 2 | umbrella header "Pods-Mockingdrive-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Mockingdrive/Pods-Mockingdrive.release.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Mockingjay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Representor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/URITemplate.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Mockingjay" -framework "Representor" -framework "URITemplate" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Mockingdrive 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Mockingjay 5 | 6 | Copyright (c) 2015, Kyle Fuller 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | * Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 15 | * Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | * Neither the name of Mockingjay nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 27 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | 36 | ## Representor 37 | 38 | The MIT License (MIT) 39 | 40 | Copyright (c) 2014 Zdenek Nemec 41 | 42 | Permission is hereby granted, free of charge, to any person obtaining a copy 43 | of this software and associated documentation files (the "Software"), to deal 44 | in the Software without restriction, including without limitation the rights 45 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 46 | copies of the Software, and to permit persons to whom the Software is 47 | furnished to do so, subject to the following conditions: 48 | 49 | The above copyright notice and this permission notice shall be included in all 50 | copies or substantial portions of the Software. 51 | 52 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 53 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 54 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 55 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 57 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 58 | SOFTWARE. 59 | 60 | 61 | ## URITemplate 62 | 63 | The MIT License (MIT) 64 | 65 | Copyright (c) 2014 Kyle Fuller 66 | 67 | Permission is hereby granted, free of charge, to any person obtaining a copy 68 | of this software and associated documentation files (the "Software"), to deal 69 | in the Software without restriction, including without limitation the rights 70 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 71 | copies of the Software, and to permit persons to whom the Software is 72 | furnished to do so, subject to the following conditions: 73 | 74 | The above copyright notice and this permission notice shall be included in all 75 | copies or substantial portions of the Software. 76 | 77 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 78 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 79 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 80 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 81 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 82 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 83 | SOFTWARE. 84 | 85 | 86 | 87 | ## Hyperdrive 88 | 89 | The MIT License (MIT) 90 | 91 | Copyright (c) 2015 Apiary, LTD. 92 | 93 | Permission is hereby granted, free of charge, to any person obtaining a copy 94 | of this software and associated documentation files (the "Software"), to deal 95 | in the Software without restriction, including without limitation the rights 96 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 97 | copies of the Software, and to permit persons to whom the Software is 98 | furnished to do so, subject to the following conditions: 99 | 100 | The above copyright notice and this permission notice shall be included in all 101 | copies or substantial portions of the Software. 102 | 103 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 104 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 105 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 106 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 107 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 108 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 109 | SOFTWARE. 110 | 111 | 112 | 113 | ## Result 114 | 115 | The MIT License (MIT) 116 | 117 | Copyright (c) 2014 Rob Rix 118 | 119 | Permission is hereby granted, free of charge, to any person obtaining a copy 120 | of this software and associated documentation files (the "Software"), to deal 121 | in the Software without restriction, including without limitation the rights 122 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 123 | copies of the Software, and to permit persons to whom the Software is 124 | furnished to do so, subject to the following conditions: 125 | 126 | The above copyright notice and this permission notice shall be included in all 127 | copies or substantial portions of the Software. 128 | 129 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 130 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 131 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 132 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 133 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 134 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 135 | SOFTWARE. 136 | 137 | ## WebLinking 138 | 139 | The MIT License (MIT) 140 | 141 | Copyright (c) 2015 Kyle Fuller 142 | 143 | Permission is hereby granted, free of charge, to any person obtaining a copy 144 | of this software and associated documentation files (the "Software"), to deal 145 | in the Software without restriction, including without limitation the rights 146 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 147 | copies of the Software, and to permit persons to whom the Software is 148 | furnished to do so, subject to the following conditions: 149 | 150 | The above copyright notice and this permission notice shall be included in all 151 | copies or substantial portions of the Software. 152 | 153 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 154 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 155 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 156 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 157 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 158 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 159 | SOFTWARE. 160 | 161 | 162 | Generated by CocoaPods - http://cocoapods.org 163 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2015, Kyle Fuller 18 | All rights reserved. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are met: 22 | 23 | * Redistributions of source code must retain the above copyright notice, this 24 | list of conditions and the following disclaimer. 25 | 26 | * Redistributions in binary form must reproduce the above copyright notice, 27 | this list of conditions and the following disclaimer in the documentation 28 | and/or other materials provided with the distribution. 29 | 30 | * Neither the name of Mockingjay nor the names of its 31 | contributors may be used to endorse or promote products derived from 32 | this software without specific prior written permission. 33 | 34 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 38 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 40 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 41 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 42 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | 45 | 46 | Title 47 | Mockingjay 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | FooterText 53 | The MIT License (MIT) 54 | 55 | Copyright (c) 2014 Zdenek Nemec 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy 58 | of this software and associated documentation files (the "Software"), to deal 59 | in the Software without restriction, including without limitation the rights 60 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 61 | copies of the Software, and to permit persons to whom the Software is 62 | furnished to do so, subject to the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included in all 65 | copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 68 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 69 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 70 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 71 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 72 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 73 | SOFTWARE. 74 | 75 | Title 76 | Representor 77 | Type 78 | PSGroupSpecifier 79 | 80 | 81 | FooterText 82 | The MIT License (MIT) 83 | 84 | Copyright (c) 2014 Kyle Fuller 85 | 86 | Permission is hereby granted, free of charge, to any person obtaining a copy 87 | of this software and associated documentation files (the "Software"), to deal 88 | in the Software without restriction, including without limitation the rights 89 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 90 | copies of the Software, and to permit persons to whom the Software is 91 | furnished to do so, subject to the following conditions: 92 | 93 | The above copyright notice and this permission notice shall be included in all 94 | copies or substantial portions of the Software. 95 | 96 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 97 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 98 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 99 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 100 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 101 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 102 | SOFTWARE. 103 | 104 | 105 | Title 106 | URITemplate 107 | Type 108 | PSGroupSpecifier 109 | 110 | 111 | FooterText 112 | The MIT License (MIT) 113 | 114 | Copyright (c) 2015 Apiary, LTD. 115 | 116 | Permission is hereby granted, free of charge, to any person obtaining a copy 117 | of this software and associated documentation files (the "Software"), to deal 118 | in the Software without restriction, including without limitation the rights 119 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 120 | copies of the Software, and to permit persons to whom the Software is 121 | furnished to do so, subject to the following conditions: 122 | 123 | The above copyright notice and this permission notice shall be included in all 124 | copies or substantial portions of the Software. 125 | 126 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 127 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 128 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 129 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 130 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 131 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 132 | SOFTWARE. 133 | 134 | 135 | Title 136 | Hyperdrive 137 | Type 138 | PSGroupSpecifier 139 | 140 | 141 | FooterText 142 | The MIT License (MIT) 143 | 144 | Copyright (c) 2014 Rob Rix 145 | 146 | Permission is hereby granted, free of charge, to any person obtaining a copy 147 | of this software and associated documentation files (the "Software"), to deal 148 | in the Software without restriction, including without limitation the rights 149 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 150 | copies of the Software, and to permit persons to whom the Software is 151 | furnished to do so, subject to the following conditions: 152 | 153 | The above copyright notice and this permission notice shall be included in all 154 | copies or substantial portions of the Software. 155 | 156 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 158 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 159 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 160 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 161 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 162 | SOFTWARE. 163 | Title 164 | Result 165 | Type 166 | PSGroupSpecifier 167 | 168 | 169 | FooterText 170 | The MIT License (MIT) 171 | 172 | Copyright (c) 2015 Kyle Fuller 173 | 174 | Permission is hereby granted, free of charge, to any person obtaining a copy 175 | of this software and associated documentation files (the "Software"), to deal 176 | in the Software without restriction, including without limitation the rights 177 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 178 | copies of the Software, and to permit persons to whom the Software is 179 | furnished to do so, subject to the following conditions: 180 | 181 | The above copyright notice and this permission notice shall be included in all 182 | copies or substantial portions of the Software. 183 | 184 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 185 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 186 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 187 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 188 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 189 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 190 | SOFTWARE. 191 | 192 | 193 | Title 194 | WebLinking 195 | Type 196 | PSGroupSpecifier 197 | 198 | 199 | FooterText 200 | Generated by CocoaPods - http://cocoapods.org 201 | Title 202 | 203 | Type 204 | PSGroupSpecifier 205 | 206 | 207 | StringsTable 208 | Acknowledgements 209 | Title 210 | Acknowledgements 211 | 212 | 213 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_MockingdriveTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_MockingdriveTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | else 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | fi 16 | 17 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | 19 | if [ -L "${source}" ]; then 20 | echo "Symlinked..." 21 | source="$(readlink "${source}")" 22 | fi 23 | 24 | # use filter instead of exclude so missing patterns dont' throw errors 25 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 26 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 27 | 28 | # Resign the code if required by the build settings to avoid unstable apps 29 | code_sign_if_enabled "${destination}/$(basename "$1")" 30 | 31 | # Embed linked Swift runtime libraries 32 | local basename 33 | basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})" 34 | local swift_runtime_libs 35 | swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 36 | for lib in $swift_runtime_libs; do 37 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 38 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 39 | code_sign_if_enabled "${destination}/${lib}" 40 | done 41 | } 42 | 43 | # Signs a framework with the provided identity 44 | code_sign_if_enabled() { 45 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 46 | # Use the current code_sign_identitiy 47 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 48 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 49 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 50 | fi 51 | } 52 | 53 | 54 | if [[ "$CONFIGURATION" == "Debug" ]]; then 55 | install_framework 'Pods-MockingdriveTests/Mockingjay.framework' 56 | install_framework 'Pods-MockingdriveTests/Representor.framework' 57 | install_framework 'Pods-MockingdriveTests/URITemplate.framework' 58 | install_framework 'Pods-MockingdriveTests/Hyperdrive.framework' 59 | install_framework 'Pods-MockingdriveTests/Result.framework' 60 | install_framework 'Pods-MockingdriveTests/WebLinking.framework' 61 | fi 62 | if [[ "$CONFIGURATION" == "Release" ]]; then 63 | install_framework 'Pods-MockingdriveTests/Mockingjay.framework' 64 | install_framework 'Pods-MockingdriveTests/Representor.framework' 65 | install_framework 'Pods-MockingdriveTests/URITemplate.framework' 66 | install_framework 'Pods-MockingdriveTests/Hyperdrive.framework' 67 | install_framework 'Pods-MockingdriveTests/Result.framework' 68 | install_framework 'Pods-MockingdriveTests/WebLinking.framework' 69 | fi 70 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_MockingdriveTestsVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_MockingdriveTestsVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Hyperdrive.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Mockingjay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Representor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Result.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/URITemplate.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/WebLinking.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Hyperdrive" -framework "Mockingjay" -framework "Representor" -framework "Result" -framework "URITemplate" -framework "WebLinking" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-MockingdriveTests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_MockingdriveTests { 2 | umbrella header "Pods-MockingdriveTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MockingdriveTests/Pods-MockingdriveTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Hyperdrive.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Mockingjay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Representor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Result.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/URITemplate.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/WebLinking.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Hyperdrive" -framework "Mockingjay" -framework "Representor" -framework "Result" -framework "URITemplate" -framework "WebLinking" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-MockingdriveTests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.7.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Representor.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Representor" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Representor : NSObject 3 | @end 4 | @implementation PodsDummy_Representor 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "Representor.h" 4 | 5 | FOUNDATION_EXPORT double RepresentorVersionNumber; 6 | FOUNDATION_EXPORT const unsigned char RepresentorVersionString[]; 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor.modulemap: -------------------------------------------------------------------------------- 1 | framework module Representor { 2 | umbrella header "Representor-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Representor/Representor.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylef-archive/Mockingdrive/678e450b3b5739bf8f5cb823ff10295205b3e5e6/Pods/Target Support Files/Representor/Representor.xcconfig -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.6-beta.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Result.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Result" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Result : NSObject 3 | @end 4 | @implementation PodsDummy_Result 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double ResultVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char ResultVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result.modulemap: -------------------------------------------------------------------------------- 1 | framework module Result { 2 | umbrella header "Result-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Result/Result.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylef-archive/Mockingdrive/678e450b3b5739bf8f5cb823ff10295205b3e5e6/Pods/Target Support Files/Result/Result.xcconfig -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "URITemplate.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/URITemplate" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_URITemplate : NSObject 3 | @end 4 | @implementation PodsDummy_URITemplate 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "URITemplate.h" 4 | 5 | FOUNDATION_EXPORT double URITemplateVersionNumber; 6 | FOUNDATION_EXPORT const unsigned char URITemplateVersionString[]; 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate.modulemap: -------------------------------------------------------------------------------- 1 | framework module URITemplate { 2 | umbrella header "URITemplate-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/URITemplate/URITemplate.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylef-archive/Mockingdrive/678e450b3b5739bf8f5cb823ff10295205b3e5e6/Pods/Target Support Files/URITemplate/URITemplate.xcconfig -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "WebLinking.xcconfig" 2 | CODE_SIGN_IDENTITY = 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/WebLinking" "${PODS_ROOT}/Headers/Public" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_WebLinking : NSObject 3 | @end 4 | @implementation PodsDummy_WebLinking 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double WebLinkingVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char WebLinkingVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking.modulemap: -------------------------------------------------------------------------------- 1 | framework module WebLinking { 2 | umbrella header "WebLinking-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/WebLinking/WebLinking.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylef-archive/Mockingdrive/678e450b3b5739bf8f5cb823ff10295205b3e5e6/Pods/Target Support Files/WebLinking/WebLinking.xcconfig -------------------------------------------------------------------------------- /Pods/URITemplate/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Kyle Fuller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Pods/URITemplate/README.md: -------------------------------------------------------------------------------- 1 | URITemplate 2 | =========== 3 | 4 | Swift implementation of URI Template ([RFC6570](https://tools.ietf.org/html/rfc6570)). 5 | 6 | ## Installation 7 | 8 | [CocoaPods](http://cocoapods.org/) is the recommended installation method. 9 | 10 | ```ruby 11 | pod 'URITemplate' 12 | ``` 13 | 14 | ## Example 15 | 16 | ### Expanding a URI Template 17 | 18 | ```swift 19 | let template = URITemplate(template: "https://api.github.com/repos/{owner}/{repo}/") 20 | let url = template.expand(["owner": "kylef", "repo": "URITemplate.swift"]) 21 | => "https://api.github.com/repos/kylef/URITemplate.swift/" 22 | ``` 23 | 24 | ### Determine which variables are in a template 25 | 26 | ```swift 27 | let variables = template.variables 28 | => ["owner", "repo"] 29 | ``` 30 | 31 | ### Extract the variables used in a given URL 32 | 33 | ```swift 34 | let variables = template.extract("https://api.github.com/repos/kylef/PathKit/") 35 | => ["owner":"kylef", "repo":"PathKit"] 36 | ``` 37 | 38 | ## [RFC6570](https://tools.ietf.org/html/rfc6570) 39 | 40 | The URITemplate library follows the [test suite](https://github.com/uri-templates/uritemplate-test). 41 | 42 | We have full support for level 4 of RFC6570 when expanding a template and retrieving the variables in a template. 43 | 44 | For extraction of variables from an already expanded template, level 3 is supported. 45 | 46 | ## License 47 | 48 | URITemplate is licensed under the MIT license. See [LICENSE](LICENSE) for more 49 | info. 50 | -------------------------------------------------------------------------------- /Pods/URITemplate/URITemplate/URITemplate.h: -------------------------------------------------------------------------------- 1 | // 2 | // URITemplate.h 3 | // URITemplate 4 | // 5 | // Created by Kyle Fuller on 25/11/2014. 6 | // Copyright (c) 2014 Kyle Fuller. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for URITemplate. 12 | FOUNDATION_EXPORT double URITemplateVersionNumber; 13 | 14 | //! Project version string for URITemplate. 15 | FOUNDATION_EXPORT const unsigned char URITemplateVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Pods/URITemplate/URITemplate/URITemplate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // URITemplate.swift 3 | // URITemplate 4 | // 5 | // Created by Kyle Fuller on 25/11/2014. 6 | // Copyright (c) 2014 Kyle Fuller. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // MARK: URITemplate 12 | 13 | /// A data structure to represent an RFC6570 URI template. 14 | public struct URITemplate : CustomStringConvertible, Equatable, Hashable, StringLiteralConvertible, ExtendedGraphemeClusterLiteralConvertible, UnicodeScalarLiteralConvertible { 15 | /// The underlying URI template 16 | public let template:String 17 | 18 | var regex:NSRegularExpression { 19 | let expression: NSRegularExpression? 20 | do { 21 | expression = try NSRegularExpression(pattern: "\\{([^\\}]+)\\}", options: NSRegularExpressionOptions(rawValue: 0)) 22 | } catch let error as NSError { 23 | fatalError("Invalid Regex \(error)") 24 | } 25 | return expression! 26 | } 27 | 28 | var operators:[Operator] { 29 | return [ 30 | StringExpansion(), 31 | ReservedExpansion(), 32 | FragmentExpansion(), 33 | LabelExpansion(), 34 | PathSegmentExpansion(), 35 | PathStyleParameterExpansion(), 36 | FormStyleQueryExpansion(), 37 | FormStyleQueryContinuation(), 38 | ] 39 | } 40 | 41 | /// Initialize a URITemplate with the given template 42 | public init(template:String) { 43 | self.template = template 44 | } 45 | 46 | public typealias ExtendedGraphemeClusterLiteralType = StringLiteralType 47 | public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) { 48 | template = value 49 | } 50 | 51 | public typealias UnicodeScalarLiteralType = StringLiteralType 52 | public init(unicodeScalarLiteral value: UnicodeScalarLiteralType) { 53 | template = value 54 | } 55 | 56 | public init(stringLiteral value: StringLiteralType) { 57 | template = value 58 | } 59 | 60 | /// Returns a description of the URITemplate 61 | public var description:String { 62 | return template 63 | } 64 | 65 | public var hashValue:Int { 66 | return template.hashValue 67 | } 68 | 69 | /// Returns the set of keywords in the URI Template 70 | public var variables:[String] { 71 | let expressions = regex.matches(template).map { expression in 72 | // Removes the { and } from the expression 73 | expression.substringWithRange(expression.startIndex.successor().. [String] in 77 | var expression = expression 78 | 79 | for op in self.operators { 80 | if let op = op.op { 81 | if expression.hasPrefix(op) { 82 | expression = expression.substringFromIndex(expression.startIndex.successor()) 83 | break 84 | } 85 | } 86 | } 87 | 88 | return expression.componentsSeparatedByString(",").map { component in 89 | if component.hasSuffix("*") { 90 | return component.substringToIndex(expression.endIndex.predecessor()) 91 | } else { 92 | return component 93 | } 94 | } 95 | }.reduce([], combine: +) 96 | } 97 | 98 | /// Expand template as a URI Template using the given variables 99 | public func expand(variables:[String:AnyObject]) -> String { 100 | return regex.substitute(template) { string in 101 | var expression = string.substringWithRange(string.startIndex.successor().. String? in 119 | var variable = vari 120 | var prefix:Int? 121 | 122 | if let range = variable.rangeOfString(":") { 123 | prefix = Int(variable.substringFromIndex(range.endIndex)) 124 | variable = variable.substringToIndex(range.startIndex) 125 | } 126 | 127 | let explode = variable.hasSuffix("*") 128 | 129 | if explode { 130 | variable = variable.substringToIndex(variable.endIndex.predecessor()) 131 | } 132 | 133 | if let value:AnyObject = variables[variable] { 134 | return op!.expand(variable, value: value, explode: explode, prefix:prefix) 135 | } 136 | 137 | return op!.expand(variable, value:nil, explode:false, prefix:prefix) 138 | } 139 | 140 | let expansions = rawExpansions.reduce([], combine: { (accumulator, expansion) -> [String] in 141 | if let expansion = expansion { 142 | return accumulator + [expansion] 143 | } 144 | 145 | return accumulator 146 | }) 147 | 148 | if expansions.count > 0 { 149 | return op!.prefix + expansions.joinWithSeparator(op!.joiner) 150 | } 151 | 152 | return "" 153 | } 154 | } 155 | 156 | func regexForVariable(variable:String, op:Operator?) -> String { 157 | if op != nil { 158 | return "(.*)" 159 | } else { 160 | return "([A-z0-9%_\\-]+)" 161 | } 162 | } 163 | 164 | func regexForExpression(expression:String) -> String { 165 | var expression = expression 166 | 167 | let op = operators.filter { 168 | $0.op != nil && expression.hasPrefix($0.op!) 169 | }.first 170 | 171 | if op != nil { 172 | expression = expression.substringWithRange(expression.startIndex.successor().. String in 176 | return self.regexForVariable(variable, op: op) 177 | } 178 | 179 | return regexes.joinWithSeparator((op ?? StringExpansion()).joiner) 180 | } 181 | 182 | var extractionRegex:NSRegularExpression? { 183 | let regex = try! NSRegularExpression(pattern: "(\\{([^\\}]+)\\})|[^(.*)]", options: NSRegularExpressionOptions(rawValue: 0)) 184 | 185 | let pattern = regex.substitute(self.template) { expression in 186 | if expression.hasPrefix("{") && expression.hasSuffix("}") { 187 | let startIndex = expression.startIndex.successor() 188 | let endIndex = expression.endIndex.predecessor() 189 | return self.regexForExpression(expression.substringWithRange(startIndex.. [String:String]? { 204 | if let expression = extractionRegex { 205 | let input = url as NSString 206 | let range = NSRange(location: 0, length: input.length) 207 | let results = expression.matchesInString(url, options: NSMatchingOptions(rawValue: 0), range: range) 208 | 209 | if let result = results.first { 210 | var extractedVariables = Dictionary() 211 | 212 | for (index, variable) in variables.enumerate() { 213 | let range = result.rangeAtIndex(index + 1) 214 | let value = input.substringWithRange(range).stringByRemovingPercentEncoding 215 | extractedVariables[variable] = value 216 | } 217 | 218 | return extractedVariables 219 | } 220 | } 221 | 222 | return nil 223 | } 224 | } 225 | 226 | /// Determine if two URITemplate's are equivalent 227 | public func ==(lhs:URITemplate, rhs:URITemplate) -> Bool { 228 | return lhs.template == rhs.template 229 | } 230 | 231 | // MARK: Extensions 232 | 233 | extension NSRegularExpression { 234 | func substitute(string:String, block:((String) -> (String))) -> String { 235 | let oldString = string as NSString 236 | let range = NSRange(location: 0, length: oldString.length) 237 | var newString = string as NSString 238 | 239 | let matches = matchesInString(string, options: NSMatchingOptions(rawValue: 0), range: range) 240 | for match in Array(matches.reverse()) { 241 | let expression = oldString.substringWithRange(match.range) 242 | let replacement = block(expression) 243 | newString = newString.stringByReplacingCharactersInRange(match.range, withString: replacement) 244 | } 245 | 246 | return newString as String 247 | } 248 | 249 | func matches(string:String) -> [String] { 250 | let input = string as NSString 251 | let range = NSRange(location: 0, length: input.length) 252 | let results = matchesInString(string, options: NSMatchingOptions(rawValue: 0), range: range) 253 | 254 | return results.map { result -> String in 255 | return input.substringWithRange(result.range) 256 | } 257 | } 258 | } 259 | 260 | extension String { 261 | func percentEncoded() -> String { 262 | return CFURLCreateStringByAddingPercentEscapes(nil, self, nil, ":/?&=;+!@#$()',*", CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)) as String 263 | } 264 | } 265 | 266 | // MARK: Operators 267 | 268 | protocol Operator { 269 | /// Operator 270 | var op:String? { get } 271 | 272 | /// Prefix for the expanded string 273 | var prefix:String { get } 274 | 275 | /// Character to use to join expanded components 276 | var joiner:String { get } 277 | 278 | func expand(variable:String, value:AnyObject?, explode:Bool, prefix:Int?) -> String? 279 | } 280 | 281 | class BaseOperator { 282 | var joiner:String { return "," } 283 | 284 | func expand(variable:String, value:AnyObject?, explode:Bool, prefix:Int?) -> String? { 285 | if let value:AnyObject = value { 286 | if let values = value as? [String:AnyObject] { 287 | return expand(variable:variable, value: values, explode: explode) 288 | } else if let values = value as? [AnyObject] { 289 | return expand(variable:variable, value: values, explode: explode) 290 | } else if let _ = value as? NSNull { 291 | return expand(variable:variable) 292 | } else { 293 | return expand(variable:variable, value:"\(value)", prefix:prefix) 294 | } 295 | } 296 | 297 | return expand(variable:variable) 298 | } 299 | 300 | // Point to overide to expand a value (i.e, perform encoding) 301 | func expand(value value:String) -> String { 302 | return value 303 | } 304 | 305 | // Point to overide to expanding a string 306 | func expand(variable variable:String, value:String, prefix:Int?) -> String { 307 | if let prefix = prefix { 308 | if value.characters.count > prefix { 309 | let index = value.startIndex.advancedBy(prefix, limit: value.endIndex) 310 | return expand(value: value.substringToIndex(index)) 311 | } 312 | } 313 | 314 | return expand(value: value) 315 | } 316 | 317 | // Point to overide to expanding an array 318 | func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 319 | let joiner = explode ? self.joiner : "," 320 | return value.map { self.expand(value: "\($0)") }.joinWithSeparator(joiner) 321 | } 322 | 323 | // Point to overide to expanding a dictionary 324 | func expand(variable variable:String, value:[String:AnyObject], explode:Bool) -> String? { 325 | let joiner = explode ? self.joiner : "," 326 | let keyValueJoiner = explode ? "=" : "," 327 | let elements = value.map({ (key, value) -> String in 328 | let expandedKey = self.expand(value: key) 329 | let expandedValue = self.expand(value: "\(value)") 330 | return "\(expandedKey)\(keyValueJoiner)\(expandedValue)" 331 | }) 332 | 333 | return elements.joinWithSeparator(joiner) 334 | } 335 | 336 | // Point to overide when value not found 337 | func expand(variable variable:String) -> String? { 338 | return nil 339 | } 340 | } 341 | 342 | /// RFC6570 (3.2.2) Simple String Expansion: {var} 343 | class StringExpansion : BaseOperator, Operator { 344 | var op:String? { return nil } 345 | var prefix:String { return "" } 346 | override var joiner:String { return "," } 347 | 348 | override func expand(value value:String) -> String { 349 | return value.percentEncoded() 350 | } 351 | } 352 | 353 | /// RFC6570 (3.2.3) Reserved Expansion: {+var} 354 | class ReservedExpansion : BaseOperator, Operator { 355 | var op:String? { return "+" } 356 | var prefix:String { return "" } 357 | override var joiner:String { return "," } 358 | 359 | override func expand(value value:String) -> String { 360 | return value.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! 361 | } 362 | } 363 | 364 | /// RFC6570 (3.2.4) Fragment Expansion {#var} 365 | class FragmentExpansion : BaseOperator, Operator { 366 | var op:String? { return "#" } 367 | var prefix:String { return "#" } 368 | override var joiner:String { return "," } 369 | 370 | override func expand(value value:String) -> String { 371 | return value.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLFragmentAllowedCharacterSet())! 372 | } 373 | } 374 | 375 | /// RFC6570 (3.2.5) Label Expansion with Dot-Prefix: {.var} 376 | class LabelExpansion : BaseOperator, Operator { 377 | var op:String? { return "." } 378 | var prefix:String { return "." } 379 | override var joiner:String { return "." } 380 | 381 | override func expand(value value:String) -> String { 382 | return value.percentEncoded() 383 | } 384 | 385 | override func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 386 | if value.count > 0 { 387 | return super.expand(variable: variable, value: value, explode: explode) 388 | } 389 | 390 | return nil 391 | } 392 | } 393 | 394 | /// RFC6570 (3.2.6) Path Segment Expansion: {/var} 395 | class PathSegmentExpansion : BaseOperator, Operator { 396 | var op:String? { return "/" } 397 | var prefix:String { return "/" } 398 | override var joiner:String { return "/" } 399 | 400 | override func expand(value value:String) -> String { 401 | return value.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPathAllowedCharacterSet())! 402 | } 403 | 404 | override func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 405 | if value.count > 0 { 406 | return super.expand(variable: variable, value: value, explode: explode) 407 | } 408 | 409 | return nil 410 | } 411 | } 412 | 413 | /// RFC6570 (3.2.7) Path-Style Parameter Expansion: {;var} 414 | class PathStyleParameterExpansion : BaseOperator, Operator { 415 | var op:String? { return ";" } 416 | var prefix:String { return ";" } 417 | override var joiner:String { return ";" } 418 | 419 | override func expand(value value:String) -> String { 420 | return value.percentEncoded() 421 | } 422 | 423 | override func expand(variable variable:String, value:String, prefix:Int?) -> String { 424 | if value.characters.count > 0 { 425 | let expandedValue = super.expand(variable: variable, value: value, prefix: prefix) 426 | return "\(variable)=\(expandedValue)" 427 | } 428 | 429 | return variable 430 | } 431 | 432 | override func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 433 | let joiner = explode ? self.joiner : "," 434 | let expandedValue = value.map { 435 | let expandedValue = self.expand(value: "\($0)") 436 | 437 | if explode { 438 | return "\(variable)=\(expandedValue)" 439 | } 440 | 441 | return expandedValue 442 | }.joinWithSeparator(joiner) 443 | 444 | if !explode { 445 | return "\(variable)=\(expandedValue)" 446 | } 447 | 448 | return expandedValue 449 | } 450 | 451 | override func expand(variable variable:String, value:[String:AnyObject], explode:Bool) -> String? { 452 | let expandedValue = super.expand(variable: variable, value: value, explode: explode) 453 | 454 | if let expandedValue = expandedValue { 455 | if (!explode) { 456 | return "\(variable)=\(expandedValue)" 457 | } 458 | } 459 | 460 | return expandedValue 461 | } 462 | } 463 | 464 | /// RFC6570 (3.2.8) Form-Style Query Expansion: {?var} 465 | class FormStyleQueryExpansion : BaseOperator, Operator { 466 | var op:String? { return "?" } 467 | var prefix:String { return "?" } 468 | override var joiner:String { return "&" } 469 | 470 | override func expand(value value:String) -> String { 471 | return value.percentEncoded() 472 | } 473 | 474 | override func expand(variable variable:String, value:String, prefix:Int?) -> String { 475 | let expandedValue = super.expand(variable: variable, value: value, prefix: prefix) 476 | return "\(variable)=\(expandedValue)" 477 | } 478 | 479 | override func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 480 | if value.count > 0 { 481 | let joiner = explode ? self.joiner : "," 482 | let expandedValue = value.map { 483 | let expandedValue = self.expand(value: "\($0)") 484 | 485 | if explode { 486 | return "\(variable)=\(expandedValue)" 487 | } 488 | 489 | return expandedValue 490 | }.joinWithSeparator(joiner) 491 | 492 | if !explode { 493 | return "\(variable)=\(expandedValue)" 494 | } 495 | 496 | return expandedValue 497 | } 498 | 499 | return nil 500 | } 501 | 502 | override func expand(variable variable:String, value:[String:AnyObject], explode:Bool) -> String? { 503 | if value.count > 0 { 504 | let expandedVariable = self.expand(value: variable) 505 | let expandedValue = super.expand(variable: variable, value: value, explode: explode) 506 | 507 | if let expandedValue = expandedValue { 508 | if (!explode) { 509 | return "\(expandedVariable)=\(expandedValue)" 510 | } 511 | } 512 | 513 | return expandedValue 514 | } 515 | 516 | return nil 517 | } 518 | } 519 | 520 | /// RFC6570 (3.2.9) Form-Style Query Continuation: {&var} 521 | class FormStyleQueryContinuation : BaseOperator, Operator { 522 | var op:String? { return "&" } 523 | var prefix:String { return "&" } 524 | override var joiner:String { return "&" } 525 | 526 | override func expand(value value:String) -> String { 527 | return value.percentEncoded() 528 | } 529 | 530 | override func expand(variable variable:String, value:String, prefix:Int?) -> String { 531 | let expandedValue = super.expand(variable: variable, value: value, prefix: prefix) 532 | return "\(variable)=\(expandedValue)" 533 | } 534 | 535 | override func expand(variable variable:String, value:[AnyObject], explode:Bool) -> String? { 536 | let joiner = explode ? self.joiner : "," 537 | let expandedValue = value.map { 538 | let expandedValue = self.expand(value: "\($0)") 539 | 540 | if explode { 541 | return "\(variable)=\(expandedValue)" 542 | } 543 | 544 | return expandedValue 545 | }.joinWithSeparator(joiner) 546 | 547 | if !explode { 548 | return "\(variable)=\(expandedValue)" 549 | } 550 | 551 | return expandedValue 552 | } 553 | 554 | override func expand(variable variable:String, value:[String:AnyObject], explode:Bool) -> String? { 555 | let expandedValue = super.expand(variable: variable, value: value, explode: explode) 556 | 557 | if let expandedValue = expandedValue { 558 | if (!explode) { 559 | return "\(variable)=\(expandedValue)" 560 | } 561 | } 562 | 563 | return expandedValue 564 | } 565 | } 566 | -------------------------------------------------------------------------------- /Pods/WebLinking/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kyle Fuller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Pods/WebLinking/README.md: -------------------------------------------------------------------------------- 1 | Web Linking 2 | =========== 3 | 4 | Swift implementation of Web Linking ([RFC5988](https://tools.ietf.org/html/rfc5988)). 5 | 6 | ## Installation 7 | 8 | [CocoaPods](http://cocoapods.org/) is the recommended installation method. 9 | 10 | ```ruby 11 | pod 'WebLinking' 12 | ``` 13 | 14 | ## Example 15 | 16 | Given the following `Link` header on an `NSHTTPURLResponse`. 17 | 18 | ``` 19 | Link: ; rel="next", 20 | ; rel="last" 21 | ``` 22 | 23 | We can find the next link on a response: 24 | 25 | ```swift 26 | if let link = response.findLink(relation: "next") { 27 | println("We have a next link with the URI: \(link.uri).") 28 | } 29 | ``` 30 | 31 | Or introspect all available links: 32 | 33 | ```swift 34 | for link in response.links { 35 | println("We have a link with the relation: \(link.relationType) to \(link.uri).") 36 | } 37 | ``` 38 | 39 | ## License 40 | 41 | Web Linking is licensed under the MIT license. See [LICENSE](LICENSE) for more 42 | info. 43 | 44 | -------------------------------------------------------------------------------- /Pods/WebLinking/WebLinking/WebLinking.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WebLinking.swift 3 | // WebLinking 4 | // 5 | // Created by Kyle Fuller on 20/01/2015. 6 | // Copyright (c) 2015 Cocode. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// A structure representing a RFC 5988 link. 12 | public struct Link: Equatable, Hashable { 13 | /// The URI for the link 14 | public let uri:String 15 | 16 | /// The parameters for the link 17 | public let parameters:[String:String] 18 | 19 | /// Initialize a Link with a given uri and parameters 20 | public init(uri:String, parameters:[String:String]? = nil) { 21 | self.uri = uri 22 | self.parameters = parameters ?? [:] 23 | } 24 | 25 | /// Returns the hash value 26 | public var hashValue:Int { 27 | return uri.hashValue 28 | } 29 | 30 | /// Relation type of the Link. 31 | public var relationType:String? { 32 | return parameters["rel"] 33 | } 34 | 35 | /// Reverse relation of the Link. 36 | public var reverseRelationType:String? { 37 | return parameters["rev"] 38 | } 39 | 40 | /// A hint of what the content type for the link may be. 41 | public var type:String? { 42 | return parameters["type"] 43 | } 44 | } 45 | 46 | /// Returns whether two Link's are equivalent 47 | public func ==(lhs:Link, rhs:Link) -> Bool { 48 | return lhs.uri == rhs.uri && lhs.parameters == rhs.parameters 49 | } 50 | 51 | // MARK: HTML Element Conversion 52 | 53 | /// An extension to Link to provide conversion to a HTML element 54 | extension Link { 55 | /// Encode the link into a HTML element 56 | public var html:String { 57 | let components = parameters.map { (key, value) in 58 | "\(key)=\"\(value)\"" 59 | } + ["href=\"\(uri)\""] 60 | let elements = components.joinWithSeparator(" ") 61 | return "" 62 | } 63 | } 64 | 65 | // MARK: Header link conversion 66 | 67 | /// An extension to Link to provide conversion to and from a HTTP "Link" header 68 | extension Link { 69 | /// Encode the link into a header 70 | public var header:String { 71 | let components = ["<\(uri)>"] + parameters.map { (key, value) in 72 | "\(key)=\"\(value)\"" 73 | } 74 | return components.joinWithSeparator("; ") 75 | } 76 | 77 | /*** Initialize a Link with a HTTP Link header 78 | - parameter header: A HTTP Link Header 79 | */ 80 | public init(header:String) { 81 | let (uri, parametersString) = takeFirst(separateBy(";")(input: header)) 82 | let parameters = Array(Array(parametersString.map(split("="))).map { parameter in 83 | [parameter.0: trim("\"", rhs: "\"")(input: parameter.1)] 84 | }) 85 | 86 | self.uri = trim("<", rhs: ">")(input: uri) 87 | self.parameters = parameters.reduce([:], combine: +) 88 | } 89 | } 90 | 91 | /*** Parses a Web Linking (RFC5988) header into an array of Links 92 | - parameter header: RFC5988 link header. For example `; rel=\"next\", ; rel=\"prev\"` 93 | :return: An array of Links 94 | */ 95 | public func parseLinkHeader(header:String) -> [Link] { 96 | return separateBy(",")(input: header).map { string in 97 | return Link(header: string) 98 | } 99 | } 100 | 101 | /// An extension to NSHTTPURLResponse adding a links property 102 | extension NSHTTPURLResponse { 103 | /// Parses the links on the response `Link` header 104 | public var links:[Link] { 105 | if let linkHeader = allHeaderFields["Link"] as? String { 106 | return parseLinkHeader(linkHeader).map { link in 107 | var uri = link.uri 108 | 109 | /// Handle relative URIs 110 | if let baseURL = self.URL, URL = NSURL(string: uri, relativeToURL: baseURL) { 111 | uri = URL.absoluteString 112 | } 113 | 114 | return Link(uri: uri, parameters: link.parameters) 115 | } 116 | } 117 | 118 | return [] 119 | } 120 | 121 | /// Finds a link which has matching parameters 122 | public func findLink(parameters:[String:String]) -> Link? { 123 | for link in links { 124 | if link.parameters ~= parameters { 125 | return link 126 | } 127 | } 128 | 129 | return nil 130 | } 131 | 132 | /// Find a link for the relation 133 | public func findLink(relation relation:String) -> Link? { 134 | return findLink(["rel": relation]) 135 | } 136 | } 137 | 138 | /// MARK: Private methods (used by link header conversion) 139 | 140 | // Merge two dictionaries together 141 | func +(lhs:Dictionary, rhs:Dictionary) -> Dictionary { 142 | var dictionary = [K:V]() 143 | 144 | for (key, value) in rhs { 145 | dictionary[key] = value 146 | } 147 | 148 | for (key, value) in lhs { 149 | dictionary[key] = value 150 | } 151 | 152 | return dictionary 153 | } 154 | 155 | /// LHS contains all the keys and values from RHS 156 | func ~=(lhs:[String:String], rhs:[String:String]) -> Bool { 157 | for (key, value) in rhs { 158 | if lhs[key] != value { 159 | return false 160 | } 161 | } 162 | 163 | return true 164 | } 165 | 166 | // Separate a trim a string by a separator 167 | func separateBy(separator:String)(input:String) -> [String] { 168 | return input.componentsSeparatedByString(separator).map { 169 | $0.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) 170 | } 171 | } 172 | 173 | // Split a string by a separator into two components 174 | func split(separator:String)(input:String) -> (String, String) { 175 | let range = input.rangeOfString(separator, options: NSStringCompareOptions(rawValue: 0), range: nil, locale: nil) 176 | 177 | if let range = range { 178 | let lhs = input.substringToIndex(range.startIndex) 179 | let rhs = input.substringFromIndex(range.endIndex) 180 | return (lhs, rhs) 181 | } 182 | 183 | return (input, "") 184 | } 185 | 186 | // Separate the first element in an array from the rest 187 | func takeFirst(input:[String]) -> (String, ArraySlice) { 188 | if let first = input.first { 189 | let items = input[input.startIndex.successor() ..< input.endIndex] 190 | return (first, items) 191 | } 192 | 193 | return ("", []) 194 | } 195 | 196 | // Trim a prefix and suffix from a string 197 | func trim(lhs:Character, rhs:Character)(input:String) -> String { 198 | if input.hasPrefix("\(lhs)") && input.hasSuffix("\(rhs)") { 199 | return input[input.startIndex.successor()..