segurocomar 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/segurocomar.rb +1 -0
- data/lib/segurocomar/core/cars.rb +10 -5
- data/lib/segurocomar/entity/car.rb +1 -1
- data/lib/segurocomar/entity/car_brand.rb +1 -1
- data/lib/segurocomar/entity/car_version.rb +1 -1
- data/lib/segurocomar/entity/car_version_price.rb +21 -0
- data/lib/segurocomar/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0a24944ed6654b25234d373b4d9c8d3fecd35ac
|
4
|
+
data.tar.gz: e85fdc038b916d404decdda37aca4c5f15a32039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83237990b87b7d685cb7036e2d69bf88f0af7c78a0e048180bb190a21bda4246922f9d57a1ab9a1a2062a7bf7075d3d920a807af76fdcd611790cc179d82a49
|
7
|
+
data.tar.gz: 99c23c095a79ebc800af0556c177eaf4c5813c4c99026cf827e434c8decf14051fc0cd4a98f42b04a32f80143ff0cd9965e1900c623ace8b3027f5dac418e278
|
data/CHANGELOG.md
CHANGED
data/lib/segurocomar.rb
CHANGED
@@ -7,6 +7,7 @@ require "segurocomar/entity/bicycle_value"
|
|
7
7
|
require "segurocomar/entity/car"
|
8
8
|
require "segurocomar/entity/car_brand"
|
9
9
|
require "segurocomar/entity/car_version"
|
10
|
+
require "segurocomar/entity/car_version_price"
|
10
11
|
require "segurocomar/entity/coverage"
|
11
12
|
require "segurocomar/entity/insurable_year"
|
12
13
|
require "segurocomar/entity/insurer"
|
@@ -7,16 +7,21 @@ module Segurocomar
|
|
7
7
|
results[:body].map { |r| Segurocomar::Entity::CarBrand.new(r) }
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def get_cars(car_brand_id, year)
|
11
|
+
results = get_request('/cars', { car_brand_id: car_brand_id, year: year })
|
12
|
+
|
13
|
+
results[:body].map { |r| Segurocomar::Entity::Car.new(r) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_car_versions(car_id, year)
|
11
17
|
results = get_request('/car_versions', { car_brand_id: car_brand_id, year: year })
|
12
18
|
|
13
19
|
results[:body].map { |r| Segurocomar::Entity::CarVersion.new(r) }
|
14
20
|
end
|
15
21
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
results[:body].map { |r| Segurocomar::Entity::Car.new(r) }
|
22
|
+
def get_car_version_price(car_version_id, year)
|
23
|
+
result = get_request("/car_versions/#{car_version_id}/price", { year: year })
|
24
|
+
Segurocomar::Entity::CarVersionPrice.new(result[:body])
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class CarVersionPrice
|
4
|
+
def self.attr_list
|
5
|
+
[:year, :value]
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader *attr_list
|
9
|
+
|
10
|
+
def initialize(attributes={})
|
11
|
+
attributes.each do |k, v|
|
12
|
+
self.send("#{k}=", v) if self.respond_to?(k)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_writer *attr_list
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/segurocomar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: segurocomar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Hick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/segurocomar/entity/car.rb
|
79
79
|
- lib/segurocomar/entity/car_brand.rb
|
80
80
|
- lib/segurocomar/entity/car_version.rb
|
81
|
+
- lib/segurocomar/entity/car_version_price.rb
|
81
82
|
- lib/segurocomar/entity/coverage.rb
|
82
83
|
- lib/segurocomar/entity/insurable_year.rb
|
83
84
|
- lib/segurocomar/entity/insurer.rb
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
112
|
version: '0'
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.4.5.1
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: Connect to segurocomar through API
|