auto_ria_api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/auto_ria_api.rb +10 -11
- data/lib/auto_ria_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8510748df81bd748312782710a402741ef40d43e1c99534074edcd6c99a3fbc
|
4
|
+
data.tar.gz: 24dd5cf3ef295c3233aa4d3dc077189713db56840ea3e8acef5b43315959cfbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33be752da4987dfc7dc6f8ffde4cb9b6c98f9e13ac44992d9fbb6ced4e09dfff64f6bd82fdc4ac4f65203ef890f9316c592850c019daeb5b8a33b1545fbd5d7e
|
7
|
+
data.tar.gz: cd375a982d420af853b01dc1c4d347582446d027338a5c03a9f1011ec208bad2f3f19c63d52b38a9743aa58ec603c724dc69ae119fd666677f5c69e3c050bbd2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -29,11 +29,11 @@ First of all you need an api_key which you can get at [https://developers.ria.co
|
|
29
29
|
# Methods:
|
30
30
|
@client.types
|
31
31
|
@client.carcasses(type:, grouped: false, all: false)
|
32
|
-
@client.marks(
|
33
|
-
@client.models(
|
32
|
+
@client.marks(type:)
|
33
|
+
@client.models(type:, mark, grouped: false, all: false)
|
34
34
|
@client.regions
|
35
35
|
@client.cities(region:)
|
36
|
-
@client.gearboxes(
|
36
|
+
@client.gearboxes(type:)
|
37
37
|
@client.fuels
|
38
38
|
@client.colors
|
39
39
|
@client.options(type:)
|
data/lib/auto_ria_api.rb
CHANGED
@@ -21,17 +21,17 @@ module AutoRiaApi
|
|
21
21
|
request "/auto/categories/#{type}/bodystyles/#{group}"
|
22
22
|
end
|
23
23
|
|
24
|
-
def marks(
|
25
|
-
raise ArgumentError, '
|
26
|
-
request "/auto/categories/#{
|
24
|
+
def marks(type:)
|
25
|
+
raise ArgumentError, 'Type should not be empty.' if blank?(type)
|
26
|
+
request "/auto/categories/#{type}/marks"
|
27
27
|
end
|
28
28
|
|
29
|
-
def models(
|
30
|
-
raise ArgumentError, '
|
29
|
+
def models(type:, mark:, grouped: false, all: false)
|
30
|
+
raise ArgumentError, 'Type should not be empty.' if blank?(type)
|
31
31
|
raise ArgumentError, 'Mark should not be empty.' if blank?(mark)
|
32
32
|
return request '/auto/models' if all
|
33
33
|
group = '_group' if grouped
|
34
|
-
request "/auto/categories/#{
|
34
|
+
request "/auto/categories/#{type}/marks/#{mark}/models/#{group}"
|
35
35
|
end
|
36
36
|
|
37
37
|
def regions
|
@@ -43,9 +43,9 @@ module AutoRiaApi
|
|
43
43
|
request "/auto/states/#{region}/cities"
|
44
44
|
end
|
45
45
|
|
46
|
-
def gearboxes(
|
47
|
-
raise ArgumentError, '
|
48
|
-
request "/auto/categories/#{
|
46
|
+
def gearboxes(type:)
|
47
|
+
raise ArgumentError, 'Type should not be empty.' if blank?(type)
|
48
|
+
request "/auto/categories/#{type}/gearboxes"
|
49
49
|
end
|
50
50
|
|
51
51
|
def driver_types
|
@@ -94,10 +94,9 @@ module AutoRiaApi
|
|
94
94
|
|
95
95
|
def parsed(response)
|
96
96
|
res = JSON.parse(response.body)
|
97
|
+
raise Error, res.dig('error') if res.is_a?(Hash) && res.has_key?('error')
|
97
98
|
yield res if block_given?
|
98
99
|
res
|
99
|
-
rescue => e
|
100
|
-
e
|
101
100
|
end
|
102
101
|
|
103
102
|
def blank?(arg)
|
data/lib/auto_ria_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_ria_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- drkmen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|