Class: KillBillClient::Model::Account

Inherits:
AccountAttributesWithBalance show all
Defined in:
lib/killbill_client/models/account.rb

Constant Summary collapse

KILLBILL_API_ACCOUNTS_PREFIX =
"#{KILLBILL_API_PREFIX}/accounts"

Constants inherited from Resource

Resource::KILLBILL_API_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

attribute, delete, from_json, from_response, get, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json

Class Method Details

.find_by_id(account_id, with_balance = false, with_balance_and_cba = false) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/killbill_client/models/account.rb', line 7

def find_by_id(, with_balance = false, with_balance_and_cba = false)
  get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
      {
          :accountWithBalance => with_balance,
          :accountWithBalanceAndCBA => with_balance_and_cba
      }
end

Instance Method Details

#create(user = nil, reason = nil, comment = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/killbill_client/models/account.rb', line 16

def create(user = nil, reason = nil, comment = nil)
   = self.class.post KILLBILL_API_ACCOUNTS_PREFIX,
                                    to_json,
                                    {},
                                    {
                                        :user => user,
                                        :reason => reason,
                                        :comment => comment,
                                    }
  .refresh
end

#paymentsObject



28
29
30
31
32
33
# File 'lib/killbill_client/models/account.rb', line 28

def payments
  self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments",
                 {},
                 {},
                 Payment
end