segurocomar 0.0.1
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 +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.md +22 -0
- data/README.md +31 -0
- data/lib/segurocomar/api.rb +80 -0
- data/lib/segurocomar/core/art_activities.rb +7 -0
- data/lib/segurocomar/core/bicycles.rb +12 -0
- data/lib/segurocomar/core/cars.rb +24 -0
- data/lib/segurocomar/core/insurance.rb +30 -0
- data/lib/segurocomar/core/misc.rb +24 -0
- data/lib/segurocomar/core/motorcycles.rb +18 -0
- data/lib/segurocomar/core/quotes.rb +26 -0
- data/lib/segurocomar/core/trucks.rb +18 -0
- data/lib/segurocomar/entity/bicycle_value.rb +21 -0
- data/lib/segurocomar/entity/car.rb +21 -0
- data/lib/segurocomar/entity/car_brand.rb +21 -0
- data/lib/segurocomar/entity/car_version.rb +21 -0
- data/lib/segurocomar/entity/coverage.rb +21 -0
- data/lib/segurocomar/entity/insurable_year.rb +21 -0
- data/lib/segurocomar/entity/insurer.rb +25 -0
- data/lib/segurocomar/entity/locality.rb +21 -0
- data/lib/segurocomar/entity/motorcycle.rb +21 -0
- data/lib/segurocomar/entity/motorcycle_brand.rb +21 -0
- data/lib/segurocomar/entity/product.rb +25 -0
- data/lib/segurocomar/entity/province.rb +21 -0
- data/lib/segurocomar/entity/quoted_product.rb +22 -0
- data/lib/segurocomar/entity/truck.rb +21 -0
- data/lib/segurocomar/entity/truck_brand.rb +21 -0
- data/lib/segurocomar/version.rb +3 -0
- data/lib/segurocomar.rb +34 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2f42b06a5f07ae1459d2bd2cd642af0677cd0e09
|
4
|
+
data.tar.gz: 0b31754ad5e6e9542fc84bff0b2c213c79285a79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4006abb168a5c3f4b712e86e9e3ec3029f5fa60a09bea4a2b78af5f60cadfa15b6d9cc741309d814529a8d67454faf59f9cc46df2ca8863f219cefd48e3f1f27
|
7
|
+
data.tar.gz: cb6e1bc55fac51c5d61f98bac172ea8fba9b27f53331dd2422fd8b5011b69dbf8e1345a035543f2ec2a202400a9484024d2b9da8d63267d0299457098b000eb1
|
data/CHANGELOG.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 unformatt
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Segurocomar
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'segurocomar'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install segurocomar
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/segurocomar/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
class Api
|
3
|
+
def initialize(args={})
|
4
|
+
@access_token = args[:access_token]
|
5
|
+
@endpoint_url = args[:endpoint_url]
|
6
|
+
@debug = args[:debug]
|
7
|
+
end
|
8
|
+
|
9
|
+
include Segurocomar::Core::ArtActivities
|
10
|
+
include Segurocomar::Core::Bicycles
|
11
|
+
include Segurocomar::Core::Cars
|
12
|
+
include Segurocomar::Core::Insurance
|
13
|
+
include Segurocomar::Core::Misc
|
14
|
+
include Segurocomar::Core::Motorcycles
|
15
|
+
include Segurocomar::Core::Quotes
|
16
|
+
include Segurocomar::Core::Trucks
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_request(action, params={}, headers={})
|
21
|
+
begin
|
22
|
+
parse_response(RestClient.get("#{@endpoint_url}#{action}", {params: params}.merge(headers)))
|
23
|
+
rescue => e
|
24
|
+
parse_response(e.response)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def post_request(action, params={}, headers={})
|
29
|
+
begin
|
30
|
+
parse_response(RestClient.post("#{@endpoint_url}#{action}", params, headers))
|
31
|
+
rescue => e
|
32
|
+
parse_response(e.response)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def put_request(action, params={}, headers={})
|
37
|
+
begin
|
38
|
+
parse_response(RestClient.put("#{@endpoint_url}#{action}", params, headers))
|
39
|
+
rescue => e
|
40
|
+
parse_response(e.response)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def patch_request(action, params={}, headers={})
|
45
|
+
begin
|
46
|
+
parse_response(RestClient.patch("#{@endpoint_url}#{action}", params, headers))
|
47
|
+
rescue => e
|
48
|
+
parse_response(e.response)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def head_request(action, params={})
|
53
|
+
begin
|
54
|
+
parse_response(RestClient.head("#{@endpoint_url}#{action}", params))
|
55
|
+
rescue => e
|
56
|
+
parse_response(e.response)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def delete_request(action, params={})
|
61
|
+
begin
|
62
|
+
parse_response(RestClient.delete("#{@endpoint_url}#{action}", params))
|
63
|
+
rescue => e
|
64
|
+
parse_response(e.response)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def parse_response(response)
|
69
|
+
result = {
|
70
|
+
headers: response.headers,
|
71
|
+
body: (JSON.parse(response.body) rescue response.body),
|
72
|
+
status_code: response.code
|
73
|
+
}
|
74
|
+
|
75
|
+
p "DEBUG: #{result}" if @debug
|
76
|
+
|
77
|
+
result
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Cars
|
4
|
+
def get_car_brands
|
5
|
+
results = get_request('/car_brands')
|
6
|
+
|
7
|
+
results[:body].map { |r| Segurocomar::Entity::CarBrand.new(r) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_car_versions(car_brand_id, year)
|
11
|
+
results = get_request('/car_versions', { car_brand_id: car_brand_id, year: year })
|
12
|
+
|
13
|
+
results[:body].map { |r| Segurocomar::Entity::CarVersion.new(r) }
|
14
|
+
end
|
15
|
+
|
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) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Insurance
|
4
|
+
def get_insurers(insurable_kind)
|
5
|
+
results = get_request("/insurers", { insurable_kind: insurable_kind })
|
6
|
+
|
7
|
+
results[:body].map { |r| Segurocomar::Entity::Insurer.new(r) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_insurer(id, insurable_kind)
|
11
|
+
result = get_request("/insurers/#{id}", { insurable_kind: insurable_kind })
|
12
|
+
|
13
|
+
Segurocomar::Entity::Insurer.new(result[:body])
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_products(args={})
|
17
|
+
results = get_request("/products", args)
|
18
|
+
|
19
|
+
results[:body].map { |r| Segurocomar::Entity::Product.new(r) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_product(id)
|
23
|
+
result = get_request("/products/#{id}")
|
24
|
+
|
25
|
+
Segurocomar::Entity::Product.new(result[:body])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Misc
|
4
|
+
def get_insurable_years
|
5
|
+
results = get_request('/valid_years')
|
6
|
+
|
7
|
+
results[:body].map { |r| Segurocomar::Entity::InsurableYear.new(r) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_provinces
|
11
|
+
results = get_request('/provinces')
|
12
|
+
|
13
|
+
results[:body].map { |r| Segurocomar::Entity::Province.new(r) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_localities(args={})
|
17
|
+
results = get_request('/localities', args)
|
18
|
+
|
19
|
+
results[:body].map { |r| Segurocomar::Entity::Locality.new(r) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Motorcycles
|
4
|
+
def get_motorcycle_brands
|
5
|
+
results = get_request('/motorcycle_brands')
|
6
|
+
|
7
|
+
results[:body].map { |r| Segurocomar::Entity::MotorcycleBrand.new(r) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_motorcycles(motorcycle_brand_id)
|
11
|
+
results = get_request('/motorcycles', { motorcycle_brand_id: motorcycle_brand_id })
|
12
|
+
|
13
|
+
results[:body].map { |r| Segurocomar::Entity::Motorcycle.new(r) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Quotes
|
4
|
+
def create_quote(quote_data={})
|
5
|
+
results = post_request('/quotes', quote_data)
|
6
|
+
|
7
|
+
results[:body]['quote_id']
|
8
|
+
end
|
9
|
+
|
10
|
+
def calculate_product_prices(quote_id, product_ids)
|
11
|
+
results = post_request("/quotes/#{quote_id}/calculate_product_prices", {
|
12
|
+
product_ids: product_ids.join(',')
|
13
|
+
})
|
14
|
+
|
15
|
+
results[:body].map { |r| Segurocomar::Entity::QuotedProduct.new(r) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def hire_quoted_product(quote_id, product_id)
|
19
|
+
result = post_request("/quotes/#{quote_id}/hire_product/#{product_id}")
|
20
|
+
|
21
|
+
Segurocomar::Entity::QuotedProduct.new(result[:body])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Core
|
3
|
+
module Trucks
|
4
|
+
def get_truck_brands
|
5
|
+
results = get_request('/truck_brands')
|
6
|
+
|
7
|
+
results[:body].map { |r| Segurocomar::Entity::TruckBrand.new(r) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_trucks(truck_brand_id)
|
11
|
+
results = get_request('/trucks', { truck_brand_id: truck_brand_id })
|
12
|
+
|
13
|
+
results[:body].map { |r| Segurocomar::Entity::Truck.new(r) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class BicycleValue
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Car
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :code, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class CarBrand
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class CarVersion
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Coverage
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name, :detail, :covered, :observations]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class InsurableYear
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Insurer
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name, :products]
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader *attr_list
|
9
|
+
|
10
|
+
def initialize(attributes={})
|
11
|
+
attributes.each do |k, v|
|
12
|
+
if k.to_s == 'products'
|
13
|
+
self.products = v.map { |p| Product.new(p) }
|
14
|
+
elsif self.respond_to?(k)
|
15
|
+
self.send("#{k}=", v)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_writer *attr_list
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Locality
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name, :zip_code, :province_id, :province_name, :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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Motorcycle
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class MotorcycleBrand
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Product
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name, :installments_count, :validity, :description, :insurer_id, :insurer_name, :coverages]
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader *attr_list
|
9
|
+
|
10
|
+
def initialize(attributes={})
|
11
|
+
attributes.each do |k, v|
|
12
|
+
if k.to_s == 'coverages'
|
13
|
+
self.coverages = v.map { |c| Coverage.new(c) }
|
14
|
+
elsif self.respond_to?(k)
|
15
|
+
self.send("#{k}=", v)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_writer *attr_list
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Province
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class QuotedProduct
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :product_id, :product_name, :insurer_id, :insurer_name,
|
6
|
+
:price, :price_from, :hired, :extra_params]
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader *attr_list
|
10
|
+
|
11
|
+
def initialize(attributes={})
|
12
|
+
attributes.each do |k, v|
|
13
|
+
self.send("#{k}=", v) if self.respond_to?(k)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_writer *attr_list
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class Truck
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Segurocomar
|
2
|
+
module Entity
|
3
|
+
class TruckBrand
|
4
|
+
def self.attr_list
|
5
|
+
[:id, :name]
|
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.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "segurocomar/version"
|
2
|
+
|
3
|
+
# entities
|
4
|
+
require "segurocomar/entity/bicycle_value"
|
5
|
+
require "segurocomar/entity/car"
|
6
|
+
require "segurocomar/entity/car_brand"
|
7
|
+
require "segurocomar/entity/car_version"
|
8
|
+
require "segurocomar/entity/coverage"
|
9
|
+
require "segurocomar/entity/insurable_year"
|
10
|
+
require "segurocomar/entity/insurer"
|
11
|
+
require "segurocomar/entity/locality"
|
12
|
+
require "segurocomar/entity/motorcycle"
|
13
|
+
require "segurocomar/entity/motorcycle_brand"
|
14
|
+
require "segurocomar/entity/product"
|
15
|
+
require "segurocomar/entity/province"
|
16
|
+
require "segurocomar/entity/quoted_product"
|
17
|
+
require "segurocomar/entity/truck"
|
18
|
+
require "segurocomar/entity/truck_brand"
|
19
|
+
|
20
|
+
# core
|
21
|
+
require "segurocomar/core/art_activities"
|
22
|
+
require "segurocomar/core/bicycles"
|
23
|
+
require "segurocomar/core/cars"
|
24
|
+
require "segurocomar/core/insurance"
|
25
|
+
require "segurocomar/core/misc"
|
26
|
+
require "segurocomar/core/motorcycles"
|
27
|
+
require "segurocomar/core/quotes"
|
28
|
+
require "segurocomar/core/trucks"
|
29
|
+
require "segurocomar/api"
|
30
|
+
|
31
|
+
# dependencies
|
32
|
+
require 'rest-client'
|
33
|
+
require 'singleton'
|
34
|
+
require 'time'
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: segurocomar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matias Hick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rest-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.7
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.7
|
55
|
+
description: Connect to segurocomar through API
|
56
|
+
email:
|
57
|
+
- unformatt@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- LICENSE.md
|
63
|
+
- README.md
|
64
|
+
- CHANGELOG.md
|
65
|
+
- lib/segurocomar/api.rb
|
66
|
+
- lib/segurocomar/core/art_activities.rb
|
67
|
+
- lib/segurocomar/core/bicycles.rb
|
68
|
+
- lib/segurocomar/core/cars.rb
|
69
|
+
- lib/segurocomar/core/insurance.rb
|
70
|
+
- lib/segurocomar/core/misc.rb
|
71
|
+
- lib/segurocomar/core/motorcycles.rb
|
72
|
+
- lib/segurocomar/core/quotes.rb
|
73
|
+
- lib/segurocomar/core/trucks.rb
|
74
|
+
- lib/segurocomar/entity/bicycle_value.rb
|
75
|
+
- lib/segurocomar/entity/car.rb
|
76
|
+
- lib/segurocomar/entity/car_brand.rb
|
77
|
+
- lib/segurocomar/entity/car_version.rb
|
78
|
+
- lib/segurocomar/entity/coverage.rb
|
79
|
+
- lib/segurocomar/entity/insurable_year.rb
|
80
|
+
- lib/segurocomar/entity/insurer.rb
|
81
|
+
- lib/segurocomar/entity/locality.rb
|
82
|
+
- lib/segurocomar/entity/motorcycle.rb
|
83
|
+
- lib/segurocomar/entity/motorcycle_brand.rb
|
84
|
+
- lib/segurocomar/entity/product.rb
|
85
|
+
- lib/segurocomar/entity/province.rb
|
86
|
+
- lib/segurocomar/entity/quoted_product.rb
|
87
|
+
- lib/segurocomar/entity/truck.rb
|
88
|
+
- lib/segurocomar/entity/truck_brand.rb
|
89
|
+
- lib/segurocomar/version.rb
|
90
|
+
- lib/segurocomar.rb
|
91
|
+
homepage: https://github.com/unformattmh/segurocomar-api
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.0.14
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Connect to segurocomar through API
|
115
|
+
test_files: []
|