Class: CTM::Account
Instance Attribute Summary collapse
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#stats ⇒ Object
Returns the value of attribute stats.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Base
Instance Method Summary collapse
- #calls(options = {}) ⇒ Object
-
#initialize(data, token = nil) ⇒ Account
constructor
A new instance of Account.
- #messages(options = {}) ⇒ Object
- #numbers(options = {}) ⇒ Object
- #receiving_numbers(options = {}) ⇒ Object
- #sources(options = {}) ⇒ Object
- #users(options = {}) ⇒ Object
- #webhooks(options = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data, token = nil) ⇒ Account
Returns a new instance of Account.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ctm/account.rb', line 6 def initialize(data, token=nil) super(data, token) puts data.inspect @id = data['id'] @name = data['name'] @status = data['status'] @stats = data['stats']['calls'] if data['balance'] @balance = "$" + (data['balance']['cents'].to_i / 100).to_s + "." + (data['balance']['cents'].to_i % 100).to_s end end |
Instance Attribute Details
#balance ⇒ Object
Returns the value of attribute balance.
4 5 6 |
# File 'lib/ctm/account.rb', line 4 def balance @balance end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/ctm/account.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/ctm/account.rb', line 4 def name @name end |
#stats ⇒ Object
Returns the value of attribute stats.
4 5 6 |
# File 'lib/ctm/account.rb', line 4 def stats @stats end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/ctm/account.rb', line 4 def status @status end |
Instance Method Details
#calls(options = {}) ⇒ Object
38 39 40 |
# File 'lib/ctm/account.rb', line 38 def calls(={}) CTM::List.new('Call', .merge(account_id: @id), @token) end |
#messages(options = {}) ⇒ Object
42 43 44 |
# File 'lib/ctm/account.rb', line 42 def (={}) CTM::MessageList.new(.merge(account_id: @id), @token) end |
#numbers(options = {}) ⇒ Object
18 19 20 |
# File 'lib/ctm/account.rb', line 18 def numbers(={}) CTM::NumberList.new(.merge(account_id: @id), @token) end |
#receiving_numbers(options = {}) ⇒ Object
22 23 24 |
# File 'lib/ctm/account.rb', line 22 def receiving_numbers(={}) CTM::List.new('ReceivingNumber', .merge(account_id: @id), @token) end |
#sources(options = {}) ⇒ Object
26 27 28 |
# File 'lib/ctm/account.rb', line 26 def sources(={}) CTM::List.new('Source', .merge(account_id: @id), @token) end |