class ExtendWarranties::Api::Contracts

Public Instance Methods

create(store_id, args = {}) click to toggle source
# File lib/extend_warranties/api/contracts.rb, line 5
def create(store_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?

  resp = connection.post "/stores/#{store_id}/contracts", args
  handle_response(resp)
end
get_invoice(store_id, contract_id, args = {}) click to toggle source
# File lib/extend_warranties/api/contracts.rb, line 20
def get_invoice(store_id, contract_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?
  raise ArgumentError, 'contract_id is required' if contract_id.blank?

  resp = connection.get "/stores/#{store_id}/contracts/#{contract_id}/invoice", args
  handle_response(resp)
end
refund(store_id, contract_id, args = {}) click to toggle source
# File lib/extend_warranties/api/contracts.rb, line 12
def refund(store_id, contract_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?
  raise ArgumentError, 'contract_id is required' if contract_id.blank?

  resp = connection.post "/stores/#{store_id}/contracts/#{contract_id}/refund", args
  handle_response(resp)
end