motion-yapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/motion-yapper.rb +1 -0
- data/lib/yapper.rb +3 -5
- data/lib/yapper/config.rb +2 -0
- data/lib/yapper/db.rb +105 -40
- data/lib/yapper/document.rb +7 -4
- data/lib/yapper/document/callbacks.rb +0 -7
- data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
- data/lib/yapper/document/relation.rb +29 -22
- data/lib/yapper/document/selection.rb +122 -54
- data/lib/yapper/extensions.rb +12 -24
- data/lib/yapper/settings.rb +43 -0
- data/lib/yapper/timestamps.rb +2 -0
- data/lib/yapper/version.rb +1 -1
- data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
- data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
- data/spec/integration/db_spec.rb +70 -0
- data/spec/integration/defaults_spec.rb +37 -0
- data/spec/integration/extensions_spec.rb +14 -0
- data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
- data/spec/integration/relation_spec.rb +4 -4
- data/vendor/Podfile.lock +9 -11
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
- data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
- data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
- data/vendor/Pods/Headers/____Pods-environment.h +15 -15
- data/vendor/Pods/Manifest.lock +9 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
- data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
- data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
- data/vendor/Pods/Pods-environment.h +15 -15
- data/vendor/Pods/Pods.xcconfig +3 -3
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- data/vendor/Pods/YapDatabase/README.md +3 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
- data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
- metadata +80 -108
- data/Gemfile.lock +0 -63
- data/lib/yapper/attachment.rb +0 -48
- data/lib/yapper/document/attachment.rb +0 -26
- data/lib/yapper/sync.rb +0 -134
- data/lib/yapper/sync/data.rb +0 -12
- data/lib/yapper/sync/event.rb +0 -194
- data/lib/yapper/sync/queue.rb +0 -164
- data/spec/integration/all_spec.rb +0 -40
- data/spec/integration/sync_spec.rb +0 -42
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -208
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
- data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
- data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
- data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
- data/vendor/Pods/Reachability/LICENCE.txt +0 -24
- data/vendor/Pods/Reachability/README.md +0 -65
- data/vendor/Pods/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -1,133 +0,0 @@
|
|
1
|
-
// AFHTTPRequestOperation.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
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
|
13
|
-
// all 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
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
#import <Foundation/Foundation.h>
|
24
|
-
#import "AFURLConnectionOperation.h"
|
25
|
-
|
26
|
-
/**
|
27
|
-
`AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request.
|
28
|
-
*/
|
29
|
-
@interface AFHTTPRequestOperation : AFURLConnectionOperation
|
30
|
-
|
31
|
-
///----------------------------------------------
|
32
|
-
/// @name Getting HTTP URL Connection Information
|
33
|
-
///----------------------------------------------
|
34
|
-
|
35
|
-
/**
|
36
|
-
The last HTTP response received by the operation's connection.
|
37
|
-
*/
|
38
|
-
@property (readonly, nonatomic, strong) NSHTTPURLResponse *response;
|
39
|
-
|
40
|
-
///----------------------------------------------------------
|
41
|
-
/// @name Managing And Checking For Acceptable HTTP Responses
|
42
|
-
///----------------------------------------------------------
|
43
|
-
|
44
|
-
/**
|
45
|
-
A Boolean value that corresponds to whether the status code of the response is within the specified set of acceptable status codes. Returns `YES` if `acceptableStatusCodes` is `nil`.
|
46
|
-
*/
|
47
|
-
@property (nonatomic, readonly) BOOL hasAcceptableStatusCode;
|
48
|
-
|
49
|
-
/**
|
50
|
-
A Boolean value that corresponds to whether the MIME type of the response is among the specified set of acceptable content types. Returns `YES` if `acceptableContentTypes` is `nil`.
|
51
|
-
*/
|
52
|
-
@property (nonatomic, readonly) BOOL hasAcceptableContentType;
|
53
|
-
|
54
|
-
/**
|
55
|
-
The callback dispatch queue on success. If `NULL` (default), the main queue is used.
|
56
|
-
*/
|
57
|
-
@property (nonatomic, assign) dispatch_queue_t successCallbackQueue;
|
58
|
-
|
59
|
-
/**
|
60
|
-
The callback dispatch queue on failure. If `NULL` (default), the main queue is used.
|
61
|
-
*/
|
62
|
-
@property (nonatomic, assign) dispatch_queue_t failureCallbackQueue;
|
63
|
-
|
64
|
-
///------------------------------------------------------------
|
65
|
-
/// @name Managing Acceptable HTTP Status Codes & Content Types
|
66
|
-
///------------------------------------------------------------
|
67
|
-
|
68
|
-
/**
|
69
|
-
Returns an `NSIndexSet` object containing the ranges of acceptable HTTP status codes. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
70
|
-
|
71
|
-
By default, this is the range 200 to 299, inclusive.
|
72
|
-
*/
|
73
|
-
+ (NSIndexSet *)acceptableStatusCodes;
|
74
|
-
|
75
|
-
/**
|
76
|
-
Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendants.
|
77
|
-
|
78
|
-
@param statusCodes The status codes to be added to the set of acceptable HTTP status codes
|
79
|
-
*/
|
80
|
-
+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes;
|
81
|
-
|
82
|
-
/**
|
83
|
-
Returns an `NSSet` object containing the acceptable MIME types. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
|
84
|
-
|
85
|
-
By default, this is `nil`.
|
86
|
-
*/
|
87
|
-
+ (NSSet *)acceptableContentTypes;
|
88
|
-
|
89
|
-
/**
|
90
|
-
Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendants.
|
91
|
-
|
92
|
-
@param contentTypes The content types to be added to the set of acceptable MIME types
|
93
|
-
*/
|
94
|
-
+ (void)addAcceptableContentTypes:(NSSet *)contentTypes;
|
95
|
-
|
96
|
-
|
97
|
-
///-----------------------------------------------------
|
98
|
-
/// @name Determining Whether A Request Can Be Processed
|
99
|
-
///-----------------------------------------------------
|
100
|
-
|
101
|
-
/**
|
102
|
-
A Boolean value determining whether or not the class can process the specified request. For example, `AFJSONRequestOperation` may check to make sure the content type was `application/json` or the URL path extension was `.json`.
|
103
|
-
|
104
|
-
@param urlRequest The request that is determined to be supported or not supported for this class.
|
105
|
-
*/
|
106
|
-
+ (BOOL)canProcessRequest:(NSURLRequest *)urlRequest;
|
107
|
-
|
108
|
-
///-----------------------------------------------------------
|
109
|
-
/// @name Setting Completion Block Success / Failure Callbacks
|
110
|
-
///-----------------------------------------------------------
|
111
|
-
|
112
|
-
/**
|
113
|
-
Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed.
|
114
|
-
|
115
|
-
This method should be overridden in subclasses in order to specify the response object passed into the success block.
|
116
|
-
|
117
|
-
@param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request.
|
118
|
-
@param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request.
|
119
|
-
*/
|
120
|
-
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
121
|
-
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
|
122
|
-
|
123
|
-
@end
|
124
|
-
|
125
|
-
///----------------
|
126
|
-
/// @name Functions
|
127
|
-
///----------------
|
128
|
-
|
129
|
-
/**
|
130
|
-
Returns a set of MIME types detected in an HTTP `Accept` or `Content-Type` header.
|
131
|
-
*/
|
132
|
-
extern NSSet * AFContentTypesFromHTTPHeader(NSString *string);
|
133
|
-
|
@@ -1,327 +0,0 @@
|
|
1
|
-
// AFHTTPRequestOperation.m
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
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
|
13
|
-
// all 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
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
#import "AFHTTPRequestOperation.h"
|
24
|
-
#import <objc/runtime.h>
|
25
|
-
|
26
|
-
// Workaround for change in imp_implementationWithBlock() with Xcode 4.5
|
27
|
-
#if defined(__IPHONE_6_0) || defined(__MAC_10_8)
|
28
|
-
#define AF_CAST_TO_BLOCK id
|
29
|
-
#else
|
30
|
-
#define AF_CAST_TO_BLOCK __bridge void *
|
31
|
-
#endif
|
32
|
-
|
33
|
-
#pragma clang diagnostic push
|
34
|
-
#pragma clang diagnostic ignored "-Wstrict-selector-match"
|
35
|
-
|
36
|
-
NSSet * AFContentTypesFromHTTPHeader(NSString *string) {
|
37
|
-
if (!string) {
|
38
|
-
return nil;
|
39
|
-
}
|
40
|
-
|
41
|
-
NSArray *mediaRanges = [string componentsSeparatedByString:@","];
|
42
|
-
NSMutableSet *mutableContentTypes = [NSMutableSet setWithCapacity:mediaRanges.count];
|
43
|
-
|
44
|
-
[mediaRanges enumerateObjectsUsingBlock:^(NSString *mediaRange, __unused NSUInteger idx, __unused BOOL *stop) {
|
45
|
-
NSRange parametersRange = [mediaRange rangeOfString:@";"];
|
46
|
-
if (parametersRange.location != NSNotFound) {
|
47
|
-
mediaRange = [mediaRange substringToIndex:parametersRange.location];
|
48
|
-
}
|
49
|
-
|
50
|
-
mediaRange = [mediaRange stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
51
|
-
|
52
|
-
if (mediaRange.length > 0) {
|
53
|
-
[mutableContentTypes addObject:mediaRange];
|
54
|
-
}
|
55
|
-
}];
|
56
|
-
|
57
|
-
return [NSSet setWithSet:mutableContentTypes];
|
58
|
-
}
|
59
|
-
|
60
|
-
static void AFGetMediaTypeAndSubtypeWithString(NSString *string, NSString **type, NSString **subtype) {
|
61
|
-
if (!string) {
|
62
|
-
return;
|
63
|
-
}
|
64
|
-
|
65
|
-
NSScanner *scanner = [NSScanner scannerWithString:string];
|
66
|
-
[scanner setCharactersToBeSkipped:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
67
|
-
[scanner scanUpToString:@"/" intoString:type];
|
68
|
-
[scanner scanString:@"/" intoString:nil];
|
69
|
-
[scanner scanUpToString:@";" intoString:subtype];
|
70
|
-
}
|
71
|
-
|
72
|
-
static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
73
|
-
NSMutableString *string = [NSMutableString string];
|
74
|
-
|
75
|
-
NSRange range = NSMakeRange([indexSet firstIndex], 1);
|
76
|
-
while (range.location != NSNotFound) {
|
77
|
-
NSUInteger nextIndex = [indexSet indexGreaterThanIndex:range.location];
|
78
|
-
while (nextIndex == range.location + range.length) {
|
79
|
-
range.length++;
|
80
|
-
nextIndex = [indexSet indexGreaterThanIndex:nextIndex];
|
81
|
-
}
|
82
|
-
|
83
|
-
if (string.length) {
|
84
|
-
[string appendString:@","];
|
85
|
-
}
|
86
|
-
|
87
|
-
if (range.length == 1) {
|
88
|
-
[string appendFormat:@"%lu", (long)range.location];
|
89
|
-
} else {
|
90
|
-
NSUInteger firstIndex = range.location;
|
91
|
-
NSUInteger lastIndex = firstIndex + range.length - 1;
|
92
|
-
[string appendFormat:@"%lu-%lu", (long)firstIndex, (long)lastIndex];
|
93
|
-
}
|
94
|
-
|
95
|
-
range.location = nextIndex;
|
96
|
-
range.length = 1;
|
97
|
-
}
|
98
|
-
|
99
|
-
return string;
|
100
|
-
}
|
101
|
-
|
102
|
-
static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, id block) {
|
103
|
-
Method originalMethod = class_getClassMethod(klass, selector);
|
104
|
-
IMP implementation = imp_implementationWithBlock((AF_CAST_TO_BLOCK)block);
|
105
|
-
class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod));
|
106
|
-
}
|
107
|
-
|
108
|
-
#pragma mark -
|
109
|
-
|
110
|
-
@interface AFHTTPRequestOperation ()
|
111
|
-
@property (readwrite, nonatomic, strong) NSURLRequest *request;
|
112
|
-
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
|
113
|
-
@property (readwrite, nonatomic, strong) NSError *HTTPError;
|
114
|
-
@property (readwrite, nonatomic, strong) NSRecursiveLock *lock;
|
115
|
-
@end
|
116
|
-
|
117
|
-
@implementation AFHTTPRequestOperation
|
118
|
-
@synthesize HTTPError = _HTTPError;
|
119
|
-
@synthesize successCallbackQueue = _successCallbackQueue;
|
120
|
-
@synthesize failureCallbackQueue = _failureCallbackQueue;
|
121
|
-
@dynamic lock;
|
122
|
-
@dynamic request;
|
123
|
-
@dynamic response;
|
124
|
-
|
125
|
-
- (void)dealloc {
|
126
|
-
if (_successCallbackQueue) {
|
127
|
-
#if !OS_OBJECT_USE_OBJC
|
128
|
-
dispatch_release(_successCallbackQueue);
|
129
|
-
#endif
|
130
|
-
_successCallbackQueue = NULL;
|
131
|
-
}
|
132
|
-
|
133
|
-
if (_failureCallbackQueue) {
|
134
|
-
#if !OS_OBJECT_USE_OBJC
|
135
|
-
dispatch_release(_failureCallbackQueue);
|
136
|
-
#endif
|
137
|
-
_failureCallbackQueue = NULL;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
- (NSError *)error {
|
142
|
-
[self.lock lock];
|
143
|
-
if (!self.HTTPError && self.response) {
|
144
|
-
if (![self hasAcceptableStatusCode] || ![self hasAcceptableContentType]) {
|
145
|
-
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
146
|
-
[userInfo setValue:self.responseString forKey:NSLocalizedRecoverySuggestionErrorKey];
|
147
|
-
[userInfo setValue:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
148
|
-
[userInfo setValue:self.request forKey:AFNetworkingOperationFailingURLRequestErrorKey];
|
149
|
-
[userInfo setValue:self.response forKey:AFNetworkingOperationFailingURLResponseErrorKey];
|
150
|
-
|
151
|
-
if (![self hasAcceptableStatusCode]) {
|
152
|
-
NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200;
|
153
|
-
[userInfo setValue:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Expected status code in (%@), got %d", @"AFNetworking", nil), AFStringFromIndexSet([[self class] acceptableStatusCodes]), statusCode] forKey:NSLocalizedDescriptionKey];
|
154
|
-
self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo];
|
155
|
-
} else if (![self hasAcceptableContentType]) {
|
156
|
-
// Don't invalidate content type if there is no content
|
157
|
-
if ([self.responseData length] > 0) {
|
158
|
-
[userInfo setValue:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Expected content type %@, got %@", @"AFNetworking", nil), [[self class] acceptableContentTypes], [self.response MIMEType]] forKey:NSLocalizedDescriptionKey];
|
159
|
-
self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo];
|
160
|
-
}
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
[self.lock unlock];
|
165
|
-
|
166
|
-
if (self.HTTPError) {
|
167
|
-
return self.HTTPError;
|
168
|
-
} else {
|
169
|
-
return [super error];
|
170
|
-
}
|
171
|
-
}
|
172
|
-
|
173
|
-
- (NSStringEncoding)responseStringEncoding {
|
174
|
-
// When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value.
|
175
|
-
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.4.1
|
176
|
-
if (self.response && !self.response.textEncodingName && self.responseData && [self.response respondsToSelector:@selector(allHeaderFields)]) {
|
177
|
-
NSString *type = nil;
|
178
|
-
AFGetMediaTypeAndSubtypeWithString([[self.response allHeaderFields] valueForKey:@"Content-Type"], &type, nil);
|
179
|
-
|
180
|
-
if ([type isEqualToString:@"text"]) {
|
181
|
-
return NSISOLatin1StringEncoding;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
return [super responseStringEncoding];
|
186
|
-
}
|
187
|
-
|
188
|
-
- (void)pause {
|
189
|
-
unsigned long long offset = 0;
|
190
|
-
if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) {
|
191
|
-
offset = [[self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey] unsignedLongLongValue];
|
192
|
-
} else {
|
193
|
-
offset = [[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length];
|
194
|
-
}
|
195
|
-
|
196
|
-
NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy];
|
197
|
-
if ([self.response respondsToSelector:@selector(allHeaderFields)] && [[self.response allHeaderFields] valueForKey:@"ETag"]) {
|
198
|
-
[mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"];
|
199
|
-
}
|
200
|
-
[mutableURLRequest setValue:[NSString stringWithFormat:@"bytes=%llu-", offset] forHTTPHeaderField:@"Range"];
|
201
|
-
self.request = mutableURLRequest;
|
202
|
-
|
203
|
-
[super pause];
|
204
|
-
}
|
205
|
-
|
206
|
-
- (BOOL)hasAcceptableStatusCode {
|
207
|
-
if (!self.response) {
|
208
|
-
return NO;
|
209
|
-
}
|
210
|
-
|
211
|
-
NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200;
|
212
|
-
return ![[self class] acceptableStatusCodes] || [[[self class] acceptableStatusCodes] containsIndex:statusCode];
|
213
|
-
}
|
214
|
-
|
215
|
-
- (BOOL)hasAcceptableContentType {
|
216
|
-
if (!self.response) {
|
217
|
-
return NO;
|
218
|
-
}
|
219
|
-
|
220
|
-
// Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".
|
221
|
-
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html
|
222
|
-
NSString *contentType = [self.response MIMEType];
|
223
|
-
if (!contentType) {
|
224
|
-
contentType = @"application/octet-stream";
|
225
|
-
}
|
226
|
-
|
227
|
-
return ![[self class] acceptableContentTypes] || [[[self class] acceptableContentTypes] containsObject:contentType];
|
228
|
-
}
|
229
|
-
|
230
|
-
- (void)setSuccessCallbackQueue:(dispatch_queue_t)successCallbackQueue {
|
231
|
-
if (successCallbackQueue != _successCallbackQueue) {
|
232
|
-
if (_successCallbackQueue) {
|
233
|
-
#if !OS_OBJECT_USE_OBJC
|
234
|
-
dispatch_release(_successCallbackQueue);
|
235
|
-
#endif
|
236
|
-
_successCallbackQueue = NULL;
|
237
|
-
}
|
238
|
-
|
239
|
-
if (successCallbackQueue) {
|
240
|
-
#if !OS_OBJECT_USE_OBJC
|
241
|
-
dispatch_retain(successCallbackQueue);
|
242
|
-
#endif
|
243
|
-
_successCallbackQueue = successCallbackQueue;
|
244
|
-
}
|
245
|
-
}
|
246
|
-
}
|
247
|
-
|
248
|
-
- (void)setFailureCallbackQueue:(dispatch_queue_t)failureCallbackQueue {
|
249
|
-
if (failureCallbackQueue != _failureCallbackQueue) {
|
250
|
-
if (_failureCallbackQueue) {
|
251
|
-
#if !OS_OBJECT_USE_OBJC
|
252
|
-
dispatch_release(_failureCallbackQueue);
|
253
|
-
#endif
|
254
|
-
_failureCallbackQueue = NULL;
|
255
|
-
}
|
256
|
-
|
257
|
-
if (failureCallbackQueue) {
|
258
|
-
#if !OS_OBJECT_USE_OBJC
|
259
|
-
dispatch_retain(failureCallbackQueue);
|
260
|
-
#endif
|
261
|
-
_failureCallbackQueue = failureCallbackQueue;
|
262
|
-
}
|
263
|
-
}
|
264
|
-
}
|
265
|
-
|
266
|
-
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
267
|
-
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
|
268
|
-
{
|
269
|
-
// completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle.
|
270
|
-
#pragma clang diagnostic push
|
271
|
-
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
272
|
-
#pragma clang diagnostic ignored "-Wgnu"
|
273
|
-
self.completionBlock = ^{
|
274
|
-
if (self.error) {
|
275
|
-
if (failure) {
|
276
|
-
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
277
|
-
failure(self, self.error);
|
278
|
-
});
|
279
|
-
}
|
280
|
-
} else {
|
281
|
-
if (success) {
|
282
|
-
dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{
|
283
|
-
success(self, self.responseData);
|
284
|
-
});
|
285
|
-
}
|
286
|
-
}
|
287
|
-
};
|
288
|
-
#pragma clang diagnostic pop
|
289
|
-
}
|
290
|
-
|
291
|
-
#pragma mark - AFHTTPRequestOperation
|
292
|
-
|
293
|
-
+ (NSIndexSet *)acceptableStatusCodes {
|
294
|
-
return [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
|
295
|
-
}
|
296
|
-
|
297
|
-
+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes {
|
298
|
-
NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]];
|
299
|
-
[mutableStatusCodes addIndexes:statusCodes];
|
300
|
-
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), ^(__unused id _self) {
|
301
|
-
return mutableStatusCodes;
|
302
|
-
});
|
303
|
-
}
|
304
|
-
|
305
|
-
+ (NSSet *)acceptableContentTypes {
|
306
|
-
return nil;
|
307
|
-
}
|
308
|
-
|
309
|
-
+ (void)addAcceptableContentTypes:(NSSet *)contentTypes {
|
310
|
-
NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES];
|
311
|
-
[mutableContentTypes unionSet:contentTypes];
|
312
|
-
AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), ^(__unused id _self) {
|
313
|
-
return mutableContentTypes;
|
314
|
-
});
|
315
|
-
}
|
316
|
-
|
317
|
-
+ (BOOL)canProcessRequest:(NSURLRequest *)request {
|
318
|
-
if ([[self class] isEqual:[AFHTTPRequestOperation class]]) {
|
319
|
-
return YES;
|
320
|
-
}
|
321
|
-
|
322
|
-
return [[self acceptableContentTypes] intersectsSet:AFContentTypesFromHTTPHeader([request valueForHTTPHeaderField:@"Accept"])];
|
323
|
-
}
|
324
|
-
|
325
|
-
@end
|
326
|
-
|
327
|
-
#pragma clang diagnostic pop
|