Class: KillBillClient::Model::Account
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(account_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
#add_tag(tag_name, user = nil, reason = nil, comment = nil) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/killbill_client/models/account.rb', line 44
def add_tag(tag_name, user = nil, reason = nil, = nil)
tag_definition = TagDefinition.find_by_name(tag_name)
if tag_definition.nil?
tag_definition = TagDefinition.new
tag_definition.name = tag_name
tag_definition.description = "Tag created for account #{@account_id}"
tag_definition = TagDefinition.create(user)
end
created_tag = self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/tags",
{},
{
:tagList => tag_definition.id
},
{
:user => user,
:reason => reason,
:comment => ,
},
Tag
created_tag.refresh
end
|
#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, = nil)
created_account = self.class.post KILLBILL_API_ACCOUNTS_PREFIX,
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}
created_account.refresh
end
|
#payments ⇒ Object
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
|
#remove_tag(tag_name, user = nil, reason = nil, comment = nil) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/killbill_client/models/account.rb', line 67
def remove_tag(tag_name, user = nil, reason = nil, = nil)
tag_definition = TagDefinition.find_by_name(tag_name)
return nil if tag_definition.nil?
self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/tags",
{
:tagList => tag_definition.id
},
{
:user => user,
:reason => reason,
:comment => ,
}
end
|
35
36
37
38
39
40
41
42
|
# File 'lib/killbill_client/models/account.rb', line 35
def tags(audit = 'NONE')
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/tags",
{
:audit => audit
},
{},
Tag
end
|