active_utils 3.0.0 → 3.1.0
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 +5 -1
- data/lib/active_utils.rb +3 -6
- data/lib/active_utils/country.rb +1 -0
- data/lib/active_utils/error.rb +7 -5
- data/lib/active_utils/posts_data.rb +6 -0
- data/lib/active_utils/version.rb +1 -1
- data/test/unit/connection_test.rb +18 -0
- data/test/unit/posts_data_test.rb +6 -0
- metadata +4 -26
- checksums.yaml.gz.sig +0 -2
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2cda56fd2a5bf93e2c5de4589e2ea474d4978fd
|
4
|
+
data.tar.gz: 51036f2d8b672f7606d31edd54e406fe67f95273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4af9fe1b18ce5a940e697c028732cec45c9101ada39a292166b1a758464cdd63e0cb8fe813f4b12c2f648845a618cef58cf87bae543693767d65abea31e805b
|
7
|
+
data.tar.gz: d37119bee2e0fe398c9198f8843449387a2e381d84b7868a91ba812d5acfa9d997cc3d49cbaebbf05f1f1dded5cd01c17cea4b2afd3405b6ffc68316aa2e423b
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# ActiveUtils changelog
|
2
2
|
|
3
|
+
### Version 3.1.0 (Sept. 30, 2015)
|
4
|
+
- Use ActiveUtils::HTTPRequestError as base exception class
|
5
|
+
- Add proxy address and port configuration
|
6
|
+
- Add support for Sin Maarten
|
3
7
|
|
4
|
-
### Version 3.0.0 (
|
8
|
+
### Version 3.0.0 (Jan. 16, 2015)
|
5
9
|
|
6
10
|
- Fully decoupled from ActiveMerchant: no longer uses `ActiveMerchant::` as namespace, but uses `ActiveUtils::` instead.
|
7
11
|
- Bump ActiveSupport requirement to **>= 3.2**.
|
data/lib/active_utils.rb
CHANGED
@@ -3,6 +3,9 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
3
3
|
require 'active_support/core_ext/hash/conversions'
|
4
4
|
require 'active_support/core_ext/class/attribute'
|
5
5
|
|
6
|
+
require 'active_utils/error'
|
7
|
+
require 'active_utils/version'
|
8
|
+
|
6
9
|
module ActiveUtils
|
7
10
|
autoload :NetworkConnectionRetries, 'active_utils/network_connection_retries'
|
8
11
|
autoload :Connection, 'active_utils/connection'
|
@@ -10,12 +13,6 @@ module ActiveUtils
|
|
10
13
|
autoload :CountryCode, 'active_utils/country'
|
11
14
|
autoload :InvalidCountryCodeError, 'active_utils/country'
|
12
15
|
autoload :CountryCodeFormatError, 'active_utils/country'
|
13
|
-
autoload :ActiveUtilsError, 'active_utils/error'
|
14
|
-
autoload :ConnectionError, 'active_utils/error'
|
15
|
-
autoload :RetriableConnectionError, 'active_utils/error'
|
16
|
-
autoload :ResponseError, 'active_utils/error'
|
17
|
-
autoload :ClientCertificateError, 'active_utils/error'
|
18
|
-
autoload :InvalidResponseError, 'active_utils/error'
|
19
16
|
autoload :PostData, 'active_utils/post_data'
|
20
17
|
autoload :PostsData, 'active_utils/posts_data'
|
21
18
|
autoload :RequiresParameters, 'active_utils/requires_parameters'
|
data/lib/active_utils/country.rb
CHANGED
@@ -262,6 +262,7 @@ module ActiveUtils #:nodoc:
|
|
262
262
|
{ :alpha2 => 'SC', :name => 'Seychelles', :alpha3 => 'SYC', :numeric => '690' },
|
263
263
|
{ :alpha2 => 'SL', :name => 'Sierra Leone', :alpha3 => 'SLE', :numeric => '694' },
|
264
264
|
{ :alpha2 => 'SG', :name => 'Singapore', :alpha3 => 'SGP', :numeric => '702' },
|
265
|
+
{ :alpha2 => 'SX', :name => 'Sint Maarten (Netherlands Part)', :alpha3 => 'SXM', :numeric => '534' },
|
265
266
|
{ :alpha2 => 'SK', :name => 'Slovakia', :alpha3 => 'SVK', :numeric => '703' },
|
266
267
|
{ :alpha2 => 'SI', :name => 'Slovenia', :alpha3 => 'SVN', :numeric => '705' },
|
267
268
|
{ :alpha2 => 'SB', :name => 'Solomon Islands', :alpha3 => 'SLB', :numeric => '090' },
|
data/lib/active_utils/error.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
module ActiveUtils #:nodoc:
|
2
|
-
class
|
2
|
+
class HTTPRequestError < StandardError #:nodoc:
|
3
3
|
end
|
4
4
|
|
5
|
-
|
5
|
+
ActiveUtilsError = HTTPRequestError #:nodoc:
|
6
|
+
|
7
|
+
class ConnectionError < HTTPRequestError # :nodoc:
|
6
8
|
end
|
7
9
|
|
8
10
|
class RetriableConnectionError < ConnectionError # :nodoc:
|
9
11
|
end
|
10
12
|
|
11
|
-
class ResponseError <
|
13
|
+
class ResponseError < HTTPRequestError # :nodoc:
|
12
14
|
attr_reader :response
|
13
15
|
|
14
16
|
def initialize(response, message = nil)
|
@@ -21,9 +23,9 @@ module ActiveUtils #:nodoc:
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
|
-
class ClientCertificateError <
|
26
|
+
class ClientCertificateError < HTTPRequestError # :nodoc
|
25
27
|
end
|
26
28
|
|
27
|
-
class InvalidResponseError <
|
29
|
+
class InvalidResponseError < HTTPRequestError # :nodoc
|
28
30
|
end
|
29
31
|
end
|
@@ -22,6 +22,9 @@ module ActiveUtils #:nodoc:
|
|
22
22
|
|
23
23
|
base.class_attribute :logger
|
24
24
|
base.class_attribute :wiredump_device
|
25
|
+
|
26
|
+
base.class_attribute :proxy_address
|
27
|
+
base.class_attribute :proxy_port
|
25
28
|
end
|
26
29
|
|
27
30
|
def ssl_get(endpoint, headers={})
|
@@ -56,6 +59,9 @@ module ActiveUtils #:nodoc:
|
|
56
59
|
|
57
60
|
connection.ignore_http_status = @options[:ignore_http_status] if @options
|
58
61
|
|
62
|
+
connection.proxy_address = proxy_address
|
63
|
+
connection.proxy_port = proxy_port
|
64
|
+
|
59
65
|
connection.request(method, data, headers)
|
60
66
|
end
|
61
67
|
|
data/lib/active_utils/version.rb
CHANGED
@@ -124,6 +124,24 @@ class ConnectionTest < Minitest::Test
|
|
124
124
|
assert_equal "/bogus", @connection.send(:http).ca_path
|
125
125
|
end
|
126
126
|
|
127
|
+
def test_default_proxy_address_is_nil
|
128
|
+
assert_equal nil, @connection.proxy_address
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_default_proxy_port_is_nil
|
132
|
+
assert_equal nil, @connection.proxy_port
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_override_proxy_address
|
136
|
+
@connection.proxy_address = "http://proxy.example.com"
|
137
|
+
assert_equal "http://proxy.example.com", @connection.proxy_address
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_override_proxy_port
|
141
|
+
@connection.proxy_port = "8888"
|
142
|
+
assert_equal "8888", @connection.proxy_port
|
143
|
+
end
|
144
|
+
|
127
145
|
def test_unrecoverable_exception
|
128
146
|
@connection.logger.expects(:info).once
|
129
147
|
Net::HTTP.any_instance.expects(:post).raises(EOFError)
|
@@ -55,4 +55,10 @@ class PostsDataTest < Minitest::Test
|
|
55
55
|
@poster.raw_ssl_request(:post, "https://shopify.com", "", {})
|
56
56
|
end
|
57
57
|
|
58
|
+
def test_set_proxy_address_and_port
|
59
|
+
SSLPoster.proxy_address = 'http://proxy.example.com'
|
60
|
+
SSLPoster.proxy_port = '8888'
|
61
|
+
assert_equal @poster.proxy_address, 'http://proxy.example.com'
|
62
|
+
assert_equal @poster.proxy_port, '8888'
|
63
|
+
end
|
58
64
|
end
|
metadata
CHANGED
@@ -1,36 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|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6i4XMHVs6Xi94h
|
27
|
-
qXFw1ec9Y2eDUqaolT3bviOk9BB197+A8Vz/k7MC6ci2NE+yDDB7HAC8zU6LAx8Y
|
28
|
-
Iqvw7B/PSZ/pz4bUVFlTATif4mi1vO3lidRkdHRtM7UePSn2rUpOi0gtXBP3bLu5
|
29
|
-
YjHJN7wx5cugMEyroKITG5gL0Nxtu21qtOlHX4Hc4KdE2JqzCPOsS4zsZGhgwhPs
|
30
|
-
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
31
|
-
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
32
|
-
-----END CERTIFICATE-----
|
33
|
-
date: 2015-01-16 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
34
12
|
dependencies:
|
35
13
|
- !ruby/object:Gem::Dependency
|
36
14
|
name: activesupport
|
@@ -164,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
142
|
version: '0'
|
165
143
|
requirements: []
|
166
144
|
rubyforge_project: active_utils
|
167
|
-
rubygems_version: 2.2.
|
145
|
+
rubygems_version: 2.2.3
|
168
146
|
signing_key:
|
169
147
|
specification_version: 4
|
170
148
|
summary: Common utils used by active_merchant, active_fulfillment, and active_shipping
|
checksums.yaml.gz.sig
DELETED
data.tar.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
�z���*}z��.$����j�y���쥮-R}W��m�r}?���Q�rև��Rהk�7V͗��A$�X�3i�\7��[��%�W\H(��?��'�0��!q��'hf�]���e���b$���R$0GK��Ϛ�{g.=�N�t�u"�e�e���Z\�F+fxMfc�x��Q2Sʷ�nw����s�._h,j�;Q�[� �t�t�Ƴ\���(w��K+Ġ����,koB�BS\�P�C<�
|
metadata.gz.sig
DELETED
Binary file
|