Class: FlexOps::Resources::Insurance
- Inherits:
-
Object
- Object
- FlexOps::Resources::Insurance
- Defined in:
- lib/flexops/resources/insurance.rb
Instance Method Summary collapse
- #file_claim(policy_id, description:, claim_amount:) ⇒ Object
- #get_providers ⇒ Object
- #get_quote(carrier:, declared_value:, provider: nil) ⇒ Object
-
#initialize(http, ws_id_proc) ⇒ Insurance
constructor
A new instance of Insurance.
- #purchase(tracking_number:, carrier:, declared_value:, provider: nil) ⇒ Object
- #void(policy_id) ⇒ Object
Constructor Details
#initialize(http, ws_id_proc) ⇒ Insurance
Returns a new instance of Insurance.
12 13 14 15 |
# File 'lib/flexops/resources/insurance.rb', line 12 def initialize(http, ws_id_proc) @http = http @ws_id = ws_id_proc end |
Instance Method Details
#file_claim(policy_id, description:, claim_amount:) ⇒ Object
37 38 39 |
# File 'lib/flexops/resources/insurance.rb', line 37 def file_claim(policy_id, description:, claim_amount:) @http.post("#{ws_path}/insurance/policies/#{policy_id}/claims", body: { description: description, claimAmount: claim_amount }) end |
#get_providers ⇒ Object
17 18 19 |
# File 'lib/flexops/resources/insurance.rb', line 17 def get_providers @http.get("#{ws_path}/insurance/providers") end |
#get_quote(carrier:, declared_value:, provider: nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/flexops/resources/insurance.rb', line 21 def get_quote(carrier:, declared_value:, provider: nil) body = { carrier: carrier, declaredValue: declared_value } body[:provider] = provider if provider @http.post("#{ws_path}/insurance/quote", body: body) end |
#purchase(tracking_number:, carrier:, declared_value:, provider: nil) ⇒ Object
27 28 29 30 31 |
# File 'lib/flexops/resources/insurance.rb', line 27 def purchase(tracking_number:, carrier:, declared_value:, provider: nil) body = { trackingNumber: tracking_number, carrier: carrier, declaredValue: declared_value } body[:provider] = provider if provider @http.post("#{ws_path}/insurance/purchase", body: body) end |
#void(policy_id) ⇒ Object
33 34 35 |
# File 'lib/flexops/resources/insurance.rb', line 33 def void(policy_id) @http.delete("#{ws_path}/insurance/policies/#{policy_id}") end |