Class: Moip2::InvoiceApi
- Inherits:
-
Object
- Object
- Moip2::InvoiceApi
- Defined in:
- lib/moip2/invoice_api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #base_path ⇒ Object
- #create(invoice) ⇒ Object
-
#initialize(client) ⇒ InvoiceApi
constructor
A new instance of InvoiceApi.
- #list(begin_date, end_date) ⇒ Object
- #show(invoice_external_id) ⇒ Object
- #update(invoice_external_id, invoice) ⇒ Object
Constructor Details
#initialize(client) ⇒ InvoiceApi
Returns a new instance of InvoiceApi.
6 7 8 |
# File 'lib/moip2/invoice_api.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/moip2/invoice_api.rb', line 4 def client @client end |
Instance Method Details
#base_path ⇒ Object
10 11 12 |
# File 'lib/moip2/invoice_api.rb', line 10 def base_path "/v2/invoices" end |
#create(invoice) ⇒ Object
18 19 20 |
# File 'lib/moip2/invoice_api.rb', line 18 def create(invoice) Resource::Invoice.new client, client.post(base_path, invoice) end |
#list(begin_date, end_date) ⇒ Object
26 27 28 |
# File 'lib/moip2/invoice_api.rb', line 26 def list(begin_date, end_date) Resource::Invoice.new client, client.get("#{base_path}?begin=#{begin_date}&end=#{end_date}") end |
#show(invoice_external_id) ⇒ Object
14 15 16 |
# File 'lib/moip2/invoice_api.rb', line 14 def show(invoice_external_id) Resource::Invoice.new client, client.get("#{base_path}/#{invoice_external_id}") end |
#update(invoice_external_id, invoice) ⇒ Object
22 23 24 |
# File 'lib/moip2/invoice_api.rb', line 22 def update(invoice_external_id, invoice) Resource::Invoice.new client, client.put("#{base_path}/#{invoice_external_id}", invoice) end |