flexirest 1.3.16 → 1.3.17
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/CHANGELOG.md +6 -0
- data/lib/flexirest/request.rb +1 -1
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/connection_spec.rb +1 -1
- data/spec/lib/proxy_spec.rb +14 -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: d3f5b7fd58fca9e5b1af0e80cd566a98404033d4
|
4
|
+
data.tar.gz: 66f2a9a29930347f6e72452b12d2adff5ab18145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f55e90d6c57f50cb85b90f3acdd1981d8ff0bb206591ecf26f1d002c286cf71c4bc76d1b3d671c9f5a459d92ba3b12e6627e0c0fc2692a12c8b3e6e52ece67
|
7
|
+
data.tar.gz: 989344a2cece5f68cb99df45b2a4a0bb9372839be88c3853acf20d9b8710b813cfa26a7ed976176c450e6090dd204541ba5451f16319bbd09fa33fa49ba1b948
|
data/CHANGELOG.md
CHANGED
data/lib/flexirest/request.rb
CHANGED
@@ -315,7 +315,7 @@ module Flexirest
|
|
315
315
|
_, @base_url, @url = parts
|
316
316
|
end
|
317
317
|
base_url.gsub!(%r{//(.)}, "//#{username}:#{password}@\\1") if username && !base_url[%r{//[^/]*:[^/]*@}]
|
318
|
-
connection = Flexirest::ConnectionManager.get_connection(
|
318
|
+
connection = Flexirest::ConnectionManager.get_connection(base_url)
|
319
319
|
end
|
320
320
|
else
|
321
321
|
parts = @url.match(%r{^(https?://[a-z\d\.:-]+?)(/.*)}).to_a
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/connection_spec.rb
CHANGED
@@ -147,7 +147,7 @@ describe Flexirest::Connection do
|
|
147
147
|
expect(auth_header == "APIAuth id123:TQiQIW6vVaDC5jvh99uTNkxIg6Q=" || auth_header == "APIAuth id123:PMWBThkB8vKbvUccHvoqu9G3eVk=").to be_truthy
|
148
148
|
end
|
149
149
|
|
150
|
-
if Gem.loaded_specs["api-auth"].version.to_s >= "2.0.0"
|
150
|
+
if Gem.loaded_specs["api-auth"].present? && Gem.loaded_specs["api-auth"].version.to_s >= "2.0.0"
|
151
151
|
it 'should have an Authorization header with a custom digest method' do
|
152
152
|
puts Gem.loaded_specs["api-auth"].version
|
153
153
|
@options[:api_auth][:api_auth_options] = {
|
data/spec/lib/proxy_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'active_support/core_ext/hash'
|
3
|
+
require 'base64'
|
3
4
|
|
4
5
|
class ProxyExample < Flexirest::ProxyBase
|
5
6
|
get "/all" do
|
@@ -30,7 +31,7 @@ class ProxyExample < Flexirest::ProxyBase
|
|
30
31
|
body "MY-BODY-CONTENT"
|
31
32
|
passthrough
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
patch "/partial_update" do
|
35
36
|
body "MY-BODY-CONTENT"
|
36
37
|
passthrough
|
@@ -93,6 +94,8 @@ class ProxyClientExample < Flexirest::Base
|
|
93
94
|
end
|
94
95
|
|
95
96
|
describe Flexirest::Base do
|
97
|
+
before(:each) { ProxyClientExample.base_url 'http://www.example.com' }
|
98
|
+
|
96
99
|
it "allows the URL to be changed" do
|
97
100
|
expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/getAll?id=1", instance_of(Hash)).and_return(OpenStruct.new(body:"{\"result\":true}", status:200, headers:{}))
|
98
101
|
ProxyClientExample.all(id:1)
|
@@ -112,7 +115,7 @@ describe Flexirest::Base do
|
|
112
115
|
expect_any_instance_of(Flexirest::Connection).to receive(:post).with("/create", {age:12, first_name:"John"}.to_query, instance_of(Hash)).and_return(OpenStruct.new(body:"{\"result\":true}", status:200, headers:{}))
|
113
116
|
ProxyClientExample.create(fname:"John", lname:"Smith")
|
114
117
|
end
|
115
|
-
|
118
|
+
|
116
119
|
it "has access to raw body content for PATCH requests" do
|
117
120
|
expect_any_instance_of(Flexirest::Connection).to receive(:patch).with("/partial_update", "MY-BODY-CONTENT", instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"result\":true}", status:200, response_headers:{})))
|
118
121
|
ProxyClientExample.partial_update(fname:"John", lname:"Smith")
|
@@ -197,4 +200,13 @@ describe Flexirest::Base do
|
|
197
200
|
expect(ProxyClientExample.hal_test(id:1).test.result).to eq(true)
|
198
201
|
end
|
199
202
|
|
203
|
+
it "properly passes basic HTTP auth credentials" do
|
204
|
+
host, credentials, url_path = 'www.example.com', 'user:pass', '/getAll?id=1'
|
205
|
+
ProxyClientExample.base_url "http://#{credentials}@#{host}"
|
206
|
+
stub_request(:get, "#{host}#{url_path}")
|
207
|
+
ProxyClientExample.all(id:1)
|
208
|
+
expect(a_request(:get, "#{host}#{url_path}").with(headers: {
|
209
|
+
'Authorization'=>"Basic #{Base64.strict_encode64(credentials)}"
|
210
|
+
})).to have_been_made
|
211
|
+
end
|
200
212
|
end
|
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.3.
|
4
|
+
version: 1.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|