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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +7 -3
- data/lib/hasoffersv3/client.rb +3 -1
- data/lib/hasoffersv3/configuration.rb +3 -1
- data/lib/hasoffersv3/version.rb +1 -1
- data/spec/lib/client_spec.rb +23 -0
- metadata +3 -4
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f64c8f3d0d57beda32e5ef1d25ed95a558393b
|
4
|
+
data.tar.gz: 692dbf2dabdfe35852e531616195e0f5031dd478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63a6e628f27d70f8dadd04b2004b7b16ea3375a96b41ae95004b7de91258ecddf33152329fb4c48a0257a9d8aa675da60ca15ee31e986c33d7922ca44e7f6aa9
|
7
|
+
data.tar.gz: c45cfc59c8c669041f27f26aec86cc20709fc6955822963be39749dfa1c2845cabaf958419fd3825a7daff4c77a61d0e2ff2d0122f752b7dd22fb9d2a0e6b3c1
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
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
|
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 =
|
29
|
-
config.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
|
|
data/lib/hasoffersv3/client.rb
CHANGED
@@ -55,7 +55,9 @@ class HasOffersV3
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def new_http(uri)
|
58
|
-
|
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
|
data/lib/hasoffersv3/version.rb
CHANGED
data/spec/lib/client_spec.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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
|