Class: Paid::Customer

Inherits:
APIResource show all
Includes:
APIOperations::Create, APIOperations::Delete, APIOperations::List, APIOperations::Update
Defined in:
lib/paid/customer.rb

Instance Attribute Summary

Attributes inherited from PaidObject

#api_key

Instance Method Summary collapse

Methods included from APIOperations::List

included

Methods included from APIOperations::Update

#save, #serialize_metadata, #serialize_params

Methods included from APIOperations::Delete

#delete

Methods included from APIOperations::Create

included

Methods inherited from APIResource

#api_url, api_url, class_name, #refresh, retrieve

Methods inherited from PaidObject

#[], #[]=, #_dump, _load, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #respond_to?, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Paid::PaidObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Paid::PaidObject

Instance Method Details

#generate_invoice(params = {}, opts = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/paid/customer.rb', line 8

def generate_invoice(params={}, opts={})
  api_key, headers = Util.parse_opts(opts)
  response, api_key = Paid.request(
    :post, generate_invoice_url, api_key || @api_key, params, headers)
  # refresh_from(response, api_key)
  refresh_from({ :invoice => response }, api_key, true)
  invoice
end

#invoicesObject



17
18
19
# File 'lib/paid/customer.rb', line 17

def invoices
  Invoice.all({ :customer => id }, @api_key)
end

#transactionsObject



21
22
23
# File 'lib/paid/customer.rb', line 21

def transactions
  Transaction.all({ :customer => id }, @api_key)
end