Class: VoiceML::Balance

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/accounts.rb

Overview

GET /Accounts/{Sid}/Balance.json — running balance for the account in the account's settlement currency. No sid field on the wire (the balance is account-scoped, not its own resource).

Constant Summary collapse

ATTRIBUTES =
%w[account_sid balance currency].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Balance

Returns a new instance of Balance.



41
42
43
44
45
46
# File 'lib/voiceml/models/accounts.rb', line 41

def initialize(attrs = {})
  ATTRIBUTES.each do |field|
    value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
    instance_variable_set("@#{field}", value)
  end
end

Class Method Details

.from_hash(hash) ⇒ Object



48
49
50
51
52
# File 'lib/voiceml/models/accounts.rb', line 48

def self.from_hash(hash)
  return nil if hash.nil?

  new(hash)
end