Skip to content

Commit 1ac0c1c

Browse files
authored
Merge pull request #49 from QuickPay/fix_port
Fix port
2 parents b8ee978 + 8a12a21 commit 1ac0c1c

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

lib/quickpay/api/client.rb

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def initialize(username: nil, password: nil, base_uri: "https://api.quickpay.net
6767
net_req.body = req.body
6868
res = Net::HTTP.start(
6969
uri.hostname,
70+
uri.port,
7071
use_ssl: uri.scheme == HTTPS,
7172
open_timeout: @connect_timeout,
7273
read_timeout: @read_timeout,

lib/quickpay/api/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module QuickPay
22
module API
3-
VERSION = "4.0.0".freeze
3+
VERSION = "4.0.1".freeze
44
end
55
end

test/client.rb

+4-12
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,14 @@
1818
stub_request(:any, //).to_return(body: "Unknown Stub", status: 500)
1919
end
2020

21-
it "set default headers" do
22-
stub_request(:get, %r{/ping}).to_return { |request| { headers: request.headers, status: 200 } }
21+
it "does not smoke" do
22+
stub_request(:get, "http://localhost:4242/ping").to_return { |request| { headers: request.headers, status: 200 } }
2323

24-
client = QuickPay::API::Client.new
24+
client = QuickPay::API::Client.new(password: "secret", base_uri: "http://localhost:4242")
2525
_, _, headers = *client.get("/ping")
2626

2727
_(headers["accept-version"]).must_equal "v10"
2828
_(headers["user-agent"]).must_equal "quickpay-ruby-client, v#{QuickPay::API::VERSION}"
29-
end
30-
31-
it "handles authentication" do
32-
stub_request(:get, %r{/ping}).to_return { |request| { headers: request.headers, status: 200 } }
33-
34-
client = QuickPay::API::Client.new(password: "secret")
35-
_, _, headers = *client.get("/ping")
36-
3729
_(headers["authorization"]).must_equal "Basic OnNlY3JldA=="
3830
end
3931

@@ -184,7 +176,7 @@
184176
_(e.request.body).must_equal "foo=bar&baz=qux"
185177
_(e.request.headers["Accept-Version"]).must_equal "v10"
186178
_(e.request.headers["User-Agent"]).must_equal "quickpay-ruby-client, v#{QuickPay::API::VERSION}"
187-
_(e.request.query).must_equal(nil)
179+
_(e.request.query).must_be_nil
188180

189181
e = assert_raises QuickPay::API::Error do
190182
stub_request(:post, %r{/upload}).to_return(status: 409, body: "Conflict", headers: { "Foo" => "bar" })

0 commit comments

Comments
 (0)