Class: Wajub::InvoicesResource

Inherits:
CrudResource show all
Defined in:
lib/wajub/resources.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#api_key, #base_url, #idempotency_key_prefix, #last_request, #transport

Instance Method Summary collapse

Methods inherited from CrudResource

#create, #delete, #list, #retrieve, #update

Methods inherited from BaseClient

#delete, #get, #post, #put, #request

Constructor Details

#initialize(api_key, base_url, idempotency_key_prefix = 'wajub', transport: nil) ⇒ InvoicesResource

Returns a new instance of InvoicesResource.



187
188
189
# File 'lib/wajub/resources.rb', line 187

def initialize(api_key, base_url, idempotency_key_prefix = 'wajub', transport: nil)
  super(api_key, base_url, 'invoices', 'invoice', 'invoices', idempotency_key_prefix, transport: transport)
end

Instance Method Details

#cancel(id, options = nil) ⇒ Object



199
200
201
# File 'lib/wajub/resources.rb', line 199

def cancel(id, options = nil)
  HttpUtils.pick_resource(post("/invoices/#{URI.encode_www_form_component(id)}/cancel", nil, options), 'invoice')
end

#mark_paid(id, params = nil, options = nil) ⇒ Object



195
196
197
# File 'lib/wajub/resources.rb', line 195

def mark_paid(id, params = nil, options = nil)
  HttpUtils.pick_resource(post("/invoices/#{URI.encode_www_form_component(id)}/mark-paid", params, options), 'invoice')
end

#send(id, options = nil) ⇒ Object



191
192
193
# File 'lib/wajub/resources.rb', line 191

def send(id, options = nil)
  HttpUtils.pick_resource(post("/invoices/#{URI.encode_www_form_component(id)}/send", nil, options), 'invoice')
end