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 +4 -4
- data/lib/ocean/api_remote_resource.rb +25 -9
- data/lib/ocean/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4618f9060b2df689ac48bed4bb607fd7e1c939b
|
4
|
+
data.tar.gz: 58a774e1cdca3c245e5d804170ab90e5ceee1319
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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