sunstone 6.1.0.rc1 → 6.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/active_record/connection_adapters/sunstone_adapter.rb +3 -3
- data/lib/sunstone.rb +15 -1
- data/lib/sunstone/connection.rb +3 -3
- data/lib/sunstone/version.rb +1 -1
- data/sunstone.gemspec +2 -2
- data/test/schema_mock.rb +1 -1
- data/test/sunstone/connection/configuration_test.rb +13 -13
- data/test/sunstone/connection/cookie_store_test.rb +2 -2
- data/test/sunstone/connection/request_helper_test.rb +12 -12
- data/test/sunstone/connection/send_request_test.rb +12 -12
- data/test/sunstone/connection_test.rb +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70fcfa3e9252509421cfb640f2f0ea0294c37018f6b8a9feeaf4fcb2f9d75161
|
4
|
+
data.tar.gz: 9dd9af70b45187707817193f5632302005e8e0ede8a8c146db6fae567c706e84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6d53c45d04cf82a891aa9bf736f69492e76847a3748aeecdda6830da80ae04f43f4e9fd981467627d301726ac2459f4297200a57ce917f48b35dc2e8734101
|
7
|
+
data.tar.gz: d7db042c9710800367267f124d7abc33814ce638409200a080e7c1e27e99e78b41cd84a22dbc160ec2d7c7f739df77cca0bec77b17d92b672c1ae9f69db5dc1b
|
data/.travis.yml
CHANGED
@@ -9,6 +9,7 @@ cache:
|
|
9
9
|
|
10
10
|
rvm:
|
11
11
|
- 2.7
|
12
|
+
- 3.0
|
12
13
|
|
13
14
|
env:
|
14
15
|
matrix:
|
@@ -29,7 +30,6 @@ addons:
|
|
29
30
|
- postgresql-13
|
30
31
|
- postgresql-client-13
|
31
32
|
|
32
|
-
|
33
33
|
before_install:
|
34
34
|
- sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/13/main/postgresql.conf
|
35
35
|
- sudo cp /etc/postgresql/{9.3,13}/main/pg_hba.conf
|
@@ -17,7 +17,7 @@ require 'active_record/connection_adapters/sunstone/type/json'
|
|
17
17
|
module ActiveRecord
|
18
18
|
module ConnectionHandling # :nodoc:
|
19
19
|
|
20
|
-
VALID_SUNSTONE_CONN_PARAMS = [:
|
20
|
+
VALID_SUNSTONE_CONN_PARAMS = [:url, :host, :port, :api_key, :use_ssl, :user_agent, :ca_cert]
|
21
21
|
|
22
22
|
# Establishes a connection to the database that's used by all Active Record
|
23
23
|
# objects
|
@@ -25,8 +25,8 @@ module ActiveRecord
|
|
25
25
|
conn_params = config.symbolize_keys
|
26
26
|
conn_params.delete_if { |_, v| v.nil? }
|
27
27
|
|
28
|
-
if conn_params[:
|
29
|
-
uri = URI.parse(conn_params.delete(:
|
28
|
+
if conn_params[:url]
|
29
|
+
uri = URI.parse(conn_params.delete(:url))
|
30
30
|
conn_params[:api_key] ||= (uri.user ? CGI.unescape(uri.user) : nil)
|
31
31
|
conn_params[:host] ||= uri.host
|
32
32
|
conn_params[:port] ||= uri.port
|
data/lib/sunstone.rb
CHANGED
@@ -37,4 +37,18 @@ require File.expand_path(File.join(__FILE__, '../../ext/arel/select_manager'))
|
|
37
37
|
require File.expand_path(File.join(__FILE__, '../../ext/arel/nodes/eager_load'))
|
38
38
|
require File.expand_path(File.join(__FILE__, '../../ext/arel/attributes/empty_relation'))
|
39
39
|
require File.expand_path(File.join(__FILE__, '../../ext/arel/nodes/select_statement'))
|
40
|
-
require File.expand_path(File.join(__FILE__, '../../ext/active_record/finder_methods'))
|
40
|
+
require File.expand_path(File.join(__FILE__, '../../ext/active_record/finder_methods'))
|
41
|
+
|
42
|
+
if ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 1
|
43
|
+
# Patch to allow Rails 6.1 pass url to adapter, all other versions work
|
44
|
+
class ActiveRecord::DatabaseConfigurations::UrlConfig
|
45
|
+
private
|
46
|
+
def build_url_hash
|
47
|
+
if url.nil? || %w(jdbc: http: https:).any? { |protocol| url.start_with?(protocol) }
|
48
|
+
{ url: url }
|
49
|
+
else
|
50
|
+
ConnectionUrlResolver.new(url).to_hash
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/sunstone/connection.rb
CHANGED
@@ -10,7 +10,7 @@ module Sunstone
|
|
10
10
|
#
|
11
11
|
# Options:
|
12
12
|
#
|
13
|
-
# * <tt>:
|
13
|
+
# * <tt>:url</tt> - An optional url used to set the protocol, host, port,
|
14
14
|
# and api_key
|
15
15
|
# * <tt>:host</tt> - The default is to connect to 127.0.0.1.
|
16
16
|
# * <tt>:port</tt> - Defaults to 80.
|
@@ -19,8 +19,8 @@ module Sunstone
|
|
19
19
|
# * <tt>:user_agent</tt> - An optional string. Will be joined with other
|
20
20
|
# User-Agent info.
|
21
21
|
def initialize(config)
|
22
|
-
if config[:
|
23
|
-
uri = URI.parse(config.delete(:
|
22
|
+
if config[:url]
|
23
|
+
uri = URI.parse(config.delete(:url))
|
24
24
|
config[:api_key] ||= (uri.user ? CGI.unescape(uri.user) : nil)
|
25
25
|
config[:host] ||= uri.host
|
26
26
|
config[:port] ||= uri.port
|
data/lib/sunstone/version.rb
CHANGED
data/sunstone.gemspec
CHANGED
@@ -30,11 +30,11 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_development_dependency 'rgeo'
|
31
31
|
s.add_development_dependency 'simplecov'
|
32
32
|
s.add_development_dependency 'byebug'
|
33
|
-
s.add_development_dependency 'activesupport', '>= 6.
|
33
|
+
s.add_development_dependency 'activesupport', '>= 6.1.0'
|
34
34
|
|
35
35
|
# Runtime
|
36
36
|
s.add_runtime_dependency 'msgpack'
|
37
37
|
s.add_runtime_dependency 'cookie_store'
|
38
38
|
s.add_runtime_dependency 'activerecord', '>= 6.1.0'
|
39
|
-
s.add_runtime_dependency 'arel-extensions', '>= 6.
|
39
|
+
s.add_runtime_dependency 'arel-extensions', '>= 6.1.0'
|
40
40
|
end
|
data/test/schema_mock.rb
CHANGED
@@ -86,7 +86,7 @@ class ActiveSupport::TestCase
|
|
86
86
|
|
87
87
|
set_callback(:setup, :before) do
|
88
88
|
if !instance_variable_defined?(:@suite_setup_run) && self.class.class_variable_defined?(:@@schema)
|
89
|
-
ActiveRecord::Base.establish_connection(adapter: 'sunstone',
|
89
|
+
ActiveRecord::Base.establish_connection(adapter: 'sunstone', url: 'http://example.com')
|
90
90
|
|
91
91
|
req_stub = stub_request(:get, /^http:\/\/example.com/).with do |req|
|
92
92
|
case req.uri.path
|
@@ -2,40 +2,40 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Sunstone::Connection::ConfigurationTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
test "setting the
|
6
|
-
connection = Sunstone::Connection.new(
|
5
|
+
test "setting the url sets the api_key" do
|
6
|
+
connection = Sunstone::Connection.new(url: 'http://my_api_key@localhost')
|
7
7
|
assert_equal('my_api_key', connection.api_key)
|
8
8
|
end
|
9
9
|
|
10
|
-
test "setting the
|
11
|
-
connection = Sunstone::Connection.new(
|
10
|
+
test "setting the url sets the host" do
|
11
|
+
connection = Sunstone::Connection.new(url: 'https://example.com')
|
12
12
|
assert_equal('example.com', connection.host)
|
13
13
|
end
|
14
14
|
|
15
|
-
test "setting the
|
16
|
-
connection = Sunstone::Connection.new(
|
15
|
+
test "setting the url sets the port" do
|
16
|
+
connection = Sunstone::Connection.new(url: 'http://localhost')
|
17
17
|
assert_equal(80, connection.port)
|
18
18
|
|
19
|
-
connection = Sunstone::Connection.new(
|
19
|
+
connection = Sunstone::Connection.new(url: 'https://localhost')
|
20
20
|
assert_equal(443, connection.port)
|
21
21
|
|
22
|
-
connection = Sunstone::Connection.new(
|
22
|
+
connection = Sunstone::Connection.new(url: 'https://localhost:4321')
|
23
23
|
assert_equal(4321, connection.port)
|
24
24
|
end
|
25
25
|
|
26
|
-
test "setting the
|
27
|
-
connection = Sunstone::Connection.new(
|
26
|
+
test "setting the url sets the use_ssl option" do
|
27
|
+
connection = Sunstone::Connection.new(url: 'http://localhost')
|
28
28
|
assert_equal(false, connection.use_ssl)
|
29
29
|
|
30
|
-
connection = Sunstone::Connection.new(
|
30
|
+
connection = Sunstone::Connection.new(url: 'https://localhost')
|
31
31
|
assert_equal(true, connection.use_ssl)
|
32
32
|
end
|
33
33
|
|
34
34
|
test "setting the user_agent appends it to the User-Agent" do
|
35
|
-
connection = Sunstone::Connection.new(
|
35
|
+
connection = Sunstone::Connection.new(url: 'http://localhost')
|
36
36
|
assert_equal("Sunstone/#{Sunstone::VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_PLATFORM}", connection.user_agent)
|
37
37
|
|
38
|
-
connection = Sunstone::Connection.new(
|
38
|
+
connection = Sunstone::Connection.new(url: 'http://localhost', user_agent: "MyGem/3.14")
|
39
39
|
assert_equal("MyGem/3.14 Sunstone/#{Sunstone::VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_PLATFORM}", connection.user_agent)
|
40
40
|
end
|
41
41
|
|
@@ -4,7 +4,7 @@ class Sunstone::Connection::CookieStoreTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
test '#send_request(#<Net::HTTPRequest) adds cookies to the cookie store if present' do
|
6
6
|
store = CookieStore::HashStore.new
|
7
|
-
connection = Sunstone::Connection.new(
|
7
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
8
8
|
stub_request(:get, "http://testhost.com/test").to_return(:body => 'get', :headers => {'Set-Cookie' => 'foo=bar; Max-Age=3600'})
|
9
9
|
|
10
10
|
Sunstone::Connection.with_cookie_store(store) { connection.get('/test') }
|
@@ -17,7 +17,7 @@ class Sunstone::Connection::CookieStoreTest < ActiveSupport::TestCase
|
|
17
17
|
|
18
18
|
test '#send_request(#<Net::HTTPRequest) sends cookie header if cookie store is present' do
|
19
19
|
store = CookieStore::HashStore.new
|
20
|
-
connection = Sunstone::Connection.new(
|
20
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
21
21
|
stub_request(:get, "http://testhost.com/test").to_return(
|
22
22
|
headers: {
|
23
23
|
'Set-Cookie' => 'foo=bar; Path="/" Max-Age=3600'
|
@@ -5,28 +5,28 @@ class Sunstone::Connection::RequestHelpersTest < ActiveSupport::TestCase
|
|
5
5
|
# Sunstone.get ==============================================================
|
6
6
|
|
7
7
|
test '#get(path)' do
|
8
|
-
connection = Sunstone::Connection.new(
|
8
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
9
9
|
stub_request(:get, "http://testhost.com/test").to_return(:body => "get")
|
10
10
|
|
11
11
|
assert_equal('get', connection.get('/test').body)
|
12
12
|
end
|
13
13
|
|
14
14
|
test '#get(path, params) with params as string' do
|
15
|
-
connection = Sunstone::Connection.new(
|
15
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
16
16
|
stub_request(:get, "http://testhost.com/test").with(:query => {'key' => 'value'}).to_return(:body => "get")
|
17
17
|
|
18
18
|
assert_equal 'get', connection.get('/test', 'key=value').body
|
19
19
|
end
|
20
20
|
|
21
21
|
test '#get(path, params) with params as hash' do
|
22
|
-
connection = Sunstone::Connection.new(
|
22
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
23
23
|
stub_request(:get, "http://testhost.com/test").with(:query => {'key' => 'value'}).to_return(:body => "get")
|
24
24
|
|
25
25
|
assert_equal 'get', connection.get('/test', {:key => 'value'}).body
|
26
26
|
end
|
27
27
|
|
28
28
|
test '#get(path, &block)' do
|
29
|
-
connection = Sunstone::Connection.new(
|
29
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
30
30
|
stub_request(:get, "http://testhost.com/test").to_return(:body => 'get')
|
31
31
|
|
32
32
|
connection.get('/test') do |response|
|
@@ -37,21 +37,21 @@ class Sunstone::Connection::RequestHelpersTest < ActiveSupport::TestCase
|
|
37
37
|
# Sunstone.post =============================================================
|
38
38
|
|
39
39
|
test '#post(path)' do
|
40
|
-
connection = Sunstone::Connection.new(
|
40
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
41
41
|
stub_request(:post, "http://testhost.com/test").to_return(:body => "post")
|
42
42
|
|
43
43
|
assert_equal('post', connection.post('/test').body)
|
44
44
|
end
|
45
45
|
|
46
46
|
test '#post(path, body)' do
|
47
|
-
connection = Sunstone::Connection.new(
|
47
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
48
48
|
stub_request(:post, "http://testhost.com/test").with(:body => 'body').to_return(:body => "post")
|
49
49
|
|
50
50
|
assert_equal('post', connection.post('/test', 'body').body)
|
51
51
|
end
|
52
52
|
|
53
53
|
test '#post(path, &block)' do
|
54
|
-
connection = Sunstone::Connection.new(
|
54
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
55
55
|
stub_request(:post, "http://testhost.com/test").to_return(:body => 'post')
|
56
56
|
|
57
57
|
connection.post('/test') do |response|
|
@@ -62,21 +62,21 @@ class Sunstone::Connection::RequestHelpersTest < ActiveSupport::TestCase
|
|
62
62
|
# Sunstone.put ==============================================================
|
63
63
|
|
64
64
|
test '#put(path)' do
|
65
|
-
connection = Sunstone::Connection.new(
|
65
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
66
66
|
stub_request(:put, "http://testhost.com/test").to_return(:body => "put")
|
67
67
|
|
68
68
|
assert_equal('put', connection.put('/test').body)
|
69
69
|
end
|
70
70
|
|
71
71
|
test '#put(path, body)' do
|
72
|
-
connection = Sunstone::Connection.new(
|
72
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
73
73
|
stub_request(:put, "http://testhost.com/test").with(:body => 'body').to_return(:body => "put")
|
74
74
|
|
75
75
|
assert_equal('put', connection.put('/test', 'body').body)
|
76
76
|
end
|
77
77
|
|
78
78
|
test '#put(path, &block)' do
|
79
|
-
connection = Sunstone::Connection.new(
|
79
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
80
80
|
stub_request(:put, "http://testhost.com/test").to_return(:body => 'put')
|
81
81
|
|
82
82
|
connection.put('/test') do |response|
|
@@ -87,14 +87,14 @@ class Sunstone::Connection::RequestHelpersTest < ActiveSupport::TestCase
|
|
87
87
|
# Sunstone.delete ===========================================================
|
88
88
|
|
89
89
|
test '#delete' do
|
90
|
-
connection = Sunstone::Connection.new(
|
90
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
91
91
|
stub_request(:delete, "http://testhost.com/test").to_return(:body => "delete")
|
92
92
|
|
93
93
|
assert_equal('delete', connection.delete('/test').body)
|
94
94
|
end
|
95
95
|
|
96
96
|
test '#delete(path, &block)' do
|
97
|
-
connection = Sunstone::Connection.new(
|
97
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
98
98
|
stub_request(:delete, "http://testhost.com/test").to_return(:body => 'delete')
|
99
99
|
|
100
100
|
connection.delete('/test') do |response|
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
test '#send_request(#<Net::HTTPRequest>) includes the api-key header when present' do
|
6
|
-
connection = Sunstone::Connection.new(
|
6
|
+
connection = Sunstone::Connection.new(url: "http://my_api_key@example.com")
|
7
7
|
|
8
8
|
test_stub = stub_request(:get, "http://example.com/verify").with { |req|
|
9
9
|
req.headers['Api-Key'] == 'my_api_key'
|
@@ -13,7 +13,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test '#send_request(#<Net::HTTPRequest>) includes the user_agent' do
|
16
|
-
connection = Sunstone::Connection.new(
|
16
|
+
connection = Sunstone::Connection.new(url: "http://example.com")
|
17
17
|
|
18
18
|
test_stub = stub_request(:get, "http://example.com/verify").with { |req|
|
19
19
|
req.headers['User-Agent'] =~ /Sunstone\/\S+ Ruby\/\S+ \S+/
|
@@ -22,7 +22,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
22
22
|
assert_requested(test_stub)
|
23
23
|
|
24
24
|
# Custom Agent
|
25
|
-
connection = Sunstone::Connection.new(
|
25
|
+
connection = Sunstone::Connection.new(url: "http://example.com", user_agent: "MyClient/2")
|
26
26
|
|
27
27
|
test_stub = stub_request(:get, "http://example.com/verify").with { |req|
|
28
28
|
req.headers['User-Agent'] =~ /MyClient\/2 Sunstone\/\S+ Ruby\/\S+ \S+/
|
@@ -34,7 +34,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
34
34
|
test '#send_request(#<Net::HTTPRequest>)' do
|
35
35
|
stub_request(:get, "http://testhost.com/test").to_return(body: 'get')
|
36
36
|
|
37
|
-
connection = Sunstone::Connection.new(
|
37
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
38
38
|
assert_equal('get', connection.send_request(Net::HTTP::Get.new('/test')).body)
|
39
39
|
end
|
40
40
|
|
@@ -45,7 +45,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
45
45
|
body: "post"
|
46
46
|
)
|
47
47
|
|
48
|
-
connection = Sunstone::Connection.new(
|
48
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
49
49
|
assert_equal('post', connection.send_request(Net::HTTP::Post.new('/test'), '{"key":"value"}').body)
|
50
50
|
end
|
51
51
|
|
@@ -58,14 +58,14 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
58
58
|
wr.write('{"key":"value"}')
|
59
59
|
wr.close
|
60
60
|
|
61
|
-
connection = Sunstone::Connection.new(
|
61
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
62
62
|
assert_equal('post', connection.send_request(Net::HTTP::Post.new('/test'), rd).body)
|
63
63
|
end
|
64
64
|
|
65
65
|
test '#send_request(#<Net::HTTPRequest>, body) with Ruby Object body' do
|
66
66
|
stub_request(:post, "http://testhost.com/test").with(body: '{"key":"value"}').to_return(body: "post")
|
67
67
|
|
68
|
-
connection = Sunstone::Connection.new(
|
68
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
69
69
|
assert_equal('post', connection.send_request(Net::HTTP::Post.new('/test'), {:key => 'value'}).body)
|
70
70
|
end
|
71
71
|
|
@@ -80,7 +80,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
80
80
|
stub_request(:get, "http://testhost.com/503").to_return(status: 503)
|
81
81
|
stub_request(:get, "http://testhost.com/550").to_return(status: 550)
|
82
82
|
|
83
|
-
connection = Sunstone::Connection.new(
|
83
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
84
84
|
assert_raises(Sunstone::Exception::BadRequest) { connection.send_request(Net::HTTP::Get.new('/400')) }
|
85
85
|
assert_raises(Sunstone::Exception::Unauthorized) { connection.send_request(Net::HTTP::Get.new('/401')) }
|
86
86
|
assert_raises(Sunstone::Exception::Forbidden) { connection.send_request(Net::HTTP::Get.new('/403')) }
|
@@ -95,7 +95,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
95
95
|
test '#send_request(#<Net::HTTPRequest>, &block) returns value returned from &block' do
|
96
96
|
stub_request(:get, "http://testhost.com/test").to_return(body: 'get')
|
97
97
|
|
98
|
-
connection = Sunstone::Connection.new(
|
98
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
99
99
|
value = connection.send_request(Net::HTTP::Get.new('/test')) do |response|
|
100
100
|
3215
|
101
101
|
end
|
@@ -104,7 +104,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
104
104
|
end
|
105
105
|
|
106
106
|
test '#send_request(#<Net::HTTPRequest>, &block)' do
|
107
|
-
connection = Sunstone::Connection.new(
|
107
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
108
108
|
stub_request(:get, "http://testhost.com/test").to_return(body: 'get')
|
109
109
|
|
110
110
|
connection.send_request(Net::HTTP::Get.new('/test')) do |response|
|
@@ -122,7 +122,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
122
122
|
end
|
123
123
|
|
124
124
|
test '#send_request(#<Net::HTTPRequest>, &block) with block reading chunks' do
|
125
|
-
connection = Sunstone::Connection.new(
|
125
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
126
126
|
|
127
127
|
rd, wr = IO.pipe
|
128
128
|
rd = Net::BufferedIO.new(rd)
|
@@ -149,7 +149,7 @@ class Sunstone::Connection::SendRequestTest < ActiveSupport::TestCase
|
|
149
149
|
|
150
150
|
# TODO: support multple depreaction-notice headers
|
151
151
|
test 'deprecation warning printed when deprecation header returned' do
|
152
|
-
connection = Sunstone::Connection.new(
|
152
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
153
153
|
|
154
154
|
stub_request(:get, "http://testhost.com/test").to_return(
|
155
155
|
body: 'get',
|
@@ -5,7 +5,7 @@ class Sunstone::ConnectionTest < ActiveSupport::TestCase
|
|
5
5
|
# #ping =====================================================================
|
6
6
|
|
7
7
|
test '#ping' do
|
8
|
-
connection = Sunstone::Connection.new(
|
8
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
9
9
|
stub_request(:get, "http://testhost.com/ping").to_return(:body => 'pong')
|
10
10
|
|
11
11
|
assert_equal( 'pong', connection.ping )
|
@@ -14,7 +14,7 @@ class Sunstone::ConnectionTest < ActiveSupport::TestCase
|
|
14
14
|
# #server_config ===========================================================
|
15
15
|
|
16
16
|
test '#config' do
|
17
|
-
connection = Sunstone::Connection.new(
|
17
|
+
connection = Sunstone::Connection.new(url: "http://testhost.com")
|
18
18
|
stub_request(:get, "http://testhost.com/config").to_return(:body => '{"server": "configs"}')
|
19
19
|
|
20
20
|
assert_equal( {:server => "configs"}, connection.server_config )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.0.
|
4
|
+
version: 6.1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 6.
|
187
|
+
version: 6.1.0
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 6.
|
194
|
+
version: 6.1.0
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: msgpack
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,14 +240,14 @@ dependencies:
|
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: 6.
|
243
|
+
version: 6.1.0
|
244
244
|
type: :runtime
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: 6.
|
250
|
+
version: 6.1.0
|
251
251
|
description: A library for interacting with REST APIs. Similar to ActiveResource
|
252
252
|
email:
|
253
253
|
- jonbracy@gmail.com
|
@@ -336,11 +336,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
336
336
|
version: '2.6'
|
337
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
338
|
requirements:
|
339
|
-
- - "
|
339
|
+
- - ">="
|
340
340
|
- !ruby/object:Gem::Version
|
341
|
-
version:
|
341
|
+
version: '0'
|
342
342
|
requirements: []
|
343
|
-
rubygems_version: 3.
|
343
|
+
rubygems_version: 3.2.3
|
344
344
|
signing_key:
|
345
345
|
specification_version: 4
|
346
346
|
summary: A library for interacting with REST APIs
|