api-model 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -12
- data/api-model.gemspec +9 -8
- data/lib/api-model.rb +1 -0
- data/lib/api_model/core_extensions/hashie.rb +8 -0
- data/lib/api_model/instance_methods.rb +1 -2
- data/spec/api-model/api_model_spec.rb +0 -14
- metadata +34 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b7b32dcafe097cfa189677e7433df6e93bb9d8
|
4
|
+
data.tar.gz: 86d040b5103c7a250594d95631abf9ba2490a628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1768b6cb9cfd663679e7f5be0ac69ec6010dbc28f0b18f960a281f2a44445f8f51215374059c59e94bc081427bae9c5d7336bdbd2b6f785a8f9ba8809737dadf
|
7
|
+
data.tar.gz: 4293c20c24147003fdb13769283fa1f046031c8efcacfa0c40e3cc6e2da814003354642ee28439421b2236f9bf544676c999e43b6c220254d28094141a307814
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
api-model (1.0
|
5
|
-
activemodel
|
6
|
-
activesupport
|
7
|
-
hashie
|
8
|
-
typhoeus
|
4
|
+
api-model (1.1.0)
|
5
|
+
activemodel (~> 4.0.3)
|
6
|
+
activesupport (~> 4.0.3)
|
7
|
+
hashie (~> 2.0.5)
|
8
|
+
typhoeus (~> 0.6.7)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activemodel (4.0.
|
14
|
-
activesupport (= 4.0.
|
13
|
+
activemodel (4.0.3)
|
14
|
+
activesupport (= 4.0.3)
|
15
15
|
builder (~> 3.1.0)
|
16
|
-
activesupport (4.0.
|
16
|
+
activesupport (4.0.3)
|
17
17
|
i18n (~> 0.6, >= 0.6.4)
|
18
18
|
minitest (~> 4.2)
|
19
19
|
multi_json (~> 1.3)
|
20
20
|
thread_safe (~> 0.1)
|
21
21
|
tzinfo (~> 0.3.37)
|
22
22
|
addressable (2.3.5)
|
23
|
-
atomic (1.1.
|
23
|
+
atomic (1.1.15)
|
24
24
|
builder (3.1.4)
|
25
25
|
coderay (1.0.9)
|
26
26
|
crack (0.4.1)
|
27
27
|
safe_yaml (~> 0.9.0)
|
28
28
|
diff-lcs (1.2.5)
|
29
|
-
ethon (0.6.
|
29
|
+
ethon (0.6.3)
|
30
30
|
ffi (>= 1.3.0)
|
31
31
|
mime-types (~> 1.18)
|
32
32
|
ffi (1.9.3)
|
@@ -50,8 +50,8 @@ GEM
|
|
50
50
|
rspec-mocks (2.14.4)
|
51
51
|
safe_yaml (0.9.7)
|
52
52
|
slop (3.4.6)
|
53
|
-
thread_safe (0.
|
54
|
-
atomic
|
53
|
+
thread_safe (0.2.0)
|
54
|
+
atomic (>= 1.1.7, < 2)
|
55
55
|
typhoeus (0.6.7)
|
56
56
|
ethon (~> 0.6.2)
|
57
57
|
tzinfo (0.3.38)
|
data/api-model.gemspec
CHANGED
@@ -2,21 +2,22 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "api-model"
|
5
|
-
s.version = "1.0
|
5
|
+
s.version = "1.1.0"
|
6
6
|
s.authors = ["Damien Timewell"]
|
7
7
|
s.email = ["mail@damientimewell.com"]
|
8
|
+
s.licenses = ['MIT']
|
8
9
|
s.homepage = "https://github.com/iZettle/api-model"
|
9
10
|
s.summary = "A simple way of interacting with rest APIs"
|
10
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."
|
11
12
|
|
12
|
-
s.add_dependency 'activesupport'
|
13
|
-
s.add_dependency 'activemodel'
|
14
|
-
s.add_dependency 'typhoeus'
|
15
|
-
s.add_dependency 'hashie'
|
13
|
+
s.add_dependency 'activesupport', '~> 4.0'
|
14
|
+
s.add_dependency 'activemodel', '~> 4.0'
|
15
|
+
s.add_dependency 'typhoeus', '~> 0.6'
|
16
|
+
s.add_dependency 'hashie', '~> 2.0'
|
16
17
|
|
17
|
-
s.add_development_dependency "rspec"
|
18
|
-
s.add_development_dependency "pry"
|
19
|
-
s.add_development_dependency "vcr"
|
18
|
+
s.add_development_dependency "rspec", '~> 2.14'
|
19
|
+
s.add_development_dependency "pry", '~> 0.9'
|
20
|
+
s.add_development_dependency "vcr", '2.8.0'
|
20
21
|
s.add_development_dependency "webmock", "1.15.0"
|
21
22
|
|
22
23
|
s.files = `git ls-files`.split("\n")
|
data/lib/api-model.rb
CHANGED
@@ -15,8 +15,7 @@ module ApiModel
|
|
15
15
|
def property_exists?(property_name)
|
16
16
|
super property_name
|
17
17
|
rescue NoMethodError
|
18
|
-
Log.debug "Could not set #{property_name} on #{self.class.name}
|
19
|
-
self.class.property property_name.to_sym
|
18
|
+
Log.debug "Could not set #{property_name} on #{self.class.name}"
|
20
19
|
end
|
21
20
|
|
22
21
|
# Convenience method to handle error hashes and set them as ActiveModel errors on instances.
|
@@ -119,20 +119,6 @@ describe ApiModel do
|
|
119
119
|
cars.last.name.should eq "Ford"
|
120
120
|
end
|
121
121
|
end
|
122
|
-
|
123
|
-
describe "with a single object which has properties which are undefined" do
|
124
|
-
let(:new_car) { VCR.use_cassette('cars') { Car.get_json "http://cars.com/new_model" } }
|
125
|
-
|
126
|
-
it "should not raise an exception" do
|
127
|
-
expect {
|
128
|
-
new_car
|
129
|
-
}.to_not raise_error
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'should define the missing property on the fly' do
|
133
|
-
new_car.shiney.should eq true
|
134
|
-
end
|
135
|
-
end
|
136
122
|
end
|
137
123
|
|
138
124
|
describe "setting errors from a hash" do
|
metadata
CHANGED
@@ -1,113 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien Timewell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '4.0'
|
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
|
-
version: '0'
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '4.0'
|
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
|
-
version: '0'
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: typhoeus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.6'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hashie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
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: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.14'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.14'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.9'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: vcr
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - '
|
101
|
+
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.8.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - '
|
108
|
+
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.8.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/api_model/class_methods.rb
|
146
146
|
- lib/api_model/configuration.rb
|
147
147
|
- lib/api_model/core_extensions/hash.rb
|
148
|
+
- lib/api_model/core_extensions/hashie.rb
|
148
149
|
- lib/api_model/http_request.rb
|
149
150
|
- lib/api_model/initializer.rb
|
150
151
|
- lib/api_model/instance_methods.rb
|
@@ -167,7 +168,8 @@ files:
|
|
167
168
|
- spec/support/mock_models/multiple_hosts.rb
|
168
169
|
- spec/support/mock_models/user.rb
|
169
170
|
homepage: https://github.com/iZettle/api-model
|
170
|
-
licenses:
|
171
|
+
licenses:
|
172
|
+
- MIT
|
171
173
|
metadata: {}
|
172
174
|
post_install_message:
|
173
175
|
rdoc_options: []
|
@@ -185,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
187
|
version: '0'
|
186
188
|
requirements: []
|
187
189
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.2.
|
190
|
+
rubygems_version: 2.2.2
|
189
191
|
signing_key:
|
190
192
|
specification_version: 4
|
191
193
|
summary: A simple way of interacting with rest APIs
|