Sha256: b027d8c14dafaa0686108cbf044ac161fd8c761d409f0e389eb003f412549cf6
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 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 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.4.4 | lib/ctm/account.rb |