edmunds_api 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/edmunds/request.rb +7 -1
- data/lib/edmunds/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab71a6b34bd18a4d4d141df00faddd71f8f77918
|
4
|
+
data.tar.gz: 5b7fde93e9206b35c21b5df3337760b6bb385f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964443fdef90764a16b7203f580c02975cca5b2489f29e98b6cad03e4cfcc1223afbf9bd7c07a7eaad931eb910e60d799b07f035b72ad66df8f93fb8567bee95
|
7
|
+
data.tar.gz: 17d1dc9e5f309e9a9e41b31fb1e239fb6ee2e2bc91210a0cdf1ba2c04e548cb93f4881a43d27be94569f7066e5cd91e432b39182933aa3d3ed5ab86c9b65a70f
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Edmunds Api ruby client.
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'edmunds_api', '~> 0.1.
|
16
|
+
gem 'edmunds_api', '~> 0.1.5'
|
17
17
|
```
|
18
18
|
|
19
19
|
And then execute:
|
@@ -30,6 +30,7 @@ Add api_key in initializer:
|
|
30
30
|
```ruby
|
31
31
|
Edmunds.configure do |config|
|
32
32
|
config.api_key = 'your-api-key'
|
33
|
+
config.timeout = 5
|
33
34
|
end
|
34
35
|
```
|
35
36
|
Basic usage:
|
data/lib/edmunds/request.rb
CHANGED
@@ -3,12 +3,13 @@ module Edmunds
|
|
3
3
|
|
4
4
|
API_URL = 'https://api.edmunds.com/api'
|
5
5
|
API_VERSION = Edmunds.configuration.api_version.to_s
|
6
|
+
DEFAULT_TIMEOUT = 15
|
6
7
|
|
7
8
|
def api_call(api_path, path, options={})
|
8
9
|
url = build_api_url api_path, path
|
9
10
|
request_params = merge_required_params options
|
10
11
|
raise 'No api_key found' if request_params[:api_key].empty?
|
11
|
-
response = HTTP.headers(http_headers).get(url, params: request_params)
|
12
|
+
response = HTTP.timeout(*timeout).headers(http_headers).get(url, params: request_params)
|
12
13
|
parse_response response
|
13
14
|
end
|
14
15
|
|
@@ -33,6 +34,11 @@ module Edmunds
|
|
33
34
|
}
|
34
35
|
end
|
35
36
|
|
37
|
+
def timeout
|
38
|
+
timeout = Edmunds.configuration.timeout || DEFAULT_TIMEOUT
|
39
|
+
[:global, connect: timeout]
|
40
|
+
end
|
41
|
+
|
36
42
|
def parse_response(response)
|
37
43
|
begin
|
38
44
|
body = JSON.parse response.body
|
data/lib/edmunds/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edmunds_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Belyaev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.5.1
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Edmunds Api ruby client
|