api-model 2.7.2 → 2.8.0
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 +5 -5
- data/.ruby-version +1 -0
- data/.travis.yml +1 -4
- data/Gemfile.lock +45 -47
- data/api-model.gemspec +5 -5
- data/spec/api-model/api_model_spec.rb +6 -6
- data/spec/api-model/response_spec.rb +9 -5
- metadata +16 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c95cdfa9ad6bbd87e474e6b7e70709aef368efc104b9a0a450c40b4969270106
|
|
4
|
+
data.tar.gz: 056f9aa2e08b827292f90edc649376ca2eb45adbf44e5d25d13ceb0e27da391f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0aed9f9f8f2267ae9f3c873e2e6e394c0eb43530faa14a9a4a92fdbae4362d06ccbce21bb0e580d0742a27dc1aa0408a4c14dca21eb30808cbe73ccaaf9aea7c
|
|
7
|
+
data.tar.gz: 280c8c4524b2b42df4c8faa96a5a24a30ba2492e0dd234310445f9744576ba0ce61ec3442a7e9d6ae108ac8b4942c6fce01f13a10a83916957ac4c4018523296
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.0
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,77 +1,75 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
api-model (2.
|
|
5
|
-
activemodel (
|
|
6
|
-
activesupport (
|
|
7
|
-
hash-pipe (
|
|
4
|
+
api-model (2.8.0)
|
|
5
|
+
activemodel (>= 4.1)
|
|
6
|
+
activesupport (>= 4.1)
|
|
7
|
+
hash-pipe (>= 0.5)
|
|
8
8
|
http-cookie (~> 1.0)
|
|
9
|
-
typhoeus (
|
|
9
|
+
typhoeus (>= 1.1)
|
|
10
10
|
virtus (~> 1.0)
|
|
11
11
|
|
|
12
12
|
GEM
|
|
13
13
|
remote: https://rubygems.org/
|
|
14
14
|
specs:
|
|
15
|
-
activemodel (
|
|
16
|
-
activesupport (=
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
i18n (
|
|
20
|
-
json (~> 1.7, >= 1.7.7)
|
|
15
|
+
activemodel (5.2.0)
|
|
16
|
+
activesupport (= 5.2.0)
|
|
17
|
+
activesupport (5.2.0)
|
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
i18n (>= 0.7, < 2)
|
|
21
20
|
minitest (~> 5.1)
|
|
22
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
|
23
21
|
tzinfo (~> 1.1)
|
|
24
|
-
addressable (2.
|
|
22
|
+
addressable (2.5.2)
|
|
23
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
25
24
|
axiom-types (0.1.1)
|
|
26
25
|
descendants_tracker (~> 0.0.4)
|
|
27
26
|
ice_nine (~> 0.11.0)
|
|
28
27
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
29
|
-
|
|
30
|
-
coderay (1.0.9)
|
|
28
|
+
coderay (1.1.2)
|
|
31
29
|
coercible (1.0.0)
|
|
32
30
|
descendants_tracker (~> 0.0.1)
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
concurrent-ruby (1.0.5)
|
|
32
|
+
crack (0.4.3)
|
|
33
|
+
safe_yaml (~> 1.0.0)
|
|
35
34
|
descendants_tracker (0.0.4)
|
|
36
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
37
|
-
diff-lcs (1.
|
|
38
|
-
domain_name (0.5.
|
|
36
|
+
diff-lcs (1.3)
|
|
37
|
+
domain_name (0.5.20170404)
|
|
39
38
|
unf (>= 0.0.5, < 1.0.0)
|
|
40
39
|
equalizer (0.0.11)
|
|
41
|
-
ethon (0.
|
|
40
|
+
ethon (0.11.0)
|
|
42
41
|
ffi (>= 1.3.0)
|
|
43
|
-
ffi (1.9.
|
|
44
|
-
hash-pipe (0.
|
|
45
|
-
activesupport (
|
|
46
|
-
http-cookie (1.0.
|
|
42
|
+
ffi (1.9.23)
|
|
43
|
+
hash-pipe (0.5.0)
|
|
44
|
+
activesupport (>= 4.1)
|
|
45
|
+
http-cookie (1.0.3)
|
|
47
46
|
domain_name (~> 0.5)
|
|
48
|
-
i18n (0.
|
|
47
|
+
i18n (1.0.0)
|
|
48
|
+
concurrent-ruby (~> 1.0)
|
|
49
49
|
ice_nine (0.11.2)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
rspec-
|
|
59
|
-
rspec-
|
|
60
|
-
|
|
61
|
-
rspec-
|
|
62
|
-
rspec-expectations (2.14.4)
|
|
50
|
+
method_source (0.9.0)
|
|
51
|
+
minitest (5.11.3)
|
|
52
|
+
pry (0.11.3)
|
|
53
|
+
coderay (~> 1.1.0)
|
|
54
|
+
method_source (~> 0.9.0)
|
|
55
|
+
public_suffix (3.0.2)
|
|
56
|
+
rspec (2.99.0)
|
|
57
|
+
rspec-core (~> 2.99.0)
|
|
58
|
+
rspec-expectations (~> 2.99.0)
|
|
59
|
+
rspec-mocks (~> 2.99.0)
|
|
60
|
+
rspec-core (2.99.2)
|
|
61
|
+
rspec-expectations (2.99.2)
|
|
63
62
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
64
|
-
rspec-mocks (2.
|
|
65
|
-
safe_yaml (0.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
tzinfo (1.2.2)
|
|
63
|
+
rspec-mocks (2.99.4)
|
|
64
|
+
safe_yaml (1.0.4)
|
|
65
|
+
thread_safe (0.3.6)
|
|
66
|
+
typhoeus (1.3.0)
|
|
67
|
+
ethon (>= 0.9.0)
|
|
68
|
+
tzinfo (1.2.5)
|
|
71
69
|
thread_safe (~> 0.1)
|
|
72
70
|
unf (0.1.4)
|
|
73
71
|
unf_ext
|
|
74
|
-
unf_ext (0.0.7.
|
|
72
|
+
unf_ext (0.0.7.5)
|
|
75
73
|
vcr (2.8.0)
|
|
76
74
|
virtus (1.0.5)
|
|
77
75
|
axiom-types (~> 0.1)
|
|
@@ -93,4 +91,4 @@ DEPENDENCIES
|
|
|
93
91
|
webmock (= 1.15.0)
|
|
94
92
|
|
|
95
93
|
BUNDLED WITH
|
|
96
|
-
1.
|
|
94
|
+
1.16.1
|
data/api-model.gemspec
CHANGED
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = "api-model"
|
|
5
|
-
s.version = "2.
|
|
5
|
+
s.version = "2.8.0"
|
|
6
6
|
s.authors = ["Damien Timewell", "Erik Rothoff Andersson"]
|
|
7
7
|
s.email = ["mail@damientimewell.com", "erik.rothoff@gmail.com"]
|
|
8
8
|
s.licenses = ['MIT']
|
|
@@ -10,11 +10,11 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.summary = "A simple way of interacting with rest APIs"
|
|
11
11
|
s.description = "API model is a simple wrapper for interacting with external APIs. It tries to make it very simple and easy to make API calls and map the responses into objects."
|
|
12
12
|
|
|
13
|
-
s.add_dependency 'activesupport', '
|
|
14
|
-
s.add_dependency 'activemodel', '
|
|
15
|
-
s.add_dependency 'typhoeus', '
|
|
13
|
+
s.add_dependency 'activesupport', '>= 4.1'
|
|
14
|
+
s.add_dependency 'activemodel', '>= 4.1'
|
|
15
|
+
s.add_dependency 'typhoeus', '>= 1.1'
|
|
16
16
|
s.add_dependency 'virtus', '~> 1.0'
|
|
17
|
-
s.add_dependency 'hash-pipe', '
|
|
17
|
+
s.add_dependency 'hash-pipe', '>= 0.5'
|
|
18
18
|
s.add_dependency 'http-cookie', '~> 1.0'
|
|
19
19
|
|
|
20
20
|
s.add_development_dependency "rspec", '~> 2.14'
|
|
@@ -100,7 +100,7 @@ describe ApiModel do
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
it 'should let you define custom methods as normal' do
|
|
103
|
-
car.is_fast?.should
|
|
103
|
+
car.is_fast?.should be_truthy
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
it 'should let you respect default values for properties' do
|
|
@@ -127,7 +127,7 @@ describe ApiModel do
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
it 'should let you define custom methods as normal' do
|
|
130
|
-
cars.last.is_fast?.should
|
|
130
|
+
cars.last.is_fast?.should be_falsey
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
it 'should respect default values for properties, but also override them' do
|
|
@@ -175,7 +175,7 @@ describe ApiModel do
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
it 'should return false if errors is not a hash' do
|
|
178
|
-
car.set_errors_from_hash("Foobar").should
|
|
178
|
+
car.set_errors_from_hash("Foobar").should be_falsey
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
it 'should set errors on the aliased method when you refer to the synonym' do
|
|
@@ -336,7 +336,7 @@ describe ApiModel do
|
|
|
336
336
|
it 'should be posible to set an instance as persisted' do
|
|
337
337
|
blog_post = BlogPost.new
|
|
338
338
|
blog_post.persisted = true
|
|
339
|
-
blog_post.persisted?.should
|
|
339
|
+
blog_post.persisted?.should be_truthy
|
|
340
340
|
end
|
|
341
341
|
end
|
|
342
342
|
|
|
@@ -362,12 +362,12 @@ describe ApiModel do
|
|
|
362
362
|
|
|
363
363
|
it 'should be true if the api call was successful' do
|
|
364
364
|
new_car.stub_chain(:http_response, :api_call, :success?).and_return true
|
|
365
|
-
new_car.successful?.should
|
|
365
|
+
new_car.successful?.should be_truthy
|
|
366
366
|
end
|
|
367
367
|
|
|
368
368
|
it 'should be false if the api call was not successful' do
|
|
369
369
|
new_car.stub_chain(:http_response, :api_call, :success?).and_return false
|
|
370
|
-
new_car.successful?.should
|
|
370
|
+
new_car.successful?.should be_falsey
|
|
371
371
|
end
|
|
372
372
|
end
|
|
373
373
|
|
|
@@ -117,14 +117,18 @@ describe ApiModel::Response do
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
describe "passing core methods down to the built class" do
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
# to_json is a lie, I'm not sure if it should be in the fall through list or not, but
|
|
121
|
+
# it doesn't fall through as you'd expect. Something something ActiveSupport something
|
|
122
|
+
methods_to_test = ApiModel::Response::FALL_THROUGH_METHODS.select {|m| m != :to_json }
|
|
123
|
+
|
|
124
|
+
methods_to_test.each do |fall_through_method|
|
|
125
|
+
it "should pass ##{fall_through_method} on the built object class" do
|
|
122
126
|
allow_message_expectations_on_nil
|
|
123
|
-
valid_response.objects.should_receive(
|
|
124
|
-
valid_response.send
|
|
127
|
+
valid_response.objects.should_receive(fall_through_method)
|
|
128
|
+
valid_response.send fall_through_method
|
|
125
129
|
end
|
|
126
130
|
end
|
|
127
|
-
|
|
131
|
+
end
|
|
128
132
|
|
|
129
133
|
describe "raising exceptions" do
|
|
130
134
|
describe "for requests which return a 401" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damien Timewell
|
|
@@ -9,50 +9,50 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- - "
|
|
18
|
+
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: '4.1'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
|
-
- - "
|
|
25
|
+
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '4.1'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: activemodel
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- - "
|
|
32
|
+
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
34
|
version: '4.1'
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- - "
|
|
39
|
+
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '4.1'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: typhoeus
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
|
-
- - "
|
|
46
|
+
- - ">="
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '
|
|
48
|
+
version: '1.1'
|
|
49
49
|
type: :runtime
|
|
50
50
|
prerelease: false
|
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
|
53
|
-
- - "
|
|
53
|
+
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: '
|
|
55
|
+
version: '1.1'
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: virtus
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -71,16 +71,16 @@ dependencies:
|
|
|
71
71
|
name: hash-pipe
|
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
|
74
|
-
- - "
|
|
74
|
+
- - ">="
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '0.
|
|
76
|
+
version: '0.5'
|
|
77
77
|
type: :runtime
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
|
-
- - "
|
|
81
|
+
- - ">="
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '0.
|
|
83
|
+
version: '0.5'
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
85
|
name: http-cookie
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -163,6 +163,7 @@ extra_rdoc_files: []
|
|
|
163
163
|
files:
|
|
164
164
|
- ".gitignore"
|
|
165
165
|
- ".rspec"
|
|
166
|
+
- ".ruby-version"
|
|
166
167
|
- ".travis.yml"
|
|
167
168
|
- Gemfile
|
|
168
169
|
- Gemfile.lock
|
|
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
218
219
|
version: '0'
|
|
219
220
|
requirements: []
|
|
220
221
|
rubyforge_project:
|
|
221
|
-
rubygems_version: 2.
|
|
222
|
+
rubygems_version: 2.7.3
|
|
222
223
|
signing_key:
|
|
223
224
|
specification_version: 4
|
|
224
225
|
summary: A simple way of interacting with rest APIs
|