hasoffersv3 0.5.3 → 0.5.4

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: 8a264b90e0574ee7d010bf2b194791ca197b0fb4
4
- data.tar.gz: a759d45f7ea385836135fbcbeca5f295976fb214
3
+ metadata.gz: a5f64c8f3d0d57beda32e5ef1d25ed95a558393b
4
+ data.tar.gz: 692dbf2dabdfe35852e531616195e0f5031dd478
5
5
  SHA512:
6
- metadata.gz: aec5d0eec3c7027b4c6c6c06dc09fa682a12773276bcef3e4abcc3953cadcd900f10768bc2687efca33a408eca51dde60ab456d87ad8d0dbe973b6c56492724c
7
- data.tar.gz: 13138d5b997c71ca8511a099e9101c1f9afd5ad50c82dcee3808d3294a3b820fa14dc715967f2de7b79653656716285886ba3e661c745b71a9f3452f726b7757
6
+ metadata.gz: 63a6e628f27d70f8dadd04b2004b7b16ea3375a96b41ae95004b7de91258ecddf33152329fb4c48a0257a9d8aa675da60ca15ee31e986c33d7922ca44e7f6aa9
7
+ data.tar.gz: c45cfc59c8c669041f27f26aec86cc20709fc6955822963be39749dfa1c2845cabaf958419fd3825a7daff4c77a61d0e2ff2d0122f752b7dd22fb9d2a0e6b3c1
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  .DS_Store
19
19
  *.swp
20
+ .ruby-version
data/.travis.yml CHANGED
@@ -5,4 +5,5 @@ before_install:
5
5
  rvm:
6
6
  - 2.2.5
7
7
  - 2.3.1
8
+ - 2.4.0
8
9
  - ruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.5.4
2
+ - [#56] Enable configuring proxy. (@wowawiwa)
3
+
1
4
  # 0.5.3
2
5
  - [#55] Offer set affiliate status. (@moofkit)
3
6
 
data/README.md CHANGED
@@ -21,13 +21,17 @@ Supported ruby versions:
21
21
 
22
22
  First, check if the method you want to call is already defined in `hasoffersv3/lib/hasoffersv3/*`. If not, you will need to add the method yourself (either just use your fork or submit a PR with your changes).
23
23
 
24
- Next, create an initializer in your project in `config/intializers` and configure your API credentials like so:
24
+ Next, create an initializer in your project in `config/intializers`:
25
25
 
26
26
  ```ruby
27
27
  HasOffersV3.configure do |config|
28
- config.api_key = ENV['YOUR_HAS_OFFERS_API_KEY']
29
- config.network_id = ENV['YOUR_HAS_OFFERS_NETWORK_ID']
28
+ config.api_key = 'Your HasOffers API Key'
29
+ config.network_id = 'Your HasOffers Network ID'
30
30
  config.read_timeout = 10
31
+
32
+ # Optionally configure a proxy:
33
+ config.proxy_host = 'yourproxy.com'
34
+ config.proxy_port = 8080
31
35
  end
32
36
  ```
33
37
 
@@ -55,7 +55,9 @@ class HasOffersV3
55
55
  end
56
56
 
57
57
  def new_http(uri)
58
- http = Net::HTTP.new(uri.host, uri.port)
58
+ args = [uri.host, uri.port]
59
+ args += [configuration.proxy_host, configuration.proxy_port] if configuration.proxy_host
60
+ http = Net::HTTP.new(*args)
59
61
  http.use_ssl = true if uri.scheme == 'https'
60
62
  http.read_timeout = configuration.read_timeout
61
63
  http
@@ -20,7 +20,9 @@ class HasOffersV3
20
20
  network_id: '',
21
21
  api_key: '',
22
22
  json_driver: self.default_json_driver,
23
- logger: nil
23
+ logger: nil,
24
+ proxy_host: nil,
25
+ proxy_port: nil,
24
26
  }.freeze
25
27
 
26
28
  DEFAULTS.keys.each do |option_name|
@@ -1,3 +1,3 @@
1
1
  class HasOffersV3
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
@@ -1,4 +1,27 @@
1
1
  describe HasOffersV3::Client do
2
+ let(:config) { HasOffersV3::Configuration.new }
3
+ subject { HasOffersV3::Client.new(config) }
4
+
5
+ describe '#new_http' do
6
+
7
+ context 'when configuration proxy_host is present' do
8
+
9
+ let(:config) {
10
+ result = HasOffersV3::Configuration.new
11
+ result.proxy_host = 'proxy.com'
12
+ result.proxy_port = '8080'
13
+ result
14
+ }
15
+
16
+ it 'generates a connection with proxy' do
17
+ http_client = subject.new_http(URI('http://hasoffers.com:9300/'))
18
+ expect(http_client.proxyaddr).to eq('proxy.com')
19
+ expect(http_client.proxyport).to eq('8080')
20
+ end
21
+
22
+ end
23
+
24
+ end
2
25
 
3
26
  describe '#base_uri' do
4
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hasoffersv3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximilian Seifert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-11 00:00:00.000000000 Z
12
+ date: 2017-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -91,7 +91,6 @@ extra_rdoc_files: []
91
91
  files:
92
92
  - ".gitignore"
93
93
  - ".rspec"
94
- - ".ruby-version"
95
94
  - ".travis.yml"
96
95
  - CHANGELOG.md
97
96
  - Gemfile
@@ -159,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
158
  version: '0'
160
159
  requirements: []
161
160
  rubyforge_project:
162
- rubygems_version: 2.5.1
161
+ rubygems_version: 2.6.10
163
162
  signing_key:
164
163
  specification_version: 4
165
164
  summary: REST Client for the HasOffers API, version 3.
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.3.0