ocean-rails 3.7.4 → 3.7.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 488ffb9752c36dd3c3fc31c800133a06800c9742
4
- data.tar.gz: ade7530bafe37195a1d69ac75d110c28033fd766
3
+ metadata.gz: b4618f9060b2df689ac48bed4bb607fd7e1c939b
4
+ data.tar.gz: 58a774e1cdca3c245e5d804170ab90e5ceee1319
5
5
  SHA512:
6
- metadata.gz: ada19f7671f2f004ecbb82fc9b3cd7f128b59a8c6a26579eb6c0d1d7cabe468ea6ecfc5b8d868efdaebc0193c699379ee032d6fa57515e8b5cc5b0ead4ad47b3
7
- data.tar.gz: 21e2bfc0a296101710653979d51596ece14fc42b8399c69ced2e3dc126c0cd1a16057c20b15878da9e0a26dfd31d696eadb7c3a9939f15ccb962621adcc852d4
6
+ metadata.gz: 0d14cbed87fa91c0d77ce24009b25d10fb07d463609f9afc40486a6d76ff7ad2726769dcbe80ebda538cd94c09ed771c690279b0488a0220774357dcc5d1d6df
7
+ data.tar.gz: 074db59dc54f1773f89b0068eceb0b1789aa3fba4a144b7c16ef73b809f27c9a6ce9a7f27cb05fc3231d5609a9b37d0b0d3d0ee5d31e081cfee630504b4cb0b7
@@ -185,7 +185,7 @@ class Api
185
185
  class DeleteFailed < StandardError; end
186
186
  class UnparseableJson < StandardError; end
187
187
  class JsonIsNoResource < StandardError; end
188
-
188
+ class HyperlinkMissing < StandardError; end
189
189
 
190
190
  def self.get!(*args)
191
191
  _retrieve new(*args)
@@ -204,7 +204,9 @@ class Api
204
204
  if !hlink || hlink == 'self'
205
205
  self
206
206
  else
207
- RemoteResource.get!(hyperlink[hlink]['href'])
207
+ hl_data = hyperlink[hlink]
208
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
209
+ RemoteResource.get!(hl_data['href'])
208
210
  end
209
211
  end
210
212
 
@@ -214,7 +216,9 @@ class Api
214
216
  if !hlink || hlink == 'self'
215
217
  self
216
218
  else
217
- RemoteResource.get(hyperlink[hlink]['href'])
219
+ hl_data = hyperlink[hlink]
220
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
221
+ RemoteResource.get(hl_data['href'])
218
222
  end
219
223
  end
220
224
 
@@ -226,7 +230,9 @@ class Api
226
230
  _modify(body)
227
231
  self
228
232
  else
229
- hl_res = RemoteResource.new(self.hyperlink[hlink]['href'])
233
+ hl_data = hyperlink[hlink]
234
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
235
+ hl_res = RemoteResource.new(hl_data['href'])
230
236
  hl_res.send :_modify, body
231
237
  hl_res
232
238
  end
@@ -239,7 +245,9 @@ class Api
239
245
  _modify(body) rescue nil
240
246
  self
241
247
  else
242
- hl_res = RemoteResource.new(self.hyperlink[hlink]['href'])
248
+ hl_data = hyperlink[hlink]
249
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
250
+ hl_res = RemoteResource.new(hl_data['href'])
243
251
  hl_res.send :_modify, body
244
252
  hl_res
245
253
  end
@@ -249,27 +257,35 @@ class Api
249
257
  def post!(hlink=nil, body: {})
250
258
  get!
251
259
  hlink = (hlink || 'self').to_s
252
- _create(hyperlink[hlink]['href'], body)
260
+ hl_data = hyperlink[hlink]
261
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
262
+ _create(hl_data['href'], body)
253
263
  end
254
264
 
255
265
  def post(hlink=nil, body: {})
256
266
  get
257
267
  hlink = (hlink || 'self').to_s
258
- _create(hyperlink[hlink]['href'], body) rescue nil
268
+ hl_data = hyperlink[hlink]
269
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
270
+ _create(hl_data['href'], body) rescue nil
259
271
  end
260
272
 
261
273
 
262
274
  def delete!(hlink=nil)
263
275
  get!
264
276
  hlink = (hlink || 'self').to_s
265
- _destroy(hyperlink[hlink]['href'])
277
+ hl_data = hyperlink[hlink]
278
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
279
+ _destroy(hl_data['href'])
266
280
  self
267
281
  end
268
282
 
269
283
  def delete(hlink=nil)
270
284
  get
271
285
  hlink = (hlink || 'self').to_s
272
- _destroy(hyperlink[hlink]['href']) rescue nil
286
+ hl_data = hyperlink[hlink]
287
+ raise HyperlinkMissing, "#{resource_type} has no #{hlink} hyperlink" unless hl_data
288
+ _destroy(hl_data['href']) rescue nil
273
289
  self
274
290
  end
275
291
 
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "3.7.4"
2
+ VERSION = "3.7.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.4
4
+ version: 3.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson