Sha256: 2d02a74843827e8a8cac6f1fc3ae6df9f29be799b4187606ce5a83c7749e7612
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module CTM class Account < Base 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'] 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 def receiving_numbers(options={}) CTM::List.new('ReceivingNumber', options.merge(account_id: @id), @token) end def target_numbers(options={}) CTM::List.new('TargetNumber', options.merge(account_id: @id), @token) end def sources(options={}) CTM::List.new('Source', options.merge(account_id: @id), @token) end def users(options={}) CTM::List.new('User', options.merge(account_id: @id), @token) end def webhooks(options={}) 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ctm-0.5.3 | lib/ctm/account.rb |