Sha256: 0a4971221c7b77c094e661bca270c35d5c2fe0acf827c7bd7aa0643aa9028243
Contents?: true
Size: 985 Bytes
Versions: 2
Compression:
Stored size: 985 Bytes
Contents
module Xolphin module Api module Endpoint class Invoice def initialize(http) @http = http end def all invoices = [] result = @http.get("/invoices", page: 1) response = Xolphin::Api::Responses::Invoices.new(result) unless response.error? invoices = response.invoices while response.page < response.pages result = @http.get("/invoices", page: response.page + 1) response = Xolphin::Api::Responses::Invoices.new(result) break if response.error? invoices += response.invoices end end invoices end def get(id) result = @http.get("/invoices/#{id}") Xolphin::Api::Responses::Invoice.new(result) end def download(id, type = "PDF") @http.download("/invoices/#{id}/download", type: type) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xolphin-api-1.9.0 | lib/xolphin/api/endpoint/invoice.rb |
xolphin-api-1.8.0 | lib/xolphin/api/endpoint/invoice.rb |