lib/ctm/account.rb in ctm-0.4.2 vs lib/ctm/account.rb in ctm-0.4.4
- old
+ new
@@ -3,15 +3,18 @@
attr_reader :id
attr_accessor :name, :status, :stats, :balance
def initialize(data, token=nil)
super(data, token)
+ puts data.inspect
@id = data['id']
@name = data['name']
@status = data['status']
@stats = data['stats']['calls']
- @balance = "$" + (data['balance']['cents'].to_i / 100).to_s + "." + (data['balance']['cents'].to_i % 100).to_s
+ if data['balance']
+ @balance = "$" + (data['balance']['cents'].to_i / 100).to_s + "." + (data['balance']['cents'].to_i % 100).to_s
+ end
end
def numbers(options={})
CTM::NumberList.new(options.merge(account_id: @id), @token)
end
@@ -32,9 +35,13 @@
CTM::List.new('Webhook', options.merge(account_id: @id), @token)
end
def calls(options={})
CTM::List.new('Call', options.merge(account_id: @id), @token)
+ end
+
+ def messages(options={})
+ CTM::MessageList.new(options.merge(account_id: @id), @token)
end
end
end