afmotion 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AFMotion.gemspec +1 -0
- data/Gemfile.lock +5 -3
- data/Rakefile +2 -0
- data/lib/afmotion.rb +1 -1
- data/lib/afmotion/http.rb +1 -0
- data/lib/afmotion/http_client.rb +8 -1
- data/lib/afmotion/version.rb +1 -1
- data/spec/http_client_spec.rb +10 -0
- data/spec/integration_spec.rb +69 -0
- data/spec/session_client_spec.rb +10 -0
- data/vendor/Podfile.lock +12 -10
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c957c44c8f314d56ba6de33807ee4abaa7a842e
|
4
|
+
data.tar.gz: d15335cebcadd474f2ba2931d8172f8a3eb56c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4e7deb050500b64ff7dc762723efe7761587c96467696c83edd3a82ab8b21bb760105a776791551d115a628fe0b99842faecd7623d16c2907f1f8958e9a96a
|
7
|
+
data.tar.gz: 084984dcf52bc788c36c05e26a004e16f2a1d5af89fd48bd6986842e62f5515efce55d75ded1d6f28d027b980d631c060bf1faa01cd6ec3711f02eb8ab13408f
|
data/AFMotion.gemspec
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
afmotion (2.
|
4
|
+
afmotion (2.3.1)
|
5
5
|
motion-cocoapods (>= 1.4.1)
|
6
6
|
motion-require (>= 0.1)
|
7
7
|
|
@@ -48,10 +48,11 @@ GEM
|
|
48
48
|
cocoapods (>= 0.32.1)
|
49
49
|
motion-require (0.2.0)
|
50
50
|
multi_json (1.10.1)
|
51
|
-
nap (0.
|
51
|
+
nap (0.8.0)
|
52
52
|
netrc (0.7.7)
|
53
53
|
open4 (1.3.4)
|
54
|
-
rake (10.
|
54
|
+
rake (10.3.2)
|
55
|
+
webstub (1.0.1)
|
55
56
|
xcodeproj (0.17.0)
|
56
57
|
activesupport (~> 3.0)
|
57
58
|
colored (~> 1.2)
|
@@ -62,3 +63,4 @@ PLATFORMS
|
|
62
63
|
DEPENDENCIES
|
63
64
|
afmotion!
|
64
65
|
rake
|
66
|
+
webstub
|
data/Rakefile
CHANGED
data/lib/afmotion.rb
CHANGED
data/lib/afmotion/http.rb
CHANGED
data/lib/afmotion/http_client.rb
CHANGED
@@ -73,13 +73,20 @@ module AFMotion
|
|
73
73
|
form: AFHTTPResponseSerializer
|
74
74
|
}
|
75
75
|
def response_serializer(serializer)
|
76
|
+
write_json_options = true
|
76
77
|
if serializer.is_a?(Symbol) || serializer.is_a?(String)
|
77
78
|
@operation_manager.responseSerializer = OPERATION_TO_RESPONSE_SERIALIZER[serializer.to_sym].serializer
|
78
79
|
elsif serializer.is_a?(Class)
|
79
80
|
@operation_manager.responseSerializer = serializer.serializer
|
80
81
|
else
|
81
82
|
@operation_manager.responseSerializer = serializer
|
83
|
+
write_json_options = false
|
82
84
|
end
|
85
|
+
af_serializer = @operation_manager.responseSerializer
|
86
|
+
if af_serializer.is_a?(AFJSONResponseSerializer) && write_json_options
|
87
|
+
af_serializer.readingOptions = NSJSONReadingMutableContainers
|
88
|
+
end
|
89
|
+
af_serializer
|
83
90
|
end
|
84
91
|
end
|
85
92
|
end
|
@@ -89,7 +96,7 @@ class AFHTTPRequestOperationManager
|
|
89
96
|
|
90
97
|
AFMotion::HTTP_METHODS.each do |method|
|
91
98
|
# EX client.get('my/resource.json')
|
92
|
-
define_method "#{method}", -> (path, parameters =
|
99
|
+
define_method "#{method}", -> (path, parameters = nil, &callback) do
|
93
100
|
create_operation(method, path, parameters, &callback)
|
94
101
|
end
|
95
102
|
end
|
data/lib/afmotion/version.rb
CHANGED
data/spec/http_client_spec.rb
CHANGED
@@ -49,6 +49,16 @@ describe "AFMotion::ClientDSL" do
|
|
49
49
|
@client.responseSerializer.is_a?(enc_class).should == true
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
it "should set mutable reading options for JSON serializer" do
|
54
|
+
@dsl.response_serializer :json
|
55
|
+
@client.responseSerializer.readingOptions.should == NSJSONReadingMutableContainers
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should not set reading options for JSON serializer if raw one supplied" do
|
59
|
+
@dsl.response_serializer AFJSONResponseSerializer.serializer
|
60
|
+
@client.responseSerializer.readingOptions.should.not == NSJSONReadingMutableContainers
|
61
|
+
end
|
52
62
|
end
|
53
63
|
end
|
54
64
|
|
@@ -0,0 +1,69 @@
|
|
1
|
+
describe "AFMotion" do
|
2
|
+
extend WebStub::SpecHelpers
|
3
|
+
|
4
|
+
before do
|
5
|
+
disable_network_access!
|
6
|
+
end
|
7
|
+
|
8
|
+
after do
|
9
|
+
enable_network_access!
|
10
|
+
reset_stubs
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "JSON" do
|
14
|
+
it "should use mutable containers" do
|
15
|
+
url = "http://example.com/"
|
16
|
+
stub_request(:get, url).
|
17
|
+
to_return(json: {"data" => ["thing"]}, delay: 0.3)
|
18
|
+
|
19
|
+
AFMotion::JSON.get(url) do |result|
|
20
|
+
@object = result.object
|
21
|
+
resume
|
22
|
+
end
|
23
|
+
|
24
|
+
wait_max 1.0 do
|
25
|
+
array = @object['data']
|
26
|
+
array << 'derp'
|
27
|
+
array.count.should == 2
|
28
|
+
|
29
|
+
@object['hello'] = 'world'
|
30
|
+
@object.count.should == 2
|
31
|
+
|
32
|
+
@object.delete('data')
|
33
|
+
@object.count.should == 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "Client" do
|
39
|
+
describe "JSON" do
|
40
|
+
it "should use mutable containers" do
|
41
|
+
base_url = "http://example.com/"
|
42
|
+
path = "path"
|
43
|
+
stub_request(:get, base_url + path).
|
44
|
+
to_return(json: {"data" => ["thing"]}, delay: 0.3)
|
45
|
+
|
46
|
+
client = AFMotion::Client.build(base_url) do
|
47
|
+
response_serializer :json
|
48
|
+
end
|
49
|
+
|
50
|
+
client.get(path, nil) do |result|
|
51
|
+
@object = result.object
|
52
|
+
resume
|
53
|
+
end
|
54
|
+
|
55
|
+
wait_max 1.0 do
|
56
|
+
array = @object['data']
|
57
|
+
array << 'derp'
|
58
|
+
array.count.should == 2
|
59
|
+
|
60
|
+
@object['hello'] = 'world'
|
61
|
+
@object.count.should == 2
|
62
|
+
|
63
|
+
@object.delete('data')
|
64
|
+
@object.count.should == 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/session_client_spec.rb
CHANGED
@@ -48,6 +48,16 @@ describe "AFMotion::SessionClientDSL" do
|
|
48
48
|
@dsl.to_session_manager.responseSerializer.is_a?(enc_class).should == true
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
it "should set mutable reading options for JSON serializer" do
|
53
|
+
@dsl.response_serializer :json
|
54
|
+
@dsl.to_session_manager.responseSerializer.readingOptions.should == NSJSONReadingMutableContainers
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not set reading options for JSON serializer if raw one supplied" do
|
58
|
+
@dsl.response_serializer AFJSONResponseSerializer.serializer
|
59
|
+
@dsl.to_session_manager.responseSerializer.readingOptions.should.not == NSJSONReadingMutableContainers
|
60
|
+
end
|
51
61
|
end
|
52
62
|
|
53
63
|
describe "#session_configuration" do
|
data/vendor/Podfile.lock
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
PODS:
|
2
|
-
- AFNetworking (2.
|
2
|
+
- AFNetworking (2.3.1):
|
3
3
|
- AFNetworking/NSURLConnection
|
4
4
|
- AFNetworking/NSURLSession
|
5
5
|
- AFNetworking/Reachability
|
6
6
|
- AFNetworking/Security
|
7
7
|
- AFNetworking/Serialization
|
8
8
|
- AFNetworking/UIKit
|
9
|
-
- AFNetworking/NSURLConnection (2.
|
9
|
+
- AFNetworking/NSURLConnection (2.3.1):
|
10
10
|
- AFNetworking/Reachability
|
11
11
|
- AFNetworking/Security
|
12
12
|
- AFNetworking/Serialization
|
13
|
-
- AFNetworking/NSURLSession (2.
|
14
|
-
- AFNetworking/
|
15
|
-
|
16
|
-
|
17
|
-
- AFNetworking/
|
18
|
-
- AFNetworking/
|
13
|
+
- AFNetworking/NSURLSession (2.3.1):
|
14
|
+
- AFNetworking/Reachability
|
15
|
+
- AFNetworking/Security
|
16
|
+
- AFNetworking/Serialization
|
17
|
+
- AFNetworking/Reachability (2.3.1)
|
18
|
+
- AFNetworking/Security (2.3.1)
|
19
|
+
- AFNetworking/Serialization (2.3.1)
|
20
|
+
- AFNetworking/UIKit (2.3.1):
|
19
21
|
- AFNetworking/NSURLConnection
|
20
22
|
- AFNetworking/NSURLSession
|
21
23
|
|
22
24
|
DEPENDENCIES:
|
23
|
-
- AFNetworking (~> 2.
|
25
|
+
- AFNetworking (~> 2.3.1)
|
24
26
|
|
25
27
|
SPEC CHECKSUMS:
|
26
|
-
AFNetworking:
|
28
|
+
AFNetworking: 6d7b76aa5d04c8c37daad3eef4b7e3f2a7620da3
|
27
29
|
|
28
30
|
COCOAPODS: 0.33.1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afmotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
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-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: motion-cocoapods
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webstub
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A RubyMotion Wrapper for AFNetworking
|
56
70
|
email:
|
57
71
|
- clay.allsopp@gmail.com
|
@@ -82,6 +96,7 @@ files:
|
|
82
96
|
- resources/test.png
|
83
97
|
- spec/http_client_spec.rb
|
84
98
|
- spec/http_spec.rb
|
99
|
+
- spec/integration_spec.rb
|
85
100
|
- spec/session_client_spec.rb
|
86
101
|
- vendor/Podfile.lock
|
87
102
|
homepage: https://github.com/clayallsopp/AFMotion
|
@@ -111,4 +126,5 @@ summary: A RubyMotion Wrapper for AFNetworking
|
|
111
126
|
test_files:
|
112
127
|
- spec/http_client_spec.rb
|
113
128
|
- spec/http_spec.rb
|
129
|
+
- spec/integration_spec.rb
|
114
130
|
- spec/session_client_spec.rb
|