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.
Files changed (296) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.travis.yml +2 -0
  4. data/Gemfile +1 -0
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/lib/motion-yapper.rb +1 -0
  8. data/lib/yapper.rb +3 -5
  9. data/lib/yapper/config.rb +2 -0
  10. data/lib/yapper/db.rb +105 -40
  11. data/lib/yapper/document.rb +7 -4
  12. data/lib/yapper/document/callbacks.rb +0 -7
  13. data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
  14. data/lib/yapper/document/relation.rb +29 -22
  15. data/lib/yapper/document/selection.rb +122 -54
  16. data/lib/yapper/extensions.rb +12 -24
  17. data/lib/yapper/settings.rb +43 -0
  18. data/lib/yapper/timestamps.rb +2 -0
  19. data/lib/yapper/version.rb +1 -1
  20. data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
  21. data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
  22. data/spec/integration/db_spec.rb +70 -0
  23. data/spec/integration/defaults_spec.rb +37 -0
  24. data/spec/integration/extensions_spec.rb +14 -0
  25. data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
  26. data/spec/integration/relation_spec.rb +4 -4
  27. data/vendor/Podfile.lock +9 -11
  28. data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
  29. data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
  30. data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
  31. data/vendor/Pods/.build/libPods.a +0 -0
  32. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
  33. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  34. data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
  35. data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  36. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
  37. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
  38. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
  39. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
  40. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
  41. data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
  42. data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
  43. data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
  44. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
  45. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
  46. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
  47. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
  48. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
  49. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
  50. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  51. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  52. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
  53. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
  54. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
  55. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  56. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  57. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
  58. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  59. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  60. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
  61. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  62. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  63. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
  64. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  65. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
  66. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
  67. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
  68. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
  69. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
  70. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
  71. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
  72. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  73. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
  74. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
  75. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
  76. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
  77. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
  78. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
  79. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
  80. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
  81. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
  82. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
  83. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
  84. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
  85. data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
  86. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
  87. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  88. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
  89. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
  90. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
  91. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
  92. data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
  93. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
  94. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  95. data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
  96. data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  97. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
  98. data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
  99. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
  100. data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
  101. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
  102. data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
  103. data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
  104. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
  105. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
  106. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  107. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  108. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
  109. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  110. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  111. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  112. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  113. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  114. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  115. data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
  116. data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
  117. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
  118. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
  119. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
  120. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
  121. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  122. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
  123. data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
  124. data/vendor/Pods/Headers/____Pods-environment.h +15 -15
  125. data/vendor/Pods/Manifest.lock +9 -11
  126. data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
  127. data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
  128. data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
  129. data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
  130. data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
  131. data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
  132. data/vendor/Pods/Pods-environment.h +15 -15
  133. data/vendor/Pods/Pods.xcconfig +3 -3
  134. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
  135. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
  136. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
  137. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
  138. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
  139. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
  140. data/vendor/Pods/YapDatabase/README.md +3 -1
  141. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
  142. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
  143. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
  144. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
  145. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
  146. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
  147. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
  148. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
  149. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
  150. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
  151. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
  152. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
  153. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
  154. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
  155. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
  156. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
  157. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
  158. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
  159. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
  160. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
  161. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
  162. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
  163. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
  164. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
  165. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
  166. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
  167. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
  168. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  169. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
  170. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
  171. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
  172. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
  173. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
  174. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
  175. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
  176. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
  177. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
  178. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
  179. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
  180. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
  181. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
  182. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
  183. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
  184. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
  185. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
  186. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
  187. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
  188. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
  189. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
  190. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
  191. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
  192. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
  193. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
  194. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
  195. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
  196. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
  197. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
  198. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
  199. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
  200. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
  201. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
  202. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
  203. data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
  204. data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
  205. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
  206. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
  207. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
  208. metadata +80 -108
  209. data/Gemfile.lock +0 -63
  210. data/lib/yapper/attachment.rb +0 -48
  211. data/lib/yapper/document/attachment.rb +0 -26
  212. data/lib/yapper/sync.rb +0 -134
  213. data/lib/yapper/sync/data.rb +0 -12
  214. data/lib/yapper/sync/event.rb +0 -194
  215. data/lib/yapper/sync/queue.rb +0 -164
  216. data/spec/integration/all_spec.rb +0 -40
  217. data/spec/integration/sync_spec.rb +0 -42
  218. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
  219. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
  220. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
  221. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
  222. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
  223. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
  224. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
  225. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
  226. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  227. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
  228. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
  229. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  230. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
  231. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
  232. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
  233. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
  234. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
  235. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
  236. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
  237. data/vendor/Pods/AFNetworking/LICENSE +0 -19
  238. data/vendor/Pods/AFNetworking/README.md +0 -208
  239. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
  240. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
  241. data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
  242. data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
  243. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  244. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
  245. data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  246. data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
  247. data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
  248. data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
  249. data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
  250. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
  251. data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
  252. data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
  253. data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
  254. data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
  255. data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  256. data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
  257. data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  258. data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
  259. data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
  260. data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
  261. data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
  262. data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
  263. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
  264. data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
  265. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
  266. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
  267. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
  268. data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
  269. data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
  270. data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
  271. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
  272. data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
  273. data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
  274. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
  275. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
  276. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
  277. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
  278. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
  279. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
  280. data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
  281. data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
  282. data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
  283. data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
  284. data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
  285. data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
  286. data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
  287. data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
  288. data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
  289. data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
  290. data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
  291. data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
  292. data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
  293. data/vendor/Pods/Reachability/LICENCE.txt +0 -24
  294. data/vendor/Pods/Reachability/README.md +0 -65
  295. data/vendor/Pods/Reachability/Reachability.h +0 -109
  296. data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -1,78 +0,0 @@
1
- // UIImageView+AFNetworking.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 "AFImageRequestOperation.h"
25
-
26
- #import <Availability.h>
27
-
28
- #if __IPHONE_OS_VERSION_MIN_REQUIRED
29
- #import <UIKit/UIKit.h>
30
-
31
- /**
32
- This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.
33
- */
34
- @interface UIImageView (AFNetworking)
35
-
36
- /**
37
- Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL, and sets it the request is finished. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
38
-
39
- By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
40
-
41
- @param url The URL used for the image request.
42
- */
43
- - (void)setImageWithURL:(NSURL *)url;
44
-
45
- /**
46
- Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
47
-
48
- By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
49
-
50
- @param url The URL used for the image request.
51
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
52
- */
53
- - (void)setImageWithURL:(NSURL *)url
54
- placeholderImage:(UIImage *)placeholderImage;
55
-
56
- /**
57
- Creates and enqueues an image request operation, which asynchronously downloads the image with the specified URL request object. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
58
-
59
- If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is executed.
60
-
61
- @param urlRequest The URL request used for the image request.
62
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
63
- @param success A block to be executed when the image request operation finishes successfully, with a status code in the 2xx range, and with an acceptable content type (e.g. `image/png`). This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the request and response parameters will be `nil`.
64
- @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
65
- */
66
- - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
67
- placeholderImage:(UIImage *)placeholderImage
68
- success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
69
- failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
70
-
71
- /**
72
- Cancels any executing image request operation for the receiver, if one exists.
73
- */
74
- - (void)cancelImageRequestOperation;
75
-
76
- @end
77
-
78
- #endif
@@ -1,109 +0,0 @@
1
- /*
2
- Copyright (c) 2011, Tony Million.
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
- POSSIBILITY OF SUCH DAMAGE.
26
- */
27
-
28
- #import <Foundation/Foundation.h>
29
- #import <SystemConfiguration/SystemConfiguration.h>
30
-
31
- #import <sys/socket.h>
32
- #import <netinet/in.h>
33
- #import <netinet6/in6.h>
34
- #import <arpa/inet.h>
35
- #import <ifaddrs.h>
36
- #import <netdb.h>
37
-
38
- /**
39
- * Does ARC support GCD objects?
40
- * It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
41
- *
42
- * @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
43
- **/
44
- #if OS_OBJECT_USE_OBJC
45
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
46
- #else
47
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
48
- #endif
49
-
50
- /**
51
- * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
52
- *
53
- * @see http://nshipster.com/ns_enum-ns_options/
54
- **/
55
- #ifndef NS_ENUM
56
- #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
57
- #endif
58
-
59
- extern NSString *const kReachabilityChangedNotification;
60
-
61
- typedef NS_ENUM(NSInteger, NetworkStatus) {
62
- // Apple NetworkStatus Compatible Names.
63
- NotReachable = 0,
64
- ReachableViaWiFi = 2,
65
- ReachableViaWWAN = 1
66
- };
67
-
68
- @class Reachability;
69
-
70
- typedef void (^NetworkReachable)(Reachability * reachability);
71
- typedef void (^NetworkUnreachable)(Reachability * reachability);
72
-
73
- @interface Reachability : NSObject
74
-
75
- @property (nonatomic, copy) NetworkReachable reachableBlock;
76
- @property (nonatomic, copy) NetworkUnreachable unreachableBlock;
77
-
78
-
79
- @property (nonatomic, assign) BOOL reachableOnWWAN;
80
-
81
- +(Reachability*)reachabilityWithHostname:(NSString*)hostname;
82
- +(Reachability*)reachabilityForInternetConnection;
83
- +(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
84
- +(Reachability*)reachabilityForLocalWiFi;
85
-
86
- -(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
87
-
88
- -(BOOL)startNotifier;
89
- -(void)stopNotifier;
90
-
91
- -(BOOL)isReachable;
92
- -(BOOL)isReachableViaWWAN;
93
- -(BOOL)isReachableViaWiFi;
94
-
95
- // WWAN may be available, but not active until a connection has been established.
96
- // WiFi may require a connection for VPN on Demand.
97
- -(BOOL)isConnectionRequired; // Identical DDG variant.
98
- -(BOOL)connectionRequired; // Apple's routine.
99
- // Dynamic, on demand connection?
100
- -(BOOL)isConnectionOnDemand;
101
- // Is user intervention required?
102
- -(BOOL)isInterventionRequired;
103
-
104
- -(NetworkStatus)currentReachabilityStatus;
105
- -(SCNetworkReachabilityFlags)reachabilityFlags;
106
- -(NSString*)currentReachabilityString;
107
- -(NSString*)currentReachabilityFlags;
108
-
109
- @end
@@ -1,251 +0,0 @@
1
- #import "DispatchQueueLogFormatter.h"
2
- #import <libkern/OSAtomic.h>
3
-
4
- /**
5
- * Welcome to Cocoa Lumberjack!
6
- *
7
- * The project page has a wealth of documentation if you have any questions.
8
- * https://github.com/robbiehanson/CocoaLumberjack
9
- *
10
- * If you're new to the project you may wish to read the "Getting Started" wiki.
11
- * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
12
- **/
13
-
14
- #if ! __has_feature(objc_arc)
15
- #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
16
- #endif
17
-
18
-
19
- @implementation DispatchQueueLogFormatter
20
- {
21
- int32_t atomicLoggerCount;
22
- NSDateFormatter *threadUnsafeDateFormatter; // Use [self stringFromDate]
23
-
24
- OSSpinLock lock;
25
-
26
- NSUInteger _minQueueLength; // _prefix == Only access via atomic property
27
- NSUInteger _maxQueueLength; // _prefix == Only access via atomic property
28
- NSMutableDictionary *_replacements; // _prefix == Only access from within spinlock
29
- }
30
-
31
- - (id)init
32
- {
33
- if ((self = [super init]))
34
- {
35
- dateFormatString = @"yyyy-MM-dd HH:mm:ss:SSS";
36
-
37
- atomicLoggerCount = 0;
38
- threadUnsafeDateFormatter = nil;
39
-
40
- _minQueueLength = 0;
41
- _maxQueueLength = 0;
42
- _replacements = [[NSMutableDictionary alloc] init];
43
-
44
- // Set default replacements:
45
-
46
- [_replacements setObject:@"main" forKey:@"com.apple.main-thread"];
47
- }
48
- return self;
49
- }
50
-
51
-
52
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53
- #pragma mark Configuration
54
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55
-
56
- @synthesize minQueueLength = _minQueueLength;
57
- @synthesize maxQueueLength = _maxQueueLength;
58
-
59
- - (NSString *)replacementStringForQueueLabel:(NSString *)longLabel
60
- {
61
- NSString *result = nil;
62
-
63
- OSSpinLockLock(&lock);
64
- {
65
- result = [_replacements objectForKey:longLabel];
66
- }
67
- OSSpinLockUnlock(&lock);
68
-
69
- return result;
70
- }
71
-
72
- - (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel
73
- {
74
- OSSpinLockLock(&lock);
75
- {
76
- if (shortLabel)
77
- [_replacements setObject:shortLabel forKey:longLabel];
78
- else
79
- [_replacements removeObjectForKey:longLabel];
80
- }
81
- OSSpinLockUnlock(&lock);
82
- }
83
-
84
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
85
- #pragma mark DDLogFormatter
86
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
87
-
88
- - (NSString *)stringFromDate:(NSDate *)date
89
- {
90
- int32_t loggerCount = OSAtomicAdd32(0, &atomicLoggerCount);
91
-
92
- if (loggerCount <= 1)
93
- {
94
- // Single-threaded mode.
95
-
96
- if (threadUnsafeDateFormatter == nil)
97
- {
98
- threadUnsafeDateFormatter = [[NSDateFormatter alloc] init];
99
- [threadUnsafeDateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
100
- [threadUnsafeDateFormatter setDateFormat:dateFormatString];
101
- }
102
-
103
- return [threadUnsafeDateFormatter stringFromDate:date];
104
- }
105
- else
106
- {
107
- // Multi-threaded mode.
108
- // NSDateFormatter is NOT thread-safe.
109
-
110
- NSString *key = @"DispatchQueueLogFormatter_NSDateFormatter";
111
-
112
- NSMutableDictionary *threadDictionary = [[NSThread currentThread] threadDictionary];
113
- NSDateFormatter *dateFormatter = [threadDictionary objectForKey:key];
114
-
115
- if (dateFormatter == nil)
116
- {
117
- dateFormatter = [[NSDateFormatter alloc] init];
118
- [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
119
- [dateFormatter setDateFormat:dateFormatString];
120
-
121
- [threadDictionary setObject:dateFormatter forKey:key];
122
- }
123
-
124
- return [dateFormatter stringFromDate:date];
125
- }
126
- }
127
-
128
- - (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage
129
- {
130
- // As per the DDLogFormatter contract, this method is always invoked on the same thread/dispatch_queue
131
-
132
- NSUInteger minQueueLength = self.minQueueLength;
133
- NSUInteger maxQueueLength = self.maxQueueLength;
134
-
135
- // Get the name of the queue, thread, or machID (whichever we are to use).
136
-
137
- NSString *queueThreadLabel = nil;
138
-
139
- BOOL useQueueLabel = YES;
140
- BOOL useThreadName = NO;
141
-
142
- if (logMessage->queueLabel)
143
- {
144
- // If you manually create a thread, it's dispatch_queue will have one of the thread names below.
145
- // Since all such threads have the same name, we'd prefer to use the threadName or the machThreadID.
146
-
147
- char *names[] = { "com.apple.root.low-priority",
148
- "com.apple.root.default-priority",
149
- "com.apple.root.high-priority",
150
- "com.apple.root.low-overcommit-priority",
151
- "com.apple.root.default-overcommit-priority",
152
- "com.apple.root.high-overcommit-priority" };
153
-
154
- int length = sizeof(names) / sizeof(char *);
155
-
156
- int i;
157
- for (i = 0; i < length; i++)
158
- {
159
- if (strcmp(logMessage->queueLabel, names[i]) == 0)
160
- {
161
- useQueueLabel = NO;
162
- useThreadName = [logMessage->threadName length] > 0;
163
- break;
164
- }
165
- }
166
- }
167
- else
168
- {
169
- useQueueLabel = NO;
170
- useThreadName = [logMessage->threadName length] > 0;
171
- }
172
-
173
- if (useQueueLabel || useThreadName)
174
- {
175
- NSString *fullLabel;
176
- NSString *abrvLabel;
177
-
178
- if (useQueueLabel)
179
- fullLabel = @(logMessage->queueLabel);
180
- else
181
- fullLabel = logMessage->threadName;
182
-
183
- OSSpinLockLock(&lock);
184
- {
185
- abrvLabel = [_replacements objectForKey:fullLabel];
186
- }
187
- OSSpinLockUnlock(&lock);
188
-
189
- if (abrvLabel)
190
- queueThreadLabel = abrvLabel;
191
- else
192
- queueThreadLabel = fullLabel;
193
- }
194
- else
195
- {
196
- queueThreadLabel = [NSString stringWithFormat:@"%x", logMessage->machThreadID];
197
- }
198
-
199
- // Now use the thread label in the output
200
-
201
- NSUInteger labelLength = [queueThreadLabel length];
202
-
203
- // labelLength > maxQueueLength : truncate
204
- // labelLength < minQueueLength : padding
205
- // : exact
206
-
207
- if ((maxQueueLength > 0) && (labelLength > maxQueueLength))
208
- {
209
- // Truncate
210
-
211
- return [queueThreadLabel substringToIndex:maxQueueLength];
212
- }
213
- else if (labelLength < minQueueLength)
214
- {
215
- // Padding
216
-
217
- NSUInteger numSpaces = minQueueLength - labelLength;
218
-
219
- char spaces[numSpaces + 1];
220
- memset(spaces, ' ', numSpaces);
221
- spaces[numSpaces] = '\0';
222
-
223
- return [NSString stringWithFormat:@"%@%s", queueThreadLabel, spaces];
224
- }
225
- else
226
- {
227
- // Exact
228
-
229
- return queueThreadLabel;
230
- }
231
- }
232
-
233
- - (NSString *)formatLogMessage:(DDLogMessage *)logMessage
234
- {
235
- NSString *timestamp = [self stringFromDate:(logMessage->timestamp)];
236
- NSString *queueThreadLabel = [self queueThreadLabelForLogMessage:logMessage];
237
-
238
- return [NSString stringWithFormat:@"%@ [%@] %@", timestamp, queueThreadLabel, logMessage->logMsg];
239
- }
240
-
241
- - (void)didAddToLogger:(id <DDLogger>)logger
242
- {
243
- OSAtomicIncrement32(&atomicLoggerCount);
244
- }
245
-
246
- - (void)willRemoveFromLogger:(id <DDLogger>)logger
247
- {
248
- OSAtomicDecrement32(&atomicLoggerCount);
249
- }
250
-
251
- @end
@@ -1,641 +0,0 @@
1
- // AFHTTPClient.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
- #import <Availability.h>
27
-
28
- /**
29
- `AFHTTPClient` captures the common patterns of communicating with an web application over HTTP. It encapsulates information like base URL, authorization credentials, and HTTP headers, and uses them to construct and manage the execution of HTTP request operations.
30
-
31
- ## Automatic Content Parsing
32
-
33
- Instances of `AFHTTPClient` may specify which types of requests it expects and should handle by registering HTTP operation classes for automatic parsing. Registered classes will determine whether they can handle a particular request, and then construct a request operation accordingly in `enqueueHTTPRequestOperationWithRequest:success:failure`.
34
-
35
- ## Subclassing Notes
36
-
37
- In most cases, one should create an `AFHTTPClient` subclass for each website or web application that your application communicates with. It is often useful, also, to define a class method that returns a singleton shared HTTP client in each subclass, that persists authentication credentials and other configuration across the entire application.
38
-
39
- ## Methods to Override
40
-
41
- To change the behavior of all url request construction for an `AFHTTPClient` subclass, override `requestWithMethod:path:parameters`.
42
-
43
- To change the behavior of all request operation construction for an `AFHTTPClient` subclass, override `HTTPRequestOperationWithRequest:success:failure`.
44
-
45
- ## Default Headers
46
-
47
- By default, `AFHTTPClient` sets the following HTTP headers:
48
-
49
- - `Accept-Language: (comma-delimited preferred languages), en-us;q=0.8`
50
- - `User-Agent: (generated user agent)`
51
-
52
- You can override these HTTP headers or define new ones using `setDefaultHeader:value:`.
53
-
54
- ## URL Construction Using Relative Paths
55
-
56
- Both `-requestWithMethod:path:parameters:` and `-multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interact:
57
-
58
- NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];
59
- [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo
60
- [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz
61
- [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo
62
- [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo
63
- [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/
64
- [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/
65
-
66
- Also important to note is that a trailing slash will be added to any `baseURL` without one, which would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.
67
-
68
- ## NSCoding / NSCopying Conformance
69
-
70
- `AFHTTPClient` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. There are a few minor caveats to keep in mind, however:
71
-
72
- - Archives and copies of HTTP clients will be initialized with an empty operation queue.
73
- - NSCoding cannot serialize / deserialize block properties, so an archive of an HTTP client will not include any reachability callback block that may be set.
74
- */
75
-
76
- #ifdef _SYSTEMCONFIGURATION_H
77
- typedef enum {
78
- AFNetworkReachabilityStatusUnknown = -1,
79
- AFNetworkReachabilityStatusNotReachable = 0,
80
- AFNetworkReachabilityStatusReachableViaWWAN = 1,
81
- AFNetworkReachabilityStatusReachableViaWiFi = 2,
82
- } AFNetworkReachabilityStatus;
83
- #else
84
- #pragma message("SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available.")
85
- #endif
86
-
87
- #ifndef __UTTYPE__
88
- #if __IPHONE_OS_VERSION_MIN_REQUIRED
89
- #pragma message("MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available.")
90
- #else
91
- #pragma message("CoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available.")
92
- #endif
93
- #endif
94
-
95
- typedef enum {
96
- AFFormURLParameterEncoding,
97
- AFJSONParameterEncoding,
98
- AFPropertyListParameterEncoding,
99
- } AFHTTPClientParameterEncoding;
100
-
101
- @class AFHTTPRequestOperation;
102
- @protocol AFMultipartFormData;
103
-
104
- @interface AFHTTPClient : NSObject <NSCoding, NSCopying>
105
-
106
- ///---------------------------------------
107
- /// @name Accessing HTTP Client Properties
108
- ///---------------------------------------
109
-
110
- /**
111
- The url used as the base for paths specified in methods such as `getPath:parameters:success:failure`
112
- */
113
- @property (readonly, nonatomic, strong) NSURL *baseURL;
114
-
115
- /**
116
- The string encoding used in constructing url requests. This is `NSUTF8StringEncoding` by default.
117
- */
118
- @property (nonatomic, assign) NSStringEncoding stringEncoding;
119
-
120
- /**
121
- The `AFHTTPClientParameterEncoding` value corresponding to how parameters are encoded into a request body for request methods other than `GET`, `HEAD` or `DELETE`. This is `AFFormURLParameterEncoding` by default.
122
-
123
- @warning Some nested parameter structures, such as a keyed array of hashes containing inconsistent keys (i.e. `@{@"": @[@{@"a" : @(1)}, @{@"b" : @(2)}]}`), cannot be unambiguously represented in query strings. It is strongly recommended that an unambiguous encoding, such as `AFJSONParameterEncoding`, is used when posting complicated or nondeterministic parameter structures.
124
- */
125
- @property (nonatomic, assign) AFHTTPClientParameterEncoding parameterEncoding;
126
-
127
- /**
128
- The operation queue which manages operations enqueued by the HTTP client.
129
- */
130
- @property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;
131
-
132
- /**
133
- The reachability status from the device to the current `baseURL` of the `AFHTTPClient`.
134
-
135
- @warning This property requires the `SystemConfiguration` framework. Add it in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
136
- */
137
- #ifdef _SYSTEMCONFIGURATION_H
138
- @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
139
- #endif
140
-
141
- /**
142
- Default SSL pinning mode for each `AFHTTPRequestOperation` created by `HTTPRequestOperationWithRequest:success:failure:`.
143
- */
144
- @property (nonatomic, assign) AFURLConnectionOperationSSLPinningMode defaultSSLPinningMode;
145
-
146
- /**
147
- Whether each `AFHTTPRequestOperation` created by `HTTPRequestOperationWithRequest:success:failure:` should accept an invalid SSL certificate.
148
-
149
- If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is set, this property defaults to `YES` for backwards compatibility. Otherwise, this property defaults to `NO`.
150
- */
151
- @property (nonatomic, assign) BOOL allowsInvalidSSLCertificate;
152
-
153
- ///---------------------------------------------
154
- /// @name Creating and Initializing HTTP Clients
155
- ///---------------------------------------------
156
-
157
- /**
158
- Creates and initializes an `AFHTTPClient` object with the specified base URL.
159
-
160
- @param url The base URL for the HTTP client. This argument must not be `nil`.
161
-
162
- @return The newly-initialized HTTP client
163
- */
164
- + (instancetype)clientWithBaseURL:(NSURL *)url;
165
-
166
- /**
167
- Initializes an `AFHTTPClient` object with the specified base URL.
168
-
169
- This is the designated initializer.
170
-
171
- @param url The base URL for the HTTP client. This argument must not be `nil`.
172
-
173
- @return The newly-initialized HTTP client
174
- */
175
- - (id)initWithBaseURL:(NSURL *)url;
176
-
177
- ///-----------------------------------
178
- /// @name Managing Reachability Status
179
- ///-----------------------------------
180
-
181
- /**
182
- Sets a callback to be executed when the network availability of the `baseURL` host changes.
183
-
184
- @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
185
-
186
- @warning This method requires the `SystemConfiguration` framework. Add it in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
187
- */
188
- #ifdef _SYSTEMCONFIGURATION_H
189
- - (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block;
190
- #endif
191
-
192
- ///-------------------------------
193
- /// @name Managing HTTP Operations
194
- ///-------------------------------
195
-
196
- /**
197
- Attempts to register a subclass of `AFHTTPRequestOperation`, adding it to a chain to automatically generate request operations from a URL request.
198
-
199
- When `enqueueHTTPRequestOperationWithRequest:success:failure` is invoked, each registered class is consulted in turn to see if it can handle the specific request. The first class to return `YES` when sent a `canProcessRequest:` message is used to create an operation using `initWithURLRequest:` and do `setCompletionBlockWithSuccess:failure:`. There is no guarantee that all registered classes will be consulted. Classes are consulted in the reverse order of their registration. Attempting to register an already-registered class will move it to the top of the list.
200
-
201
- @param operationClass The subclass of `AFHTTPRequestOperation` to register
202
-
203
- @return `YES` if the registration is successful, `NO` otherwise. The only failure condition is if `operationClass` is not a subclass of `AFHTTPRequestOperation`.
204
- */
205
- - (BOOL)registerHTTPOperationClass:(Class)operationClass;
206
-
207
- /**
208
- Unregisters the specified subclass of `AFHTTPRequestOperation` from the chain of classes consulted when `-requestWithMethod:path:parameters` is called.
209
-
210
- @param operationClass The subclass of `AFHTTPRequestOperation` to register
211
- */
212
- - (void)unregisterHTTPOperationClass:(Class)operationClass;
213
-
214
- ///----------------------------------
215
- /// @name Managing HTTP Header Values
216
- ///----------------------------------
217
-
218
- /**
219
- Returns the value for the HTTP headers set in request objects created by the HTTP client.
220
-
221
- @param header The HTTP header to return the default value for
222
-
223
- @return The default value for the HTTP header, or `nil` if unspecified
224
- */
225
- - (NSString *)defaultValueForHeader:(NSString *)header;
226
-
227
- /**
228
- Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.
229
-
230
- @param header The HTTP header to set a default value for
231
- @param value The value set as default for the specified header, or `nil
232
- */
233
- - (void)setDefaultHeader:(NSString *)header
234
- value:(NSString *)value;
235
-
236
- /**
237
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
238
-
239
- @param username The HTTP basic auth username
240
- @param password The HTTP basic auth password
241
- */
242
- - (void)setAuthorizationHeaderWithUsername:(NSString *)username
243
- password:(NSString *)password;
244
-
245
- /**
246
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a token-based authentication value, such as an OAuth access token. This overwrites any existing value for this header.
247
-
248
- @param token The authentication token
249
- */
250
- - (void)setAuthorizationHeaderWithToken:(NSString *)token;
251
-
252
-
253
- /**
254
- Clears any existing value for the "Authorization" HTTP header.
255
- */
256
- - (void)clearAuthorizationHeader;
257
-
258
- ///-------------------------------
259
- /// @name Managing URL Credentials
260
- ///-------------------------------
261
-
262
- /**
263
- Set the default URL credential to be set for request operations.
264
-
265
- @param credential The URL credential
266
- */
267
- - (void)setDefaultCredential:(NSURLCredential *)credential;
268
-
269
- ///-------------------------------
270
- /// @name Creating Request Objects
271
- ///-------------------------------
272
-
273
- /**
274
- Creates an `NSMutableURLRequest` object with the specified HTTP method and path.
275
-
276
- If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
277
-
278
- @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.
279
- @param path The path to be appended to the HTTP client's base URL and used as the request URL. If `nil`, no path will be appended to the base URL.
280
- @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.
281
-
282
- @return An `NSMutableURLRequest` object
283
- */
284
- - (NSMutableURLRequest *)requestWithMethod:(NSString *)method
285
- path:(NSString *)path
286
- parameters:(NSDictionary *)parameters;
287
-
288
- /**
289
- Creates an `NSMutableURLRequest` object with the specified HTTP method and path, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2
290
-
291
- Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.
292
-
293
- @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.
294
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
295
- @param parameters The parameters to be encoded and set in the request HTTP body.
296
- @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. This can be used to upload files, encode HTTP body as JSON or XML, or specify multiple values for the same parameter, as one might for array values.
297
-
298
- @return An `NSMutableURLRequest` object
299
- */
300
- - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
301
- path:(NSString *)path
302
- parameters:(NSDictionary *)parameters
303
- constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block;
304
-
305
- ///-------------------------------
306
- /// @name Creating HTTP Operations
307
- ///-------------------------------
308
-
309
- /**
310
- Creates an `AFHTTPRequestOperation`.
311
-
312
- In order to determine what kind of operation is created, each registered subclass conforming to the `AFHTTPClient` protocol is consulted (in reverse order of when they were specified) to see if it can handle the specific request. The first class to return `YES` when sent a `canProcessRequest:` message is used to generate an operation using `HTTPRequestOperationWithRequest:success:failure:`.
313
-
314
- @param urlRequest The request object to be loaded asynchronously during execution of the operation.
315
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
316
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred.
317
- */
318
- - (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)urlRequest
319
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
320
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
321
-
322
- ///----------------------------------------
323
- /// @name Managing Enqueued HTTP Operations
324
- ///----------------------------------------
325
-
326
- /**
327
- Enqueues an `AFHTTPRequestOperation` to the HTTP client's operation queue.
328
-
329
- @param operation The HTTP request operation to be enqueued.
330
- */
331
- - (void)enqueueHTTPRequestOperation:(AFHTTPRequestOperation *)operation;
332
-
333
- /**
334
- Cancels all operations in the HTTP client's operation queue whose URLs match the specified HTTP method and path.
335
-
336
- This method only cancels `AFHTTPRequestOperations` whose request URL matches the HTTP client base URL with the path appended. For complete control over the lifecycle of enqueued operations, you can access the `operationQueue` property directly, which allows you to, for instance, cancel operations filtered by a predicate, or simply use `-cancelAllRequests`. Note that the operation queue may include non-HTTP operations, so be sure to check the type before attempting to directly introspect an operation's `request` property.
337
-
338
- @param method The HTTP method to match for the cancelled requests, such as `GET`, `POST`, `PUT`, or `DELETE`. If `nil`, all request operations with URLs matching the path will be cancelled.
339
- @param path The path appended to the HTTP client base URL to match against the cancelled requests. If `nil`, no path will be appended to the base URL.
340
- */
341
- - (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path;
342
-
343
- ///---------------------------------------
344
- /// @name Batching HTTP Request Operations
345
- ///---------------------------------------
346
-
347
- /**
348
- Creates and enqueues an `AFHTTPRequestOperation` to the HTTP client's operation queue for each specified request object into a batch. When each request operation finishes, the specified progress block is executed, until all of the request operations have finished, at which point the completion block also executes.
349
-
350
- Operations are created by passing the specified `NSURLRequest` objects in `requests`, using `-HTTPRequestOperationWithRequest:success:failure:`, with `nil` for both the `success` and `failure` parameters.
351
-
352
- @param urlRequests The `NSURLRequest` objects used to create and enqueue operations.
353
- @param progressBlock A block object to be executed upon the completion of each request operation in the batch. This block has no return value and takes two arguments: the number of operations that have already finished execution, and the total number of operations.
354
- @param completionBlock A block object to be executed upon the completion of all of the request operations in the batch. This block has no return value and takes a single argument: the batched request operations.
355
- */
356
- - (void)enqueueBatchOfHTTPRequestOperationsWithRequests:(NSArray *)urlRequests
357
- progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock
358
- completionBlock:(void (^)(NSArray *operations))completionBlock;
359
-
360
- /**
361
- Enqueues the specified request operations into a batch. When each request operation finishes, the specified progress block is executed, until all of the request operations have finished, at which point the completion block also executes.
362
-
363
- @param operations The request operations used to be batched and enqueued.
364
- @param progressBlock A block object to be executed upon the completion of each request operation in the batch. This block has no return value and takes two arguments: the number of operations that have already finished execution, and the total number of operations.
365
- @param completionBlock A block object to be executed upon the completion of all of the request operations in the batch. This block has no return value and takes a single argument: the batched request operations.
366
- */
367
- - (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations
368
- progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock
369
- completionBlock:(void (^)(NSArray *operations))completionBlock;
370
-
371
- ///---------------------------
372
- /// @name Making HTTP Requests
373
- ///---------------------------
374
-
375
- /**
376
- Creates an `AFHTTPRequestOperation` with a `GET` request, and enqueues it to the HTTP client's operation queue.
377
-
378
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
379
- @param parameters The parameters to be encoded and appended as the query string for the request URL.
380
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
381
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments: the created request operation and the `NSError` object describing the network or parsing error that occurred.
382
-
383
- @see -HTTPRequestOperationWithRequest:success:failure:
384
- */
385
- - (void)getPath:(NSString *)path
386
- parameters:(NSDictionary *)parameters
387
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
388
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
389
-
390
- /**
391
- Creates an `AFHTTPRequestOperation` with a `POST` request, and enqueues it to the HTTP client's operation queue.
392
-
393
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
394
- @param parameters The parameters to be encoded and set in the request HTTP body.
395
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
396
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments: the created request operation and the `NSError` object describing the network or parsing error that occurred.
397
-
398
- @see -HTTPRequestOperationWithRequest:success:failure:
399
- */
400
- - (void)postPath:(NSString *)path
401
- parameters:(NSDictionary *)parameters
402
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
403
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
404
-
405
- /**
406
- Creates an `AFHTTPRequestOperation` with a `PUT` request, and enqueues it to the HTTP client's operation queue.
407
-
408
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
409
- @param parameters The parameters to be encoded and set in the request HTTP body.
410
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
411
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments: the created request operation and the `NSError` object describing the network or parsing error that occurred.
412
-
413
- @see -HTTPRequestOperationWithRequest:success:failure:
414
- */
415
- - (void)putPath:(NSString *)path
416
- parameters:(NSDictionary *)parameters
417
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
418
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
419
-
420
- /**
421
- Creates an `AFHTTPRequestOperation` with a `DELETE` request, and enqueues it to the HTTP client's operation queue.
422
-
423
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
424
- @param parameters The parameters to be encoded and appended as the query string for the request URL.
425
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
426
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments: the created request operation and the `NSError` object describing the network or parsing error that occurred.
427
-
428
- @see -HTTPRequestOperationWithRequest:success:failure:
429
- */
430
- - (void)deletePath:(NSString *)path
431
- parameters:(NSDictionary *)parameters
432
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
433
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
434
-
435
- /**
436
- Creates an `AFHTTPRequestOperation` with a `PATCH` request, and enqueues it to the HTTP client's operation queue.
437
-
438
- @param path The path to be appended to the HTTP client's base URL and used as the request URL.
439
- @param parameters The parameters to be encoded and set in the request HTTP body.
440
- @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
441
- @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments: the created request operation and the `NSError` object describing the network or parsing error that occurred.
442
-
443
- @see -HTTPRequestOperationWithRequest:success:failure:
444
- */
445
- - (void)patchPath:(NSString *)path
446
- parameters:(NSDictionary *)parameters
447
- success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
448
- failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
449
- @end
450
-
451
- ///----------------
452
- /// @name Constants
453
- ///----------------
454
-
455
- /**
456
- ## Network Reachability
457
-
458
- The following constants are provided by `AFHTTPClient` as possible network reachability statuses.
459
-
460
- enum {
461
- AFNetworkReachabilityStatusUnknown,
462
- AFNetworkReachabilityStatusNotReachable,
463
- AFNetworkReachabilityStatusReachableViaWWAN,
464
- AFNetworkReachabilityStatusReachableViaWiFi,
465
- }
466
-
467
- `AFNetworkReachabilityStatusUnknown`
468
- The `baseURL` host reachability is not known.
469
-
470
- `AFNetworkReachabilityStatusNotReachable`
471
- The `baseURL` host cannot be reached.
472
-
473
- `AFNetworkReachabilityStatusReachableViaWWAN`
474
- The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
475
-
476
- `AFNetworkReachabilityStatusReachableViaWiFi`
477
- The `baseURL` host can be reached via a Wi-Fi connection.
478
-
479
- ### Keys for Notification UserInfo Dictionary
480
-
481
- Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
482
-
483
- `AFNetworkingReachabilityNotificationStatusItem`
484
- A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
485
- The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
486
-
487
- ## Parameter Encoding
488
-
489
- The following constants are provided by `AFHTTPClient` as possible methods for serializing parameters into query string or message body values.
490
-
491
- enum {
492
- AFFormURLParameterEncoding,
493
- AFJSONParameterEncoding,
494
- AFPropertyListParameterEncoding,
495
- }
496
-
497
- `AFFormURLParameterEncoding`
498
- Parameters are encoded into field/key pairs in the URL query string for `GET` `HEAD` and `DELETE` requests, and in the message body otherwise. Dictionary keys are sorted with the `caseInsensitiveCompare:` selector of their description, in order to mitigate the possibility of ambiguous query strings being generated non-deterministically. See the warning for the `parameterEncoding` property for additional information.
499
-
500
- `AFJSONParameterEncoding`
501
- Parameters are encoded into JSON in the message body.
502
-
503
- `AFPropertyListParameterEncoding`
504
- Parameters are encoded into a property list in the message body.
505
- */
506
-
507
- ///----------------
508
- /// @name Functions
509
- ///----------------
510
-
511
- /**
512
- Returns a query string constructed by a set of parameters, using the specified encoding.
513
-
514
- Query strings are constructed by collecting each key-value pair, percent escaping a string representation of the key-value pair, and then joining the pairs with "&".
515
-
516
- If a query string pair has a an `NSArray` for its value, each member of the array will be represented in the format `field[]=value1&field[]value2`. Otherwise, the pair will be formatted as "field=value". String representations of both keys and values are derived using the `-description` method. The constructed query string does not include the ? character used to delimit the query component.
517
-
518
- @param parameters The parameters used to construct the query string
519
- @param encoding The encoding to use in constructing the query string. If you are uncertain of the correct encoding, you should use UTF-8 (`NSUTF8StringEncoding`), which is the encoding designated by RFC 3986 as the correct encoding for use in URLs.
520
-
521
- @return A percent-escaped query string
522
- */
523
- extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *parameters, NSStringEncoding encoding);
524
-
525
- ///--------------------
526
- /// @name Notifications
527
- ///--------------------
528
-
529
- /**
530
- Posted when network reachability changes.
531
- This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
532
-
533
- @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
534
- */
535
- #ifdef _SYSTEMCONFIGURATION_H
536
- extern NSString * const AFNetworkingReachabilityDidChangeNotification;
537
- extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
538
- #endif
539
-
540
- #pragma mark -
541
-
542
- extern NSUInteger const kAFUploadStream3GSuggestedPacketSize;
543
- extern NSTimeInterval const kAFUploadStream3GSuggestedDelay;
544
-
545
- /**
546
- The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPClient -multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:`.
547
- */
548
- @protocol AFMultipartFormData
549
-
550
- /**
551
- Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.
552
-
553
- The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.
554
-
555
- @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
556
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
557
- @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
558
-
559
- @return `YES` if the file data was successfully appended, otherwise `NO`.
560
- */
561
- - (BOOL)appendPartWithFileURL:(NSURL *)fileURL
562
- name:(NSString *)name
563
- error:(NSError * __autoreleasing *)error;
564
-
565
- /**
566
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
567
-
568
- @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
569
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
570
- @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.
571
- @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.
572
- @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
573
-
574
- @return `YES` if the file data was successfully appended otherwise `NO`.
575
- */
576
- - (BOOL)appendPartWithFileURL:(NSURL *)fileURL
577
- name:(NSString *)name
578
- fileName:(NSString *)fileName
579
- mimeType:(NSString *)mimeType
580
- error:(NSError * __autoreleasing *)error;
581
-
582
- /**
583
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary.
584
-
585
- @param inputStream The input stream to be appended to the form data
586
- @param name The name to be associated with the specified input stream. This parameter must not be `nil`.
587
- @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.
588
- @param length The length of the specified input stream in bytes.
589
- @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
590
- */
591
- - (void)appendPartWithInputStream:(NSInputStream *)inputStream
592
- name:(NSString *)name
593
- fileName:(NSString *)fileName
594
- length:(unsigned long long)length
595
- mimeType:(NSString *)mimeType;
596
-
597
- /**
598
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
599
-
600
- @param data The data to be encoded and appended to the form data.
601
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
602
- @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.
603
- @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
604
- */
605
- - (void)appendPartWithFileData:(NSData *)data
606
- name:(NSString *)name
607
- fileName:(NSString *)fileName
608
- mimeType:(NSString *)mimeType;
609
-
610
- /**
611
- Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
612
-
613
- @param data The data to be encoded and appended to the form data.
614
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
615
- */
616
-
617
- - (void)appendPartWithFormData:(NSData *)data
618
- name:(NSString *)name;
619
-
620
-
621
- /**
622
- Appends HTTP headers, followed by the encoded data and the multipart form boundary.
623
-
624
- @param headers The HTTP headers to be appended to the form data.
625
- @param body The data to be encoded and appended to the form data.
626
- */
627
- - (void)appendPartWithHeaders:(NSDictionary *)headers
628
- body:(NSData *)body;
629
-
630
- /**
631
- Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.
632
-
633
- When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, as of iOS 6, there is no definite way to distinguish between a 3G, EDGE, or LTE connection. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth.
634
-
635
- @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 32kb.
636
- @param delay Duration of delay each time a packet is read. By default, no delay is set.
637
- */
638
- - (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
639
- delay:(NSTimeInterval)delay;
640
-
641
- @end