namely 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -24
- data/lib/namely.rb +2 -101
- data/lib/namely/authenticator.rb +61 -14
- data/lib/namely/collection.rb +78 -0
- data/lib/namely/connection.rb +90 -0
- data/lib/namely/exceptions.rb +0 -3
- data/lib/namely/model.rb +78 -0
- data/lib/namely/resource_gateway.rb +7 -2
- data/lib/namely/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/{country_head.yml → countries_head.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{country_head_missing.yml → countries_head_missing.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{country_index.yml → countries_index.yml} +6 -6
- data/spec/fixtures/vcr_cassettes/{country_show.yml → countries_show.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{country_show_missing.yml → countries_show_missing.yml} +7 -7
- data/spec/fixtures/vcr_cassettes/{currencytype_index.yml → currency_types_index.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/current_user.yml +57 -0
- data/spec/fixtures/vcr_cassettes/{event_head.yml → events_head.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{event_head_missing.yml → events_head_missing.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/events_index.yml +89 -0
- data/spec/fixtures/vcr_cassettes/{event_show.yml → events_show.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/{event_show_missing.yml → events_show_missing.yml} +6 -6
- data/spec/fixtures/vcr_cassettes/fields_index.yml +48 -0
- data/spec/fixtures/vcr_cassettes/{jobtier_index.yml → job_tiers_index.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/{field_index.yml → profiles/fields_index.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/profiles_create.yml +85 -0
- data/spec/fixtures/vcr_cassettes/{profile_create_failed.yml → profiles_create_failed.yml} +9 -10
- data/spec/fixtures/vcr_cassettes/{profile_head.yml → profiles_head.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{profile_head_missing.yml → profiles_head_missing.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/profiles_index.yml +981 -0
- data/spec/fixtures/vcr_cassettes/{profile_show.yml → profiles_show.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{profile_show_missing.yml → profiles_show_missing.yml} +7 -7
- data/spec/fixtures/vcr_cassettes/profiles_show_updated.yml +91 -0
- data/spec/fixtures/vcr_cassettes/profiles_update.yml +95 -0
- data/spec/fixtures/vcr_cassettes/profiles_update_revert.yml +95 -0
- data/spec/fixtures/vcr_cassettes/{report_head.yml → reports_head.yml} +4 -4
- data/spec/fixtures/vcr_cassettes/{report_head_missing.yml → reports_head_missing.yml} +5 -5
- data/spec/fixtures/vcr_cassettes/reports_show.yml +186 -0
- data/spec/fixtures/vcr_cassettes/{report_show_missing.yml → reports_show_missing.yml} +7 -7
- data/spec/fixtures/vcr_cassettes/token.yml +6 -6
- data/spec/namely/authenticator_spec.rb +36 -0
- data/spec/namely/connection_spec.rb +15 -0
- data/spec/namely/integration_spec.rb +94 -0
- data/spec/namely/resource_gateway_spec.rb +18 -10
- data/spec/shared_examples/a_resource_with_a_create_action.rb +24 -0
- data/spec/shared_examples/a_resource_with_a_show_action.rb +38 -0
- data/spec/shared_examples/a_resource_with_an_index_action.rb +15 -0
- data/spec/shared_examples/{a_model_with_an_update_action.rb → a_resource_with_an_update_action.rb} +10 -9
- data/spec/spec_helper.rb +0 -17
- metadata +75 -88
- data/lib/namely/country.rb +0 -9
- data/lib/namely/currency_type.rb +0 -9
- data/lib/namely/event.rb +0 -9
- data/lib/namely/field.rb +0 -9
- data/lib/namely/job_tier.rb +0 -9
- data/lib/namely/profile.rb +0 -13
- data/lib/namely/report.rb +0 -9
- data/lib/namely/restful_model.rb +0 -150
- data/spec/fixtures/vcr_cassettes/event_index.yml +0 -88
- data/spec/fixtures/vcr_cassettes/profile_create.yml +0 -85
- data/spec/fixtures/vcr_cassettes/profile_index.yml +0 -979
- data/spec/fixtures/vcr_cassettes/profile_show_updated.yml +0 -91
- data/spec/fixtures/vcr_cassettes/profile_update.yml +0 -95
- data/spec/fixtures/vcr_cassettes/profile_update_revert.yml +0 -95
- data/spec/fixtures/vcr_cassettes/report_show.yml +0 -185
- data/spec/namely/configuration_spec.rb +0 -33
- data/spec/namely/country_spec.rb +0 -11
- data/spec/namely/currency_type_spec.rb +0 -5
- data/spec/namely/event_spec.rb +0 -11
- data/spec/namely/field_spec.rb +0 -5
- data/spec/namely/job_tier_spec.rb +0 -5
- data/spec/namely/profile_spec.rb +0 -25
- data/spec/namely/report_spec.rb +0 -8
- data/spec/shared_examples/a_model_with_a_create_action.rb +0 -24
- data/spec/shared_examples/a_model_with_a_show_action.rb +0 -38
- data/spec/shared_examples/a_model_with_an_index_action.rb +0 -17
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Schwartz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backports
|
@@ -153,61 +153,52 @@ files:
|
|
153
153
|
- Rakefile
|
154
154
|
- lib/namely.rb
|
155
155
|
- lib/namely/authenticator.rb
|
156
|
-
- lib/namely/
|
157
|
-
- lib/namely/
|
158
|
-
- lib/namely/event.rb
|
156
|
+
- lib/namely/collection.rb
|
157
|
+
- lib/namely/connection.rb
|
159
158
|
- lib/namely/exceptions.rb
|
160
|
-
- lib/namely/
|
161
|
-
- lib/namely/job_tier.rb
|
162
|
-
- lib/namely/profile.rb
|
163
|
-
- lib/namely/report.rb
|
159
|
+
- lib/namely/model.rb
|
164
160
|
- lib/namely/resource_gateway.rb
|
165
|
-
- lib/namely/restful_model.rb
|
166
161
|
- lib/namely/version.rb
|
167
162
|
- namely.gemspec
|
168
|
-
- spec/fixtures/vcr_cassettes/
|
169
|
-
- spec/fixtures/vcr_cassettes/
|
170
|
-
- spec/fixtures/vcr_cassettes/
|
171
|
-
- spec/fixtures/vcr_cassettes/
|
172
|
-
- spec/fixtures/vcr_cassettes/
|
173
|
-
- spec/fixtures/vcr_cassettes/
|
174
|
-
- spec/fixtures/vcr_cassettes/
|
175
|
-
- spec/fixtures/vcr_cassettes/
|
176
|
-
- spec/fixtures/vcr_cassettes/
|
177
|
-
- spec/fixtures/vcr_cassettes/
|
178
|
-
- spec/fixtures/vcr_cassettes/
|
179
|
-
- spec/fixtures/vcr_cassettes/
|
180
|
-
- spec/fixtures/vcr_cassettes/
|
181
|
-
- spec/fixtures/vcr_cassettes/
|
182
|
-
- spec/fixtures/vcr_cassettes/
|
183
|
-
- spec/fixtures/vcr_cassettes/
|
184
|
-
- spec/fixtures/vcr_cassettes/
|
185
|
-
- spec/fixtures/vcr_cassettes/
|
186
|
-
- spec/fixtures/vcr_cassettes/
|
187
|
-
- spec/fixtures/vcr_cassettes/
|
188
|
-
- spec/fixtures/vcr_cassettes/
|
189
|
-
- spec/fixtures/vcr_cassettes/
|
190
|
-
- spec/fixtures/vcr_cassettes/
|
191
|
-
- spec/fixtures/vcr_cassettes/
|
192
|
-
- spec/fixtures/vcr_cassettes/
|
193
|
-
- spec/fixtures/vcr_cassettes/
|
194
|
-
- spec/fixtures/vcr_cassettes/
|
163
|
+
- spec/fixtures/vcr_cassettes/countries_head.yml
|
164
|
+
- spec/fixtures/vcr_cassettes/countries_head_missing.yml
|
165
|
+
- spec/fixtures/vcr_cassettes/countries_index.yml
|
166
|
+
- spec/fixtures/vcr_cassettes/countries_show.yml
|
167
|
+
- spec/fixtures/vcr_cassettes/countries_show_missing.yml
|
168
|
+
- spec/fixtures/vcr_cassettes/currency_types_index.yml
|
169
|
+
- spec/fixtures/vcr_cassettes/current_user.yml
|
170
|
+
- spec/fixtures/vcr_cassettes/events_head.yml
|
171
|
+
- spec/fixtures/vcr_cassettes/events_head_missing.yml
|
172
|
+
- spec/fixtures/vcr_cassettes/events_index.yml
|
173
|
+
- spec/fixtures/vcr_cassettes/events_show.yml
|
174
|
+
- spec/fixtures/vcr_cassettes/events_show_missing.yml
|
175
|
+
- spec/fixtures/vcr_cassettes/fields_index.yml
|
176
|
+
- spec/fixtures/vcr_cassettes/job_tiers_index.yml
|
177
|
+
- spec/fixtures/vcr_cassettes/profiles/fields_index.yml
|
178
|
+
- spec/fixtures/vcr_cassettes/profiles_create.yml
|
179
|
+
- spec/fixtures/vcr_cassettes/profiles_create_failed.yml
|
180
|
+
- spec/fixtures/vcr_cassettes/profiles_head.yml
|
181
|
+
- spec/fixtures/vcr_cassettes/profiles_head_missing.yml
|
182
|
+
- spec/fixtures/vcr_cassettes/profiles_index.yml
|
183
|
+
- spec/fixtures/vcr_cassettes/profiles_show.yml
|
184
|
+
- spec/fixtures/vcr_cassettes/profiles_show_missing.yml
|
185
|
+
- spec/fixtures/vcr_cassettes/profiles_show_updated.yml
|
186
|
+
- spec/fixtures/vcr_cassettes/profiles_update.yml
|
187
|
+
- spec/fixtures/vcr_cassettes/profiles_update_revert.yml
|
188
|
+
- spec/fixtures/vcr_cassettes/reports_head.yml
|
189
|
+
- spec/fixtures/vcr_cassettes/reports_head_missing.yml
|
190
|
+
- spec/fixtures/vcr_cassettes/reports_show.yml
|
191
|
+
- spec/fixtures/vcr_cassettes/reports_show_missing.yml
|
195
192
|
- spec/fixtures/vcr_cassettes/token.yml
|
196
193
|
- spec/fixtures/vcr_cassettes/token_refresh.yml
|
197
194
|
- spec/namely/authenticator_spec.rb
|
198
|
-
- spec/namely/
|
199
|
-
- spec/namely/
|
200
|
-
- spec/namely/currency_type_spec.rb
|
201
|
-
- spec/namely/event_spec.rb
|
202
|
-
- spec/namely/field_spec.rb
|
203
|
-
- spec/namely/job_tier_spec.rb
|
204
|
-
- spec/namely/profile_spec.rb
|
205
|
-
- spec/namely/report_spec.rb
|
195
|
+
- spec/namely/connection_spec.rb
|
196
|
+
- spec/namely/integration_spec.rb
|
206
197
|
- spec/namely/resource_gateway_spec.rb
|
207
|
-
- spec/shared_examples/
|
208
|
-
- spec/shared_examples/
|
209
|
-
- spec/shared_examples/
|
210
|
-
- spec/shared_examples/
|
198
|
+
- spec/shared_examples/a_resource_with_a_create_action.rb
|
199
|
+
- spec/shared_examples/a_resource_with_a_show_action.rb
|
200
|
+
- spec/shared_examples/a_resource_with_an_index_action.rb
|
201
|
+
- spec/shared_examples/a_resource_with_an_update_action.rb
|
211
202
|
- spec/spec_helper.rb
|
212
203
|
homepage: https://github.com/namely/ruby-client
|
213
204
|
licenses:
|
@@ -234,47 +225,43 @@ signing_key:
|
|
234
225
|
specification_version: 4
|
235
226
|
summary: Wraps the Namely HTTP API in lovely Ruby.
|
236
227
|
test_files:
|
237
|
-
- spec/fixtures/vcr_cassettes/
|
238
|
-
- spec/fixtures/vcr_cassettes/
|
239
|
-
- spec/fixtures/vcr_cassettes/
|
240
|
-
- spec/fixtures/vcr_cassettes/
|
241
|
-
- spec/fixtures/vcr_cassettes/
|
242
|
-
- spec/fixtures/vcr_cassettes/
|
243
|
-
- spec/fixtures/vcr_cassettes/
|
244
|
-
- spec/fixtures/vcr_cassettes/
|
245
|
-
- spec/fixtures/vcr_cassettes/
|
246
|
-
- spec/fixtures/vcr_cassettes/
|
247
|
-
- spec/fixtures/vcr_cassettes/
|
248
|
-
- spec/fixtures/vcr_cassettes/
|
249
|
-
- spec/fixtures/vcr_cassettes/
|
250
|
-
- spec/fixtures/vcr_cassettes/
|
251
|
-
- spec/fixtures/vcr_cassettes/
|
252
|
-
- spec/fixtures/vcr_cassettes/
|
253
|
-
- spec/fixtures/vcr_cassettes/
|
254
|
-
- spec/fixtures/vcr_cassettes/
|
255
|
-
- spec/fixtures/vcr_cassettes/
|
256
|
-
- spec/fixtures/vcr_cassettes/
|
257
|
-
- spec/fixtures/vcr_cassettes/
|
258
|
-
- spec/fixtures/vcr_cassettes/
|
259
|
-
- spec/fixtures/vcr_cassettes/
|
260
|
-
- spec/fixtures/vcr_cassettes/
|
261
|
-
- spec/fixtures/vcr_cassettes/
|
262
|
-
- spec/fixtures/vcr_cassettes/
|
263
|
-
- spec/fixtures/vcr_cassettes/
|
228
|
+
- spec/fixtures/vcr_cassettes/countries_head.yml
|
229
|
+
- spec/fixtures/vcr_cassettes/countries_head_missing.yml
|
230
|
+
- spec/fixtures/vcr_cassettes/countries_index.yml
|
231
|
+
- spec/fixtures/vcr_cassettes/countries_show.yml
|
232
|
+
- spec/fixtures/vcr_cassettes/countries_show_missing.yml
|
233
|
+
- spec/fixtures/vcr_cassettes/currency_types_index.yml
|
234
|
+
- spec/fixtures/vcr_cassettes/current_user.yml
|
235
|
+
- spec/fixtures/vcr_cassettes/events_head.yml
|
236
|
+
- spec/fixtures/vcr_cassettes/events_head_missing.yml
|
237
|
+
- spec/fixtures/vcr_cassettes/events_index.yml
|
238
|
+
- spec/fixtures/vcr_cassettes/events_show.yml
|
239
|
+
- spec/fixtures/vcr_cassettes/events_show_missing.yml
|
240
|
+
- spec/fixtures/vcr_cassettes/fields_index.yml
|
241
|
+
- spec/fixtures/vcr_cassettes/job_tiers_index.yml
|
242
|
+
- spec/fixtures/vcr_cassettes/profiles/fields_index.yml
|
243
|
+
- spec/fixtures/vcr_cassettes/profiles_create.yml
|
244
|
+
- spec/fixtures/vcr_cassettes/profiles_create_failed.yml
|
245
|
+
- spec/fixtures/vcr_cassettes/profiles_head.yml
|
246
|
+
- spec/fixtures/vcr_cassettes/profiles_head_missing.yml
|
247
|
+
- spec/fixtures/vcr_cassettes/profiles_index.yml
|
248
|
+
- spec/fixtures/vcr_cassettes/profiles_show.yml
|
249
|
+
- spec/fixtures/vcr_cassettes/profiles_show_missing.yml
|
250
|
+
- spec/fixtures/vcr_cassettes/profiles_show_updated.yml
|
251
|
+
- spec/fixtures/vcr_cassettes/profiles_update.yml
|
252
|
+
- spec/fixtures/vcr_cassettes/profiles_update_revert.yml
|
253
|
+
- spec/fixtures/vcr_cassettes/reports_head.yml
|
254
|
+
- spec/fixtures/vcr_cassettes/reports_head_missing.yml
|
255
|
+
- spec/fixtures/vcr_cassettes/reports_show.yml
|
256
|
+
- spec/fixtures/vcr_cassettes/reports_show_missing.yml
|
264
257
|
- spec/fixtures/vcr_cassettes/token.yml
|
265
258
|
- spec/fixtures/vcr_cassettes/token_refresh.yml
|
266
259
|
- spec/namely/authenticator_spec.rb
|
267
|
-
- spec/namely/
|
268
|
-
- spec/namely/
|
269
|
-
- spec/namely/currency_type_spec.rb
|
270
|
-
- spec/namely/event_spec.rb
|
271
|
-
- spec/namely/field_spec.rb
|
272
|
-
- spec/namely/job_tier_spec.rb
|
273
|
-
- spec/namely/profile_spec.rb
|
274
|
-
- spec/namely/report_spec.rb
|
260
|
+
- spec/namely/connection_spec.rb
|
261
|
+
- spec/namely/integration_spec.rb
|
275
262
|
- spec/namely/resource_gateway_spec.rb
|
276
|
-
- spec/shared_examples/
|
277
|
-
- spec/shared_examples/
|
278
|
-
- spec/shared_examples/
|
279
|
-
- spec/shared_examples/
|
263
|
+
- spec/shared_examples/a_resource_with_a_create_action.rb
|
264
|
+
- spec/shared_examples/a_resource_with_a_show_action.rb
|
265
|
+
- spec/shared_examples/a_resource_with_an_index_action.rb
|
266
|
+
- spec/shared_examples/a_resource_with_an_update_action.rb
|
280
267
|
- spec/spec_helper.rb
|
data/lib/namely/country.rb
DELETED
data/lib/namely/currency_type.rb
DELETED
data/lib/namely/event.rb
DELETED
data/lib/namely/field.rb
DELETED
data/lib/namely/job_tier.rb
DELETED
data/lib/namely/profile.rb
DELETED
data/lib/namely/report.rb
DELETED
data/lib/namely/restful_model.rb
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
module Namely
|
2
|
-
# @abstract
|
3
|
-
class RestfulModel < OpenStruct
|
4
|
-
# Fetch a model from the server by its ID.
|
5
|
-
#
|
6
|
-
# @param [#to_s] id
|
7
|
-
#
|
8
|
-
# @raise [NoSuchModelError] if the model wasn't found.
|
9
|
-
#
|
10
|
-
# @return [RestfulModel]
|
11
|
-
def self.find(id)
|
12
|
-
new(resource_gateway.json_show(id))
|
13
|
-
rescue RestClient::ResourceNotFound
|
14
|
-
raise NoSuchModelError, "Can't find a #{name} with id \"#{id}\""
|
15
|
-
end
|
16
|
-
|
17
|
-
# Returns true if a model with this ID exists, false otherwise.
|
18
|
-
#
|
19
|
-
# @param [#to_s] id
|
20
|
-
#
|
21
|
-
# @return [Boolean]
|
22
|
-
def self.exists?(id)
|
23
|
-
resource_gateway.show_head(id)
|
24
|
-
true
|
25
|
-
rescue RestClient::ResourceNotFound
|
26
|
-
false
|
27
|
-
end
|
28
|
-
|
29
|
-
# Return every instance of this model.
|
30
|
-
#
|
31
|
-
# A model might have quite a few instances. If this is the case,
|
32
|
-
# the query may take some time (several seconds) and the resulting
|
33
|
-
# array may be very large.
|
34
|
-
#
|
35
|
-
# @return [Array<RestfulModel>]
|
36
|
-
def self.all
|
37
|
-
resource_gateway.json_index.map { |model| new(model) }
|
38
|
-
end
|
39
|
-
|
40
|
-
# Create a new model on the server with the given attributes.
|
41
|
-
#
|
42
|
-
# @param [Hash] attributes the attributes of the model being created.
|
43
|
-
#
|
44
|
-
# @example
|
45
|
-
# Profile.create!(
|
46
|
-
# first_name: "Beardsly",
|
47
|
-
# last_name: "McDog",
|
48
|
-
# email: "beardsly@namely.com"
|
49
|
-
# )
|
50
|
-
#
|
51
|
-
# @return [RestfulModel] the created model.
|
52
|
-
def self.create!(attributes)
|
53
|
-
new(attributes).save!
|
54
|
-
end
|
55
|
-
|
56
|
-
# Update the attributes of this model. Assign the attributes
|
57
|
-
# according to the hash, then persist those changes on the server.
|
58
|
-
#
|
59
|
-
# @param [Hash] attributes the attributes to be updated on the model.
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# my_profile.update(
|
63
|
-
# middle_name: "Ludwig"
|
64
|
-
# )
|
65
|
-
#
|
66
|
-
# @raise [FailedRequestError] if the request failed for any reason.
|
67
|
-
#
|
68
|
-
# @return [RestfulModel] the updated model.
|
69
|
-
def update(attributes)
|
70
|
-
attributes.each do |key, value|
|
71
|
-
self[key] = value
|
72
|
-
end
|
73
|
-
|
74
|
-
persist_model_changes(attributes)
|
75
|
-
|
76
|
-
self
|
77
|
-
end
|
78
|
-
|
79
|
-
# Try to persist the current object, either by creating a new
|
80
|
-
# object on the server or by updating an existing one. Raise an
|
81
|
-
# error if the object can't be saved.
|
82
|
-
#
|
83
|
-
# @raise [FailedRequestError] if the request failed for any reason.
|
84
|
-
#
|
85
|
-
# @return [RestfulModel] the model itself, if saving succeeded.
|
86
|
-
def save!
|
87
|
-
if persisted?
|
88
|
-
update(to_h)
|
89
|
-
else
|
90
|
-
self.id = resource_gateway.create(to_h)
|
91
|
-
end
|
92
|
-
self
|
93
|
-
rescue RestClient::Exception => e
|
94
|
-
raise FailedRequestError, e.message
|
95
|
-
end
|
96
|
-
|
97
|
-
# Return true if the model exists (in some state) on the server.
|
98
|
-
#
|
99
|
-
# @return [Boolean]
|
100
|
-
def persisted?
|
101
|
-
!!id
|
102
|
-
end
|
103
|
-
|
104
|
-
private
|
105
|
-
|
106
|
-
def resource_gateway
|
107
|
-
self.class.resource_gateway
|
108
|
-
end
|
109
|
-
|
110
|
-
def self.resource_gateway
|
111
|
-
Namely.resource_gateway(resource_name, endpoint)
|
112
|
-
end
|
113
|
-
|
114
|
-
def resource_gateway
|
115
|
-
self.class.resource_gateway
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.endpoint
|
119
|
-
raise(
|
120
|
-
NotImplementedError,
|
121
|
-
"Namely::Model subclasses must define an `.endpoint` "\
|
122
|
-
"class method that returns their path in the API."
|
123
|
-
)
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.resource_name
|
127
|
-
endpoint.split("/").last
|
128
|
-
end
|
129
|
-
|
130
|
-
# The update action for certain models requires populating certain
|
131
|
-
# fields. Without populating these fields, an update with
|
132
|
-
# fail. This method is intended to be overwritten by subclasses
|
133
|
-
# with required keys.
|
134
|
-
#
|
135
|
-
# @return [Array<Symbol>]
|
136
|
-
def required_keys_for_update
|
137
|
-
[]
|
138
|
-
end
|
139
|
-
|
140
|
-
def required_attributes_for_update
|
141
|
-
to_h.select { |key, _| required_keys_for_update.include?(key) }
|
142
|
-
end
|
143
|
-
|
144
|
-
def persist_model_changes(changed_attributes)
|
145
|
-
resource_gateway.update(id, changed_attributes.merge(required_attributes_for_update))
|
146
|
-
rescue RestClient::Exception => e
|
147
|
-
raise FailedRequestError, e.message
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://<TEST_SUBDOMAIN>.namely.com/api/v1/events?access_token=<TEST_ACCESS_TOKEN>&limit=all
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/json
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip, deflate
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Cache-Control:
|
22
|
-
- max-age=0, private, must-revalidate
|
23
|
-
Content-Encoding:
|
24
|
-
- gzip
|
25
|
-
Content-Type:
|
26
|
-
- application/json; charset=utf-8
|
27
|
-
Date:
|
28
|
-
- Tue, 04 Nov 2014 16:34:37 GMT
|
29
|
-
Server:
|
30
|
-
- nginx
|
31
|
-
Status:
|
32
|
-
- 200 OK
|
33
|
-
Strict-Transport-Security:
|
34
|
-
- max-age=31536000
|
35
|
-
- max-age=31536000; includeSubDomains;
|
36
|
-
Vary:
|
37
|
-
- Accept-Encoding
|
38
|
-
X-Rack-Cache:
|
39
|
-
- miss
|
40
|
-
X-Request-Id:
|
41
|
-
- 5633b619-a52c-44be-9128-c136d0b907a1
|
42
|
-
X-Runtime:
|
43
|
-
- '0.090776'
|
44
|
-
Content-Length:
|
45
|
-
- '1569'
|
46
|
-
Connection:
|
47
|
-
- keep-alive
|
48
|
-
body:
|
49
|
-
encoding: ASCII-8BIT
|
50
|
-
string: !binary |-
|
51
|
-
H4sIAAAAAAAAA9VZ224bNxD9FUEvfQkT3i9+a5GiQIqgRa9Ag8IYkkNHjbQr
|
52
|
-
rNZOhcD/3llbvlQWmmkaAeqLIVM8u2fODmfOrD7M8Qq7cTM/e/Nhvqjzs3lI
|
53
|
-
0EzNWmDITtgERYBvUuhkfTAQolEwfzZ/O2Cj3S9u4S+YqHG7RkINWAh1DsOw
|
54
|
-
uIIlrZcBYcR6DuP8TFnllLJeS1rvu5F2zs+6y+WSbjqulud7a1uEYUNAWl+t
|
55
|
-
odverV9ucFpa3UY3DpdIl4Pubm1+1mC52a1V3IxDv73btlx07wjzYb4e+rZY
|
56
|
-
TowlKp+VNqKUaoRFK0VCqALA+mghqabbFMf9Dd/8/mx+i53oXF8/28mr0NJm
|
57
|
-
b0VMzgsbQiShihLgdFLVqYogn8rLRO3kha5bXOGwgWF7QFuZlLfxE7VVn1vY
|
58
|
-
6MAldCBUaEVYMEaAbE5AU7pVDCkGyxI262i9MVGUqKKwORmRPETRMEOC1HTI
|
59
|
-
B/KWifofCiu1DhEUCFsa0h8ZRI6AIitQIXqbnS8sYaFlk401QnmdhVUYKfWd
|
60
|
-
FFLZCilICZifCstE7YTNi2F8W+GAqjbqGNUplYLgDMgIXvhkqrAeSVhDyeOq
|
61
|
-
A9ukMyUrlrBap2p9NiLLRDUzRKqZoUiRm9HV5mKcck+FZaKYlZbw2kl3QvI2
|
62
|
-
4mNj8yIkQwUhUyeJaKswMsToTYktBZa86FwwPkVhkrFUWXITKZUmXKAWpX2l
|
63
|
-
0NNTeZkotrw+RnNK2VsaeBO0E9JqKWw0TtD5oipRXXJI9TYDr966E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