segurocomar 0.2.1 → 0.3.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: 9051dc23d599052c4f2909f24909d988df60beb0
4
- data.tar.gz: 29d9954eb9fa8f9317bacd7ce5a33d2a713b5cfe
3
+ metadata.gz: 32053d75b694730420a024de9fcbc5334691ede5
4
+ data.tar.gz: 340fdf84bea0437f18dd111b2c09b22bf9e9a927
5
5
  SHA512:
6
- metadata.gz: 58cc4cd130d4bd37d09c678685de654c005a5a7963ac0a34d6689aafdc95bb37bacd81d2839dbd88c7abb9dcae2676c02072405f23bf29276e1eb3ec02645eed
7
- data.tar.gz: e5622538fd2ecb7ffad3d14f215f039629846dc5ad86a7877bc642624c01201b06bda0d7f80f72127087a364a6283b69b26df77d5c5f2d8b7b729ef5543677db
6
+ metadata.gz: 22fde0aa89cf832b3cee3918b506153b8e934194f138c0b490bfeb08c09de0611547d16df77b9fa13bbc7b148b72e83799c8182d3b1fcb05f1831669f906c78d
7
+ data.tar.gz: a4e102f5d00c3081c059a6f9574e226ff4a28238f9c0c1d20cf57daa9988e719f24270486ae3647a505a18e4c95d31cd1d53684f87d667b8565603d86e7c773a
data/CHANGELOG.md CHANGED
@@ -57,3 +57,11 @@
57
57
  ## v0.2.1
58
58
 
59
59
  * Fix on get quote products
60
+
61
+ ## v0.2.2
62
+
63
+ * Removed method to calculate product prices
64
+
65
+ ## v0.3.0
66
+
67
+ * Added art activities, refactor quote methods
data/lib/segurocomar.rb CHANGED
@@ -2,6 +2,7 @@ require "segurocomar/version"
2
2
 
3
3
  # entities
4
4
  require "segurocomar/entity/ad_campaign"
5
+ require "segurocomar/entity/art_activity"
5
6
  require "segurocomar/entity/bicycle_value"
6
7
  require "segurocomar/entity/car"
7
8
  require "segurocomar/entity/car_brand"
@@ -1,6 +1,28 @@
1
1
  module Segurocomar
2
2
  module Core
3
3
  module ArtActivities
4
+ def get_art_activities(filters={})
5
+ get_request('/art_activities', filters)[:body].map { |r|
6
+ Segurocomar::Entity::ArtActivity.new({
7
+ ciiu: r['ciiu'],
8
+ label: r['name']
9
+ })
10
+ }
11
+ end
12
+
13
+ def get_art_activity(ciiu)
14
+ result = get_request("/art_activities/#{ciiu}")[:body]
15
+
16
+ if result
17
+ Segurocomar::Entity::ArtActivity.new({
18
+ ciiu: result['ciiu'],
19
+ label: result['name']
20
+ })
21
+ else
22
+ nil
23
+ end
24
+ end
25
+
4
26
  end
5
27
  end
6
28
  end
@@ -26,15 +26,7 @@ module Segurocomar
26
26
  results[:body].map { |r| Segurocomar::Entity::QuoteProduct.new(r) }
27
27
  end
28
28
 
29
- def calculate_product_prices(quote_id, product_ids)
30
- results = post_request("/quotes/#{quote_id}/calculate_product_prices", {
31
- product_ids: product_ids.join(',')
32
- })
33
-
34
- results[:body].map { |r| Segurocomar::Entity::QuoteProduct.new(r) }
35
- end
36
-
37
- def hire_quoted_product(quote_id, product_id)
29
+ def hire_quote_product(quote_id, product_id)
38
30
  result = post_request("/quotes/#{quote_id}/hire_product/#{product_id}")
39
31
 
40
32
  Segurocomar::Entity::QuoteProduct.new(result[:body])
@@ -0,0 +1,21 @@
1
+ module Segurocomar
2
+ module Entity
3
+ class ArtActivity
4
+ def self.attr_list
5
+ [:ciiu, :label]
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.2.1"
2
+ VERSION = "0.3.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.2.1
4
+ version: 0.3.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-13 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,6 +73,7 @@ files:
73
73
  - lib/segurocomar/core/quotes.rb
74
74
  - lib/segurocomar/core/trucks.rb
75
75
  - lib/segurocomar/entity/ad_campaign.rb
76
+ - lib/segurocomar/entity/art_activity.rb
76
77
  - lib/segurocomar/entity/bicycle_value.rb
77
78
  - lib/segurocomar/entity/car.rb
78
79
  - lib/segurocomar/entity/car_brand.rb