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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5caae8aa8075311f32ab6e0f8149bb057b783d5cd979852bd30d909bba996050
4
- data.tar.gz: 7d6230f3c47fb5c01b480545f642c7d00d0eebf94c36818fdee5e50ddaa45c4f
3
+ metadata.gz: c8510748df81bd748312782710a402741ef40d43e1c99534074edcd6c99a3fbc
4
+ data.tar.gz: 24dd5cf3ef295c3233aa4d3dc077189713db56840ea3e8acef5b43315959cfbc
5
5
  SHA512:
6
- metadata.gz: 2595abd9e498148b3c1fbb9132f49d6d07c6dc13b5c596a078be43fcfa997d643cc83fa5896d62f5714ed5e2b8955629662718baf2948f138b71c7b33be308da
7
- data.tar.gz: de27cc731c0ed753c1db86ac2b7715e3c41849aeb263a5cb1a831b647da42cf305325707df8e5d44ddd5a21657f69c314f3e137187705d52ec528a014fb6f99b
6
+ metadata.gz: 33be752da4987dfc7dc6f8ffde4cb9b6c98f9e13ac44992d9fbb6ced4e09dfff64f6bd82fdc4ac4f65203ef890f9316c592850c019daeb5b8a33b1545fbd5d7e
7
+ data.tar.gz: cd375a982d420af853b01dc1c4d347582446d027338a5c03a9f1011ec208bad2f3f19c63d52b38a9743aa58ec603c724dc69ae119fd666677f5c69e3c050bbd2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auto_ria_api (0.1.3)
4
+ auto_ria_api (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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(carcasse:)
33
- @client.models(carcasse:, mark, grouped: false, all: false)
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(carcasse:)
36
+ @client.gearboxes(type:)
37
37
  @client.fuels
38
38
  @client.colors
39
39
  @client.options(type:)
@@ -21,17 +21,17 @@ module AutoRiaApi
21
21
  request "/auto/categories/#{type}/bodystyles/#{group}"
22
22
  end
23
23
 
24
- def marks(carcasse:)
25
- raise ArgumentError, 'Carcass should not be empty.' if blank?(carcasse)
26
- request "/auto/categories/#{carcasse}/marks"
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(carcasse:, mark:, grouped: false, all: false)
30
- raise ArgumentError, 'Carcass should not be empty.' if blank?(carcasse)
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/#{carcasse}/marks/#{mark}/models/#{group}"
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(carcasse:)
47
- raise ArgumentError, 'Carcasse should not be empty.' if blank?(carcasse)
48
- request "/auto/categories/#{carcasse}/gearboxes"
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)
@@ -1,3 +1,3 @@
1
1
  module AutoRiaApi
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
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.3
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-13 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler