flexirest 1.5.3 → 1.5.4

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: 499dd67a747959e769fab4e11aa7ee9eed6599b8
4
- data.tar.gz: 632be3df00eae719a6238d312d29c1dae4bef214
3
+ metadata.gz: 96d88b8be9d4f041d00c6da07228fb7dccc57092
4
+ data.tar.gz: 9b7314b8f2685ccc77f0de3093558bd49abc0bec
5
5
  SHA512:
6
- metadata.gz: 63f8eaaa04a862b48151effef441782ac3917cb71417834cb4cfcfbe84586907c7f45c47b33846a7a22a5bdf1584d68124a6ac6a5c2fc5becfc9a00da37f622b
7
- data.tar.gz: 38c540be4278f892a9bc2461c2c7b0e12b9f3074c8b90202be880aed496056c6ad258475b713ae8a86877787814f45e739739d659deed3fcb899adb00d00de9b
6
+ metadata.gz: 7b863f36580dddf3415740f2f2ca7cb8ded5371404e9384996d8c11a18dea26dfd76674f3972eee2d6c92aa2b1f5d159217d5d3c56c902b3dc219103b7388789
7
+ data.tar.gz: 30dd6fe0eaa1e9b4c63f9f7802a6b1f1b98c060231bf246e5993710f58f19c000ee05af5b6111e4a5a32b2cca68e84ed0452596cd78af1452ae5349fd5f60b7c
data/README.md CHANGED
@@ -796,7 +796,7 @@ Person._request('http://api.example.com/v1/people', :post, {id:1234,name:"John"}
796
796
  When you need to specify custom headers (for example for authentication) you can do this with a fourth option to the `_request` method. If you are using the default paramaters you'll need to specify them. For example:
797
797
 
798
798
  ```ruby
799
- Person._request("http://api.example.com/v1/people", :get, {}, {"X-Something": "foo/bar"})
799
+ Person._request("http://api.example.com/v1/people", :get, {}, {headers:{"X-Something": "foo/bar"}})
800
800
  ```
801
801
 
802
802
  If you want to use a lazy loaded request instead (so it will create an object that will only call the API if you use it), you can use `_lazy_request` instead of `_request`. If you want you can create a construct that creates and object that lazy loads itself from a given method (rather than a URL):
@@ -66,16 +66,16 @@ module Flexirest
66
66
  @attributes[:errors] || (_errors != {} ? _errors : nil)
67
67
  end
68
68
 
69
- def self._request(request, method = :get, params = nil, headers = {})
70
- prepare_direct_request(request, method, headers: headers).call(params)
69
+ def self._request(request, method = :get, params = nil, options = {})
70
+ prepare_direct_request(request, method, options).call(params)
71
71
  end
72
72
 
73
- def self._plain_request(request, method = :get, params = nil, headers = {})
74
- prepare_direct_request(request, method, plain:true, headers: headers).call(params)
73
+ def self._plain_request(request, method = :get, params = nil, options = {})
74
+ prepare_direct_request(request, method, options.merge(plain:true)).call(params)
75
75
  end
76
76
 
77
- def self._lazy_request(request, method = :get, params = nil, headers = {})
78
- Flexirest::LazyLoader.new(prepare_direct_request(request, method, headers: headers), params)
77
+ def self._lazy_request(request, method = :get, params = nil, options = {})
78
+ Flexirest::LazyLoader.new(prepare_direct_request(request, method, options), params)
79
79
  end
80
80
 
81
81
  def self.prepare_direct_request(request, method = :get, options={})
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
@@ -313,9 +313,9 @@ describe Flexirest::Base do
313
313
 
314
314
  it "passes headers" do
315
315
  stub_request(:get, "http://api.example.com/v1").
316
- with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'X-Something'=>'foo/bar', 'User-Agent'=>'Flexirest/1.5.2'}).
316
+ with(headers: {'Accept'=>'application/hal+json, application/json;q=0.5', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection'=>'Keep-Alive', 'Content-Type'=>'application/x-www-form-urlencoded', 'X-Something'=>'foo/bar', 'User-Agent'=>/Flexirest\//}).
317
317
  to_return(status: 200, body: "", headers: {})
318
- EmptyExample._request("http://api.example.com/v1", :get, {}, {"X-Something": "foo/bar"})
318
+ EmptyExample._request("http://api.example.com/v1", :get, {}, {headers: {"X-Something": "foo/bar"}})
319
319
  end
320
320
 
321
321
  it "runs callbacks as usual" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler