api2cart-ruby 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7da9d481a2ca97c77288a08317918fd795b742a
4
- data.tar.gz: 93d0a824c3299f4d50a073b3f2583123fad82e97
3
+ metadata.gz: 8ab8789095578d475cb638aacf6de3673d879716
4
+ data.tar.gz: 9e86285773bf57ac40fd5976a39bcac6ffb3d5c3
5
5
  SHA512:
6
- metadata.gz: e634e1f644cfdf641eec2c9d3da682d457bd7c3d6239ac33552eacf2f0e0e628582713e1de5e7083f9969af65bf77d54e9463716e09e40fb562a5d4cde46071f
7
- data.tar.gz: f0957f17c4002a871b3db006dfbe79ad12a9d44d5433d080f74662831c36538a154480a2dd9a8b10cefb8e8aee86819271ed921fdf36f07c1237f50ff13cacee
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)
@@ -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}
@@ -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 = net_http_class.get_response(request_url).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 net_http_class
40
- proxy_url.present? ?
41
- Net::HTTP::Proxy(parsed_proxy_url.host, parsed_proxy_url.port) :
42
- Net::HTTP
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
@@ -1,3 +1,3 @@
1
1
  module Api2cart
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -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(:Proxy).with('anti-throttling-proxy.local', 1080).and_call_original
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.1.0
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: 2014-12-02 00:00:00.000000000 Z
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.2
175
+ rubygems_version: 2.4.4
175
176
  signing_key:
176
177
  specification_version: 4
177
178
  summary: Ruby client for API2Cart