edmunds 0.0.3 → 0.0.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: 5d74986e9b762968e63e37e2aaa81e6e3f4e7884
4
- data.tar.gz: 2d4103061e4fa38c5c2caf2c073dc06202059e26
3
+ metadata.gz: 917937e5e9df9c64fb0706dbb87c72f8d0ef8c18
4
+ data.tar.gz: 8fbb2d8f8d64f41b847cbe8f139cf22b814b0a47
5
5
  SHA512:
6
- metadata.gz: 69bca0aee1e1c38fc5141c24f0290b1c6acab897381305fc4072bcfb97e146474c05efb33913e99263f5b3ca3f4b59daaa75eb399c78f82e6d6d720c6a3afad1
7
- data.tar.gz: 185beb70694a9a93cb852340a4336e0d9c26faa6511cb67a512fbbe6ba94d75fc6f06abb327e0b915eff2dc9fd297cf7306dad264f553b4ba7420934983b64bc
6
+ metadata.gz: 4065f0b0cbc1c39b37a4dc6e8e3d984bff0f4731796ffdf92ca83eec83a85c1928fc001ed643d1aae38747884793b5e78dd49f40576ba27cd8b1deabdf648692
7
+ data.tar.gz: d9b2fcfe8e45cd6b2ceb447763b76b8e0984b0eddfd557bd8342bde244d689a6feccc9a5f9a2af5baff1678e143f9b4b6bd076ee980a6ed51a32961a57bc28e9
@@ -23,6 +23,36 @@ module Edmunds
23
23
  new(attributes)
24
24
  end
25
25
  end
26
+
27
+ class Models
28
+ attr_reader :models, :count
29
+
30
+ def initialize(attributes)
31
+ @count = attributes["modelsCount"]
32
+ @models = attributes["models"].map {|json| Model.new(json)} if attributes.key?("models")
33
+ end
34
+
35
+ def self.find(make_name, api_params = {})
36
+ response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/models", api_params)
37
+ attributes = JSON.parse(response.body)
38
+ new(attributes)
39
+ end
40
+ end
41
+
42
+ class ModelsCount
43
+ attr_reader :count
44
+
45
+ def initialize(attributes)
46
+ @count = attributes["modelsCount"]
47
+ end
48
+
49
+ def self.find(make_name, api_params = {})
50
+ response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/models/count", api_params)
51
+ attributes = JSON.parse(response.body)
52
+ new(attributes)
53
+ end
54
+ end
55
+
26
56
  end
27
57
  end
28
58
  end
@@ -24,6 +24,35 @@ module Edmunds
24
24
  end
25
25
  end
26
26
 
27
+ class ModelYears
28
+ attr_reader :model_years, :count
29
+
30
+ def initialize(attributes)
31
+ @count = attributes["yearsCount"]
32
+ @model_years = attributes["years"].map {|json| ModelYear.new(json)} if attributes.key?("years")
33
+ end
34
+
35
+ def self.find(make_name, model_name, api_params = {})
36
+ response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/#{model_name}/years", api_params)
37
+ attributes = JSON.parse(response.body)
38
+ new(attributes)
39
+ end
40
+ end
41
+
42
+ class ModelYearsCount
43
+ attr_reader :count
44
+
45
+ def initialize(attributes)
46
+ @count = attributes["yearsCount"]
47
+ end
48
+
49
+ def self.find(make_name, model_name, api_params = {})
50
+ response = Edmunds::Api.get("#{MODEL_API_URL}/#{make_name}/#{model_name}/years/count", api_params)
51
+ attributes = JSON.parse(response.body)
52
+ new(attributes)
53
+ end
54
+ end
55
+
27
56
  end
28
57
  end
29
58
  end
@@ -2,6 +2,7 @@ require 'faraday'
2
2
  require 'json'
3
3
 
4
4
  STYLE_API_URL = Edmunds::Vehicle::API_URL_V2 + "/styles"
5
+ BASE_API_URL = Edmunds::Vehicle::API_URL_V2
5
6
 
6
7
  module Edmunds
7
8
  module Vehicle
@@ -29,6 +30,93 @@ module Edmunds
29
30
  end
30
31
  end
31
32
 
33
+ class StylesDetails
34
+ attr_reader :styles, :count
35
+
36
+ def initialize(attributes)
37
+ @count = attributes["stylesCount"]
38
+ @styles = attributes["styles"].map {|json| Style.new(json)} if attributes.key?("styles")
39
+ end
40
+
41
+ def self.find(make_name, model_name, model_year, api_params = {})
42
+ response = Edmunds::Api.get("#{BASE_API_URL}/#{make_name}/#{model_name}/#{model_year}/styles", api_params)
43
+ attributes = JSON.parse(response.body)
44
+ new(attributes)
45
+ end
46
+ end
47
+
48
+ # UNAUTHORIZED
49
+ # class StylesDetailsChrome
50
+ # attr_reader :styles, :count
51
+
52
+ # def initialize(attributes)
53
+ # @count = attributes["stylesCount"]
54
+ # @styles = attributes["styles"].map {|json| Style.new(json)} if attributes.key?("styles")
55
+ # end
56
+
57
+ # def self.find(chrome_id, api_params = {})
58
+ # response = Edmunds::Api.get("#{BASE_API_URL}/partners/chrome/styles/#{chrome_id}", api_params)
59
+ # attributes = JSON.parse(response.body)
60
+ # new(attributes)
61
+ # end
62
+ # end
63
+
64
+ class StylesCountMakeModelYear
65
+ attr_reader :count
66
+
67
+ def initialize(attributes)
68
+ @count = attributes["stylesCount"]
69
+ end
70
+
71
+ def self.find(make_name, model_name, model_year, api_params = {})
72
+ response = Edmunds::Api.get("#{BASE_API_URL}/#{make_name}/#{model_name}/#{model_year}/styles/count", api_params)
73
+ attributes = JSON.parse(response.body)
74
+ new(attributes)
75
+ end
76
+ end
77
+
78
+ class StylesCountMakeModel
79
+ attr_reader :count
80
+
81
+ def initialize(attributes)
82
+ @count = attributes["stylesCount"]
83
+ end
84
+
85
+ def self.find(make_name, model_name, api_params = {})
86
+ response = Edmunds::Api.get("#{BASE_API_URL}/#{make_name}/#{model_name}/styles/count", api_params)
87
+ attributes = JSON.parse(response.body)
88
+ new(attributes)
89
+ end
90
+ end
91
+
92
+ class StylesCountMake
93
+ attr_reader :count
94
+
95
+ def initialize(attributes)
96
+ @count = attributes["stylesCount"]
97
+ end
98
+
99
+ def self.find(make_name, api_params = {})
100
+ response = Edmunds::Api.get("#{BASE_API_URL}/#{make_name}/styles/count", api_params)
101
+ attributes = JSON.parse(response.body)
102
+ new(attributes)
103
+ end
104
+ end
105
+
106
+ class StylesCount
107
+ attr_reader :count
108
+
109
+ def initialize(attributes)
110
+ @count = attributes["stylesCount"]
111
+ end
112
+
113
+ def self.find(api_params = {})
114
+ response = Edmunds::Api.get("#{STYLE_API_URL}/count", api_params)
115
+ attributes = JSON.parse(response.body)
116
+ new(attributes)
117
+ end
118
+ end
119
+
32
120
  end
33
121
  end
34
122
  end
@@ -1,3 +1,3 @@
1
1
  module Edmunds
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edmunds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Parraga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.4.5
162
+ rubygems_version: 2.4.6
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Gem to wrap Edmunds.com API