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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32053d75b694730420a024de9fcbc5334691ede5
4
- data.tar.gz: 340fdf84bea0437f18dd111b2c09b22bf9e9a927
3
+ metadata.gz: a0a24944ed6654b25234d373b4d9c8d3fecd35ac
4
+ data.tar.gz: e85fdc038b916d404decdda37aca4c5f15a32039
5
5
  SHA512:
6
- metadata.gz: 22fde0aa89cf832b3cee3918b506153b8e934194f138c0b490bfeb08c09de0611547d16df77b9fa13bbc7b148b72e83799c8182d3b1fcb05f1831669f906c78d
7
- data.tar.gz: a4e102f5d00c3081c059a6f9574e226ff4a28238f9c0c1d20cf57daa9988e719f24270486ae3647a505a18e4c95d31cd1d53684f87d667b8565603d86e7c773a
6
+ metadata.gz: c83237990b87b7d685cb7036e2d69bf88f0af7c78a0e048180bb190a21bda4246922f9d57a1ab9a1a2062a7bf7075d3d920a807af76fdcd611790cc179d82a49
7
+ data.tar.gz: 99c23c095a79ebc800af0556c177eaf4c5813c4c99026cf827e434c8decf14051fc0cd4a98f42b04a32f80143ff0cd9965e1900c623ace8b3027f5dac418e278
data/CHANGELOG.md CHANGED
@@ -65,3 +65,7 @@
65
65
  ## v0.3.0
66
66
 
67
67
  * Added art activities, refactor quote methods
68
+
69
+ ## v0.4.0
70
+
71
+ * Refactor car methods
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 get_car_versions(car_brand_id, year)
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 get_cars(car_version_id, year)
17
- results = get_request('/cars', { car_version_id: car_version_id, year: year })
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
@@ -2,7 +2,7 @@ module Segurocomar
2
2
  module Entity
3
3
  class Car
4
4
  def self.attr_list
5
- [:id, :code, :name]
5
+ [:id, :car_brand_code, :name]
6
6
  end
7
7
 
8
8
  attr_reader *attr_list
@@ -2,7 +2,7 @@ module Segurocomar
2
2
  module Entity
3
3
  class CarBrand
4
4
  def self.attr_list
5
- [:id, :name, :featured]
5
+ [:id, :name, :code, :featured]
6
6
  end
7
7
 
8
8
  attr_reader *attr_list
@@ -2,7 +2,7 @@ module Segurocomar
2
2
  module Entity
3
3
  class CarVersion
4
4
  def self.attr_list
5
- [:id, :name]
5
+ [:id, :name, :car_brand_code, :code, :full_code]
6
6
  end
7
7
 
8
8
  attr_reader *attr_list
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Segurocomar
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-09-16 00:00:00.000000000 Z
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.2.5
115
+ rubygems_version: 2.4.5.1
115
116
  signing_key:
116
117
  specification_version: 4
117
118
  summary: Connect to segurocomar through API