api2cart-ruby 1.1.0 → 1.2.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/README.md +6 -0
- data/api2cart-ruby.gemspec +1 -1
- data/lib/api2cart/client.rb +11 -5
- data/lib/api2cart/version.rb +1 -1
- data/spec/api2cart/with_proxy_spec.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ab8789095578d475cb638aacf6de3673d879716
|
4
|
+
data.tar.gz: 9e86285773bf57ac40fd5976a39bcac6ffb3d5c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821124ef0dbbf9b7a18c6576231001f66dc8008ca631792cdaeb7ed230ecc93e5dfa0a111874a17e93565a39da0d76e311e9f5bf55f92227f37df542c03eee17
|
7
|
+
data.tar.gz: d56756525e4a7824f6b1657e2dd980527ea81cd508819dbb20ccc668882dac9b3e30b1487a0ec3c096c95ce6e42d8b20e87015811b135c0df2fffeeb4a29bb01
|
data/README.md
CHANGED
@@ -32,4 +32,10 @@ Api2cart::Store.new(api_key, store_key, proxy: 'http://anti-throttling-proxy.loc
|
|
32
32
|
# => { 'products_count' => 76 }
|
33
33
|
```
|
34
34
|
|
35
|
+
## Contributors
|
36
|
+
|
37
|
+
* [Anton Pershakov](https://github.com/main24)
|
38
|
+
* [Daniel Vartanov](https://github.com/DanielVartanov)
|
39
|
+
* [Tom Procter](https://github.com/TDProcter)
|
40
|
+
|
35
41
|
Sponsored by [Veeqo](https://github.com/veeqo)
|
data/api2cart-ruby.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "api2cart-ruby"
|
8
8
|
spec.version = Api2cart::VERSION
|
9
9
|
|
10
|
-
spec.authors = ["Tom Procter", "Daniel Vartanov"].sort
|
10
|
+
spec.authors = ["Tom Procter", "Daniel Vartanov", "Anton Pershakov"].sort
|
11
11
|
spec.email = ["tom@procterweb.co.uk", "dan@vartanov.net"]
|
12
12
|
|
13
13
|
spec.summary = %q{Ruby client for API2Cart}
|
data/lib/api2cart/client.rb
CHANGED
@@ -4,8 +4,10 @@ require 'active_support/core_ext/object/blank'
|
|
4
4
|
|
5
5
|
module Api2cart
|
6
6
|
class Client < Struct.new(:request_url, :proxy_url)
|
7
|
+
READ_TIMEOUT = 2000
|
8
|
+
|
7
9
|
def make_request!
|
8
|
-
self.response_body =
|
10
|
+
self.response_body = net_http.get(request_url.request_uri).body
|
9
11
|
end
|
10
12
|
|
11
13
|
def successful?
|
@@ -36,10 +38,14 @@ module Api2cart
|
|
36
38
|
@parsed_proxy_url ||= URI.parse proxy_url
|
37
39
|
end
|
38
40
|
|
39
|
-
def
|
40
|
-
proxy_url.present?
|
41
|
-
Net::HTTP
|
42
|
-
|
41
|
+
def net_http
|
42
|
+
if proxy_url.present?
|
43
|
+
Net::HTTP.new request_url.host, request_url.port, parsed_proxy_url.host, parsed_proxy_url.port
|
44
|
+
else
|
45
|
+
Net::HTTP.new request_url.host, request_url.port
|
46
|
+
end.tap do |net_http|
|
47
|
+
net_http.read_timeout = READ_TIMEOUT
|
48
|
+
end
|
43
49
|
end
|
44
50
|
end
|
45
51
|
end
|
data/lib/api2cart/version.rb
CHANGED
@@ -12,7 +12,7 @@ describe Api2cart do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'extracts hostname and port from proxy URL' do
|
15
|
-
expect(Net::HTTP).to receive(:
|
15
|
+
expect(Net::HTTP).to receive(:new).with('api.api2cart.com', 80, 'anti-throttling-proxy.local', 1080).and_call_original
|
16
16
|
store_with_proxy.product_count
|
17
17
|
end
|
18
18
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api2cart-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Anton Pershakov
|
7
8
|
- Daniel Vartanov
|
8
9
|
- Tom Procter
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activesupport
|
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
172
|
version: '0'
|
172
173
|
requirements: []
|
173
174
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.4.
|
175
|
+
rubygems_version: 2.4.4
|
175
176
|
signing_key:
|
176
177
|
specification_version: 4
|
177
178
|
summary: Ruby client for API2Cart
|