Sha256: 1c65b215551eaa981eaf19cdf36ff0fbe1c2e73f07d9c2a734aa43a923a4798b

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

module ExtendWarranties
  module Api
    class Contracts < Base

      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

      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

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
extend_warranties-0.1.0 lib/extend_warranties/api/contracts.rb