restfully 1.1.1 → 1.2.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 +4 -4
- data/lib/restfully/collection.rb +1 -1
- data/lib/restfully/version.rb +1 -1
- data/spec/restfully/collection_spec.rb +15 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca61fc83984354556e89de09f82d055e733c6ba
|
4
|
+
data.tar.gz: 2a2f5d74abfb76c821a713f3132ea43148a246de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35fd912e58958d7f1f1fd92c8d3656905cf3ce2d54a13b092e9e4154093ccff25d45e018969c28b75a5ccf73fe1b0bda16ff33e67063c141df008b3416c6bac7
|
7
|
+
data.tar.gz: e530fb0a659237c0b1bbae2fe1bbea043987f1629214f8f6054ebf8188459bfbf6090bb24c5b2aa46ef28ed65e7018e45fb77a7f1c895f4aa276ab1dcecea8f2
|
data/lib/restfully/collection.rb
CHANGED
@@ -18,7 +18,7 @@ module Restfully
|
|
18
18
|
def find_by_uid(symbol)
|
19
19
|
direct_uri = media_type.direct_fetch_uri(symbol)
|
20
20
|
# Attempt to make a direct fetch if possible (in case of large collections)
|
21
|
-
found = session.get(direct_uri) if direct_uri
|
21
|
+
found = session.get(direct_uri,{:head => {'Accept' => media_type.class.default_type}}) if direct_uri
|
22
22
|
# Fall back to collection traversal if direct fetch was not possible, or was not found
|
23
23
|
found = find{ |i| i.media_type.represents?(symbol) } if found.nil?
|
24
24
|
found.expand unless found.nil?
|
data/lib/restfully/version.rb
CHANGED
@@ -99,5 +99,19 @@ describe Restfully::Collection do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
describe "direct_fetch_usage" do
|
103
|
+
it "should attempt a direct_fetch using default type for media_type" do
|
104
|
+
@response.media_type.class.should == Restfully::MediaType::Grid5000
|
105
|
+
direct_uri="https://api.project.net/fake_stub"
|
106
|
+
direct_uri=@response.media_type.should_receive(:direct_fetch_uri).and_return(direct_uri)
|
107
|
+
Restfully::MediaType::Grid5000.should_receive(:default_type).and_return('test/fake+json')
|
108
|
+
stub_request(:get, "https://api.project.net/fake_stub").
|
109
|
+
with(:headers => {'Accept'=>'test/fake+json'}).
|
110
|
+
to_return(:status => 200,
|
111
|
+
:body => fixture('grid5000-rennes-job.json'),
|
112
|
+
:headers => {'Content-Type' => 'application/json'})
|
113
|
+
@resource.load
|
114
|
+
@resource[:'3'].should_not be_nil
|
115
|
+
end
|
116
|
+
end
|
103
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
329
|
version: '1.3'
|
330
330
|
requirements: []
|
331
331
|
rubyforge_project:
|
332
|
-
rubygems_version: 2.
|
332
|
+
rubygems_version: 2.5.1
|
333
333
|
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Consume RESTful APIs effortlessly
|
@@ -358,4 +358,3 @@ test_files:
|
|
358
358
|
- spec/restfully/media_type/application_vnd_bonfire_xml_spec.rb
|
359
359
|
- spec/restfully/link_spec.rb
|
360
360
|
- spec/restfully/session_spec.rb
|
361
|
-
has_rdoc:
|