afmotion 2.5 → 2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: faa1ecf8a041e3e0ecadf1803e62f3e75df6bab1
4
- data.tar.gz: 63bf5af8fc8133cf5d503942c073474d1f2fe522
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGU4YjcxZDY0YTVlMmM2OTIxNzYyZDhmMDBiOGQwYjhkMzkzNDJkYg==
5
+ data.tar.gz: !binary |-
6
+ NDFlOWRlZmFlOTkzNTgyMTQyMGUxMzlkYWI1MDcwNDQxYjA4NWMxNg==
5
7
  SHA512:
6
- metadata.gz: 0fda9bafa27ef7d7e6fe83fd4ddcb0d615cd86ddadce7e6a8354a314cff2ec2585c001530d205afae971abfecdb8cf3f05091a72b87bfe5df78d5e51a0a9cb79
7
- data.tar.gz: 3f1a0230a89efbb735b45f590601efc1b848be85b74a71529e130e535c01a654aa3ae514e6c9b5524aa6b1f45a2866065c8f821d6a5755cfeedf6808a83396cf
8
+ metadata.gz: !binary |-
9
+ MWRhOGVkYzNiYTE3MDRlNmExYzQ5YTQ3N2MyYjU4ZmYxNTRlMDA5OTNiMjAx
10
+ ZDI2MjMwNTVjNzA5MWM4Y2E5NmE3NTBhNWQyNWIwNTA1NGQ5NDBlNmYxNDE1
11
+ Njk2MzJhMjk3YWNkMjY4OWUwYzgwYWU0Yjc3NmIzMTk3MmU4YTQ=
12
+ data.tar.gz: !binary |-
13
+ ZWFlYjBiNjhiZDU3NmFhNTE4ZWNiNzU2OTk3YzY5N2M3MWY2NGUxZmVkMzQ3
14
+ NTZiZWU2Yzg1NzIwNTRjNjlkYzdmMDJmYTIyNTk4ZGY0YTI3ZmVlODYxMzFm
15
+ NWFmZmEzM2IwN2UwM2Y5M2M5YmQwNzcxM2UwZWZhMTM1ZTRkMGU=
@@ -2,11 +2,24 @@ language: objective-c
2
2
  before_install:
3
3
  - (ruby --version)
4
4
  - sudo chown -R travis ~/Library/RubyMotion
5
- - mkdir -p ~/Library/RubyMotion/build
5
+ - sudo mkdir -p ~/Library/RubyMotion/build
6
+ - sudo chown -R travis ~/Library/RubyMotion/build
7
+ - sudo motion update
8
+ install:
6
9
  - bundle install
7
- - pod setup
8
- - bundle exec rake pod:install
10
+ - pod setup > /dev/null
11
+ - bundle exec rake pod:install > /dev/null
12
+ gemfile:
13
+ - Gemfile
9
14
  script: bundle exec rake spec
10
15
  env:
11
16
  global:
12
- - COCOAPODS_NO_REPO_UPDATE_OUTPUT=true
17
+ - COCOAPODS_NO_REPO_UPDATE_OUTPUT=true
18
+ deploy:
19
+ provider: rubygems
20
+ api_key:
21
+ secure: cCwC+P6XvkgW+iE3LY9YpzL8rSwCVVlUQ9dThepSGFN9mmMOYYMhohVm9NS3kkFzCFKCzu80ATi65ndKukOCwLEgsQO4HM9fH2y0XfmYp/aooJUUxzakDA7XI9kWc0SpqURSRujZBobcJnt4HctMLIogihYYQ/DlILgyy+0fU7U=
22
+ gem: afmotion
23
+ on:
24
+ tags: true
25
+ repo: clayallsopp/afmotion
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency "motion-cocoapods", ">= 1.4.1"
19
19
  s.add_dependency "motion-require", ">= 0.1"
20
20
  s.add_development_dependency 'rake'
21
- s.add_development_dependency 'webstub'
22
- end
21
+ s.add_development_dependency 'webstub', "~> 1.1"
22
+ end
@@ -8,57 +8,57 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (4.1.8)
12
- i18n (~> 0.6, >= 0.6.9)
11
+ activesupport (4.2.1)
12
+ i18n (~> 0.7)
13
13
  json (~> 1.7, >= 1.7.7)
14
14
  minitest (~> 5.1)
15
- thread_safe (~> 0.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
16
16
  tzinfo (~> 1.1)
17
- claide (0.7.0)
18
- cocoapods (0.35.0)
17
+ claide (0.8.1)
18
+ cocoapods (0.36.0)
19
19
  activesupport (>= 3.2.15)
20
- claide (~> 0.7.0)
21
- cocoapods-core (= 0.35.0)
22
- cocoapods-downloader (~> 0.8.0)
23
- cocoapods-plugins (~> 0.3.1)
24
- cocoapods-trunk (~> 0.4.1)
25
- cocoapods-try (~> 0.4.2)
20
+ claide (~> 0.8.1)
21
+ cocoapods-core (= 0.36.0)
22
+ cocoapods-downloader (~> 0.8.1)
23
+ cocoapods-plugins (~> 0.4.1)
24
+ cocoapods-trunk (~> 0.6.0)
25
+ cocoapods-try (~> 0.4.3)
26
26
  colored (~> 1.2)
27
27
  escape (~> 0.0.4)
28
- molinillo (~> 0.1.2)
28
+ molinillo (~> 0.2.1)
29
29
  nap (~> 0.8)
30
30
  open4 (~> 1.3)
31
- xcodeproj (~> 0.20.2)
32
- cocoapods-core (0.35.0)
31
+ xcodeproj (~> 0.23.0)
32
+ cocoapods-core (0.36.0)
33
33
  activesupport (>= 3.2.15)
34
34
  fuzzy_match (~> 2.0.4)
35
35
  nap (~> 0.8.0)
36
- cocoapods-downloader (0.8.0)
37
- cocoapods-plugins (0.3.2)
36
+ cocoapods-downloader (0.8.1)
37
+ cocoapods-plugins (0.4.1)
38
38
  nap
39
- cocoapods-trunk (0.4.1)
39
+ cocoapods-trunk (0.6.0)
40
40
  nap (>= 0.8)
41
41
  netrc (= 0.7.8)
42
- cocoapods-try (0.4.2)
42
+ cocoapods-try (0.4.3)
43
43
  colored (1.2)
44
44
  escape (0.0.4)
45
45
  fuzzy_match (2.0.4)
46
- i18n (0.6.11)
47
- json (1.8.1)
48
- minitest (5.5.0)
49
- molinillo (0.1.2)
46
+ i18n (0.7.0)
47
+ json (1.8.2)
48
+ minitest (5.5.1)
49
+ molinillo (0.2.1)
50
50
  motion-cocoapods (1.7.0)
51
51
  cocoapods (>= 0.34)
52
52
  motion-require (0.2.0)
53
53
  nap (0.8.0)
54
54
  netrc (0.7.8)
55
55
  open4 (1.3.4)
56
- rake (10.3.2)
57
- thread_safe (0.3.4)
56
+ rake (10.4.2)
57
+ thread_safe (0.3.5)
58
58
  tzinfo (1.2.2)
59
59
  thread_safe (~> 0.1)
60
- webstub (1.0.1)
61
- xcodeproj (0.20.2)
60
+ webstub (1.1.2)
61
+ xcodeproj (0.23.0)
62
62
  activesupport (>= 3)
63
63
  colored (~> 1.2)
64
64
 
@@ -68,4 +68,7 @@ PLATFORMS
68
68
  DEPENDENCIES
69
69
  afmotion!
70
70
  rake
71
- webstub
71
+ webstub (~> 1.1)
72
+
73
+ BUNDLED WITH
74
+ 1.10.4
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AFMotion
2
2
 
3
- [![Build Status](https://travis-ci.org/usepropeller/afmotion.png?branch=master)](https://travis-ci.org/usepropeller/afmotion)
3
+ [![Build Status](https://travis-ci.org/clayallsopp/afmotion.png?branch=master)](https://travis-ci.org/clayallsopp/afmotion)
4
4
 
5
5
  AFMotion is a thin RubyMotion wrapper for [AFNetworking](https://github.com/AFNetworking/AFNetworking), the absolute best networking library on iOS.
6
6
 
@@ -208,7 +208,7 @@ data = UIImagePNGRepresentation(image)
208
208
  client.multipart_post("avatars") do |result, form_data|
209
209
  if form_data
210
210
  # Called before request runs
211
- # see: https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ
211
+ # see: http://cocoadocs.org/docsets/AFNetworking/2.5.0/Protocols/AFMultipartFormData.html
212
212
  form_data.appendPartWithFileData(data, name: "avatar", fileName:"avatar.png", mimeType: "image/png")
213
213
  elsif result.success?
214
214
  ...
@@ -257,7 +257,7 @@ The `AFMotion::Client` & `AFMotion::SessionClient` DSLs allows the following pro
257
257
 
258
258
  - `header(header, value)`
259
259
  - `authorization(username: ___, password: ____)` for HTTP Basic auth, or `authorization(token: ____)` for Token based auth.
260
- - `request_serializer(serializer)`. Allows you to set an [`AFURLRequestSerialization`](http://cocoadocs.org/docsets/AFNetworking/2.0.0/Protocols/AFURLRequestSerialization.html) for all your client's requests, which determines how data is encoded on the way to the server. So if your API is always going to be JSON, you should set `operation(:json)`. Accepts `:json` and `:plist`, or any instance of `AFURLRequestSerialization`.
260
+ - `request_serializer(serializer)`. Allows you to set an [`AFURLRequestSerialization`](http://cocoadocs.org/docsets/AFNetworking/2.0.0/Protocols/AFURLRequestSerialization.html) for all your client's requests, which determines how data is encoded on the way to the server. So if your API is always going to be JSON, you should set `operation(:json)`. Accepts `:json` and `:plist`, or any instance of `AFURLRequestSerialization` and must be called before calling `header` or `authorization` or else the [headers will not be applied](https://github.com/clayallsopp/afmotion/issues/78).
261
261
  - `response_serializer(serializer)`. Allows you to set an [`AFURLResponseSerialization`](http://cocoadocs.org/docsets/AFNetworking/2.0.0/Protocols/AFURLResponseSerialization.html), which determines how data is decoded once the server respnds. Accepts `:json`, `:xml`, `:plist`, `:image`, `:http`, or any instance of `AFURLResponseSerialization`.
262
262
 
263
263
  For `AFMotion::SessionClient` only:
data/Rakefile CHANGED
@@ -13,4 +13,5 @@ require 'webstub'
13
13
  Motion::Project::App.setup do |app|
14
14
  # Use `rake config' to see complete project settings.
15
15
  app.name = 'AFMotion'
16
+ app.deployment_target = "7.1"
16
17
  end
@@ -16,6 +16,6 @@ Motion::Project::App.setup do |app|
16
16
  end
17
17
 
18
18
  app.pods do
19
- pod 'AFNetworking', '~> 2.5'
19
+ pod 'AFNetworking', '~> 2.5.0'
20
20
  end
21
21
  end
@@ -108,7 +108,12 @@ module AFMotion
108
108
  method_signature = "#{http_method.upcase}:parameters:success:failure:"
109
109
  method = self.method(method_signature)
110
110
  success_block = AFMotion::Operation.success_block_for_http_method(http_method, callback)
111
- operation = method.call(path, parameters, success_block, AFMotion::Operation.failure_block(callback))
111
+ failure_block = AFMotion::Operation.failure_block(callback)
112
+ operation = method.call(path, parameters, success_block, failure_block)
113
+ if parameters && parameters[:progress_block] && operation.respond_to?(:setDownloadProgressBlock)
114
+ operation.setDownloadProgressBlock(parameters.delete(:progress_block))
115
+ end
116
+ operation
112
117
  end
113
118
 
114
119
  alias_method :create_task, :create_operation
@@ -125,4 +130,4 @@ module AFMotion
125
130
  self.PATCH("", parameters: nil, success: nil, failure: nil)
126
131
  end
127
132
  end
128
- end
133
+ end
@@ -44,11 +44,12 @@ module AFMotion
44
44
  AFMotion::HTTP_METHODS.each do |method_name|
45
45
  method_signature = "#{method_name.to_s.upcase}:parameters:success:failure:"
46
46
  base.define_singleton_method(method_name, -> (url, parameters = nil, &callback) do
47
- base.operation_manager.send(method_signature, url,
47
+ manager = base.operation_manager
48
+ manager.send(method_signature, url,
48
49
  parameters,
49
50
  AFMotion::Operation.success_block_for_http_method(method_name, callback),
50
51
  AFMotion::Operation.failure_block(callback))
51
52
  end)
52
53
  end
53
54
  end
54
- end
55
+ end
@@ -39,11 +39,14 @@ module AFMotion
39
39
  end
40
40
 
41
41
  def header(header, value)
42
- @operation_manager.headers[header] = value
42
+ @headers ||= {}
43
+ @headers[header] = value
44
+ apply_header(header, value)
43
45
  end
44
46
 
45
47
  def authorization(options = {})
46
- @operation_manager.requestSerializer.authorization = options
48
+ @authorization = options
49
+ apply_authorization(options)
47
50
  end
48
51
 
49
52
  def operation_queue(operation_queue)
@@ -62,6 +65,7 @@ module AFMotion
62
65
  else
63
66
  @operation_manager.requestSerializer = serializer
64
67
  end
68
+ reapply_options
65
69
  end
66
70
 
67
71
  OPERATION_TO_RESPONSE_SERIALIZER = {
@@ -88,6 +92,22 @@ module AFMotion
88
92
  end
89
93
  af_serializer
90
94
  end
95
+
96
+ private
97
+
98
+ def reapply_options
99
+ @headers.each{ |h,v| apply_header(h, v) } unless @headers.nil?
100
+ apply_authorization(@authorization) unless @authorization.nil?
101
+ end
102
+
103
+ def apply_header(header, value)
104
+ @operation_manager.headers[header] = value
105
+ end
106
+
107
+ def apply_authorization(options)
108
+ @operation_manager.requestSerializer.authorization = options
109
+ end
110
+
91
111
  end
92
112
  end
93
113
 
@@ -113,4 +133,4 @@ class AFHTTPRequestOperationManager
113
133
 
114
134
  operation
115
135
  end
116
- end
136
+ end
@@ -91,7 +91,7 @@ module AFMotion
91
91
  SESSION_CONFIGURATION_SHORTHAND = {
92
92
  default: :defaultSessionConfiguration,
93
93
  ephemeral: :ephemeralSessionConfiguration,
94
- background: "backgroundSessionConfiguration:".to_sym
94
+ background: (UIDevice.currentDevice.systemVersion.to_f >= 8.0 ? "backgroundSessionConfigurationWithIdentifier:" : "backgroundSessionConfiguration:").to_sym
95
95
  }
96
96
 
97
97
  def session_configuration(session_configuration, identifier = nil)
@@ -147,4 +147,4 @@ class AFHTTPSessionManager
147
147
 
148
148
  task
149
149
  end
150
- end
150
+ end
@@ -1,5 +1,5 @@
1
1
  module AFMotion
2
- VERSION = "2.5"
2
+ VERSION = "2.6"
3
3
 
4
4
  HTTP_METHODS = [:get, :post, :put, :delete, :patch, :head]
5
5
  end
@@ -30,6 +30,18 @@ describe "AFMotion::ClientDSL" do
30
30
  @client.requestSerializer.is_a?(op_class).should == true
31
31
  end
32
32
  end
33
+
34
+ it "should retain header configuration" do
35
+ @dsl.header "X-Order", "agnostic"
36
+ @dsl.request_serializer :json
37
+ @client.requestSerializer.HTTPRequestHeaders["X-Order"].should == "agnostic"
38
+ end
39
+
40
+ it "should retain authorization" do
41
+ @dsl.authorization username: "clay", password: "test"
42
+ @dsl.request_serializer :json
43
+ @client.requestSerializer.HTTPRequestHeaders["Authorization"].nil?.should == false
44
+ end
33
45
  end
34
46
 
35
47
  describe "#response_serializer" do
@@ -75,6 +87,23 @@ describe "AFMotion::Client" do
75
87
  client = AFMotion::Client.build_shared("http://url")
76
88
  AFMotion::Client.shared.should == client
77
89
  end
90
+
91
+ it "should call progress when given to a chared client" do
92
+ image_path = "images/srpr/logo3w.png"
93
+ client = AFMotion::Client.build_shared("https://www.google.com/")
94
+ @progression = []
95
+ progress_block = Proc.new do |bytesRead, totalBytesRead, totalBytesExpectedToRead|
96
+ @progression << [bytesRead, totalBytesRead, totalBytesExpectedToRead]
97
+ end
98
+
99
+ client.get(image_path, {progress_block: progress_block}) do |result|
100
+ @result = result
101
+ resume
102
+ end
103
+ wait_max(10) do
104
+ @progression.empty?.should == false
105
+ end
106
+ end
78
107
  end
79
108
  end
80
109
 
@@ -193,4 +222,4 @@ describe "AFHTTPClient" do
193
222
  end
194
223
  end
195
224
  end
196
- end
225
+ end
@@ -177,7 +177,6 @@ describe "AFHTTPSessionManager" do
177
177
  end
178
178
  end
179
179
 
180
-
181
180
  ["multipart_post", "multipart_put"].each do |multipart_method|
182
181
  describe "##{multipart_method}" do
183
182
  it "should trigger multipart request" do
@@ -233,4 +232,4 @@ describe "AFHTTPSessionManager" do
233
232
  end
234
233
  end
235
234
  end
236
- end
235
+ end
@@ -1,11 +1,11 @@
1
1
  PODS:
2
2
  - AFNetworking (2.5.0):
3
- - AFNetworking/NSURLConnection
4
- - AFNetworking/NSURLSession
5
- - AFNetworking/Reachability
6
- - AFNetworking/Security
7
- - AFNetworking/Serialization
8
- - AFNetworking/UIKit
3
+ - AFNetworking/NSURLConnection (= 2.5.0)
4
+ - AFNetworking/NSURLSession (= 2.5.0)
5
+ - AFNetworking/Reachability (= 2.5.0)
6
+ - AFNetworking/Security (= 2.5.0)
7
+ - AFNetworking/Serialization (= 2.5.0)
8
+ - AFNetworking/UIKit (= 2.5.0)
9
9
  - AFNetworking/NSURLConnection (2.5.0):
10
10
  - AFNetworking/Reachability
11
11
  - AFNetworking/Security
@@ -25,6 +25,6 @@ DEPENDENCIES:
25
25
  - AFNetworking (~> 2.5)
26
26
 
27
27
  SPEC CHECKSUMS:
28
- AFNetworking: 0f54cb5d16ce38c1b76948faffb8d5fb705021c7
28
+ AFNetworking: 96ac9bf3eda33582701cb1fcc5b896aa1e20311e
29
29
 
30
- COCOAPODS: 0.34.1
30
+ COCOAPODS: 0.36.0
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afmotion
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.5'
4
+ version: '2.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clay Allsopp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: motion-require
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webstub
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.1'
69
69
  description: A RubyMotion Wrapper for AFNetworking
70
70
  email:
71
71
  - clay.allsopp@gmail.com
@@ -109,17 +109,17 @@ require_paths:
109
109
  - lib
110
110
  required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - '>='
112
+ - - ! '>='
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ! '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.0.3
122
+ rubygems_version: 2.2.2
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: A RubyMotion Wrapper for AFNetworking