restfully 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73515709927905b0a84eb46b987fab13a065438c
4
- data.tar.gz: 0c4c6e259ee9fa9f60420c767c7b8e19fe0c02db
3
+ metadata.gz: fca61fc83984354556e89de09f82d055e733c6ba
4
+ data.tar.gz: 2a2f5d74abfb76c821a713f3132ea43148a246de
5
5
  SHA512:
6
- metadata.gz: a6a1937030367bea1598ab4d0a53deb6e67e3122e5a5519b1d65c2b46ded7c19534a5b88c2e395b6e18e2ad6840bb8277babc8c5e3216ce317bd1941755aa756
7
- data.tar.gz: 08ea839b73c3e99f2b4d46c1b6720bc8bb8c757f9ce6c0c5fdd3a71a4fe1425e5b2507b0bbae65b85df2f4ac10fc63235e4619e6da9724f391c852b48edd7b0f
6
+ metadata.gz: 35fd912e58958d7f1f1fd92c8d3656905cf3ce2d54a13b092e9e4154093ccff25d45e018969c28b75a5ccf73fe1b0bda16ff33e67063c141df008b3416c6bac7
7
+ data.tar.gz: e530fb0a659237c0b1bbae2fe1bbea043987f1629214f8f6054ebf8188459bfbf6090bb24c5b2aa46ef28ed65e7018e45fb77a7f1c895f4aa276ab1dcecea8f2
@@ -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?
@@ -1,3 +1,3 @@
1
1
  module Restfully
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -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.1.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: 2015-06-11 00:00:00.000000000 Z
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.2.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: