Class: SealineInsurance::Client
- Inherits:
-
Object
- Object
- SealineInsurance::Client
- Defined in:
- lib/sealine_insurance/client.rb
Instance Method Summary collapse
- #calculate(**args) ⇒ Object
- #calculate_status_list ⇒ Object
- #cancel_order(**args) ⇒ Object
- #classifiers(path:) ⇒ Object
- #create_order(**args) ⇒ Object
- #create_payment(**args) ⇒ Object
- #get_order(order_id:) ⇒ Object
-
#initialize(**args) ⇒ Client
constructor
A new instance of Client.
- #order_status_list ⇒ Object
- #payment_status_list ⇒ Object
- #product_type(id:) ⇒ Object
- #product_types ⇒ Object
- #products ⇒ Object
- #search_products(product_type:, options: []) ⇒ Object
Constructor Details
#initialize(**args) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/sealine_insurance/client.rb', line 5 def initialize(**args) @config = Config.new(**args) end |
Instance Method Details
#calculate(**args) ⇒ Object
46 47 48 |
# File 'lib/sealine_insurance/client.rb', line 46 def calculate(**args) Operations::Calculate.new(config: @config, **args).tap(&:call) end |
#calculate_status_list ⇒ Object
21 22 23 |
# File 'lib/sealine_insurance/client.rb', line 21 def calculate_status_list classifiers(path: 'status/calculate-product') end |
#cancel_order(**args) ⇒ Object
63 64 65 |
# File 'lib/sealine_insurance/client.rb', line 63 def cancel_order(**args) Operations::CancelOrder.new(config: @config, **args).tap(&:call) end |
#classifiers(path:) ⇒ Object
33 34 35 36 |
# File 'lib/sealine_insurance/client.rb', line 33 def classifiers(path:) response = request.get("/classifiers/#{path}") Responses::Base.new(response) end |
#create_order(**args) ⇒ Object
50 51 52 |
# File 'lib/sealine_insurance/client.rb', line 50 def create_order(**args) Operations::CreateOrder.new(config: @config, **args).tap(&:call) end |
#create_payment(**args) ⇒ Object
59 60 61 |
# File 'lib/sealine_insurance/client.rb', line 59 def create_payment(**args) Operations::CreatePayment.new(config: @config, **args).tap(&:call) end |
#get_order(order_id:) ⇒ Object
54 55 56 57 |
# File 'lib/sealine_insurance/client.rb', line 54 def get_order(order_id:) raw_response = request.get("/order/#{order_id}") Responses::Order.new(raw_response) end |
#order_status_list ⇒ Object
25 26 27 |
# File 'lib/sealine_insurance/client.rb', line 25 def order_status_list classifiers(path: 'status/order') end |
#payment_status_list ⇒ Object
29 30 31 |
# File 'lib/sealine_insurance/client.rb', line 29 def payment_status_list classifiers(path: 'status/payment') end |
#product_type(id:) ⇒ Object
13 14 15 |
# File 'lib/sealine_insurance/client.rb', line 13 def product_type(id:) classifiers(path: "product-type/#{id}") end |
#product_types ⇒ Object
9 10 11 |
# File 'lib/sealine_insurance/client.rb', line 9 def product_types classifiers(path: 'product-type') end |
#products ⇒ Object
17 18 19 |
# File 'lib/sealine_insurance/client.rb', line 17 def products classifiers(path: 'product') end |
#search_products(product_type:, options: []) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/sealine_insurance/client.rb', line 38 def search_products(product_type:, options: []) response = request.post('/search', product_type: product_type, options: , ) Responses::Base.new(response) end |