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 +4 -4
- data/README.md +1 -1
- data/lib/flexirest/base.rb +6 -6
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/base_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96d88b8be9d4f041d00c6da07228fb7dccc57092
|
4
|
+
data.tar.gz: 9b7314b8f2685ccc77f0de3093558bd49abc0bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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):
|
data/lib/flexirest/base.rb
CHANGED
@@ -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,
|
70
|
-
prepare_direct_request(request, method,
|
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,
|
74
|
-
prepare_direct_request(request, method, plain:true
|
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,
|
78
|
-
Flexirest::LazyLoader.new(prepare_direct_request(request, method,
|
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={})
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/base_spec.rb
CHANGED
@@ -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'
|
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.
|
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-
|
11
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|