class SealineInsurance::Client

Public Class Methods

new(**args) click to toggle source
# File lib/sealine_insurance/client.rb, line 5
def initialize(**args)
  @config = Config.new(**args)
end

Public Instance Methods

calculate(**args) click to toggle source
# File lib/sealine_insurance/client.rb, line 46
def calculate(**args)
  Operations::Calculate.new(config: @config, **args).tap(&:call)
end
calculate_status_list() click to toggle source
# File lib/sealine_insurance/client.rb, line 21
def calculate_status_list
  classifiers(path: 'status/calculate-product')
end
cancel_order(**args) click to toggle source
# File lib/sealine_insurance/client.rb, line 63
def cancel_order(**args)
  Operations::CancelOrder.new(config: @config, **args).tap(&:call)
end
classifiers(path:) click to toggle source
# File lib/sealine_insurance/client.rb, line 33
def classifiers(path:)
  response = request.get("/classifiers/#{path}")
  Responses::Base.new(response)
end
create_order(**args) click to toggle source
# File lib/sealine_insurance/client.rb, line 50
def create_order(**args)
  Operations::CreateOrder.new(config: @config, **args).tap(&:call)
end
create_payment(**args) click to toggle source
# 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:) click to toggle source
# 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() click to toggle source
# File lib/sealine_insurance/client.rb, line 25
def order_status_list
  classifiers(path: 'status/order')
end
payment_status_list() click to toggle source
# File lib/sealine_insurance/client.rb, line 29
def payment_status_list
  classifiers(path: 'status/payment')
end
product_type(id:) click to toggle source
# File lib/sealine_insurance/client.rb, line 13
def product_type(id:)
  classifiers(path: "product-type/#{id}")
end
product_types() click to toggle source
# File lib/sealine_insurance/client.rb, line 9
def product_types
  classifiers(path: 'product-type')
end
products() click to toggle source
# File lib/sealine_insurance/client.rb, line 17
def products
  classifiers(path: 'product')
end
search_products(product_type:, options: []) click to toggle source
# File lib/sealine_insurance/client.rb, line 38
def search_products(product_type:, options: [])
  response = request.post('/search',
    product_type: product_type,
    options: options,
  )
  Responses::Base.new(response)
end

Private Instance Methods

request() click to toggle source
# File lib/sealine_insurance/client.rb, line 69
def request
  @request ||= Request.new(config: @config)
end