Class: Twilio::REST::Api::V2010::AccountContext::BalanceList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/balance.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil) ⇒ BalanceList

Initialize the BalanceList

Parameters:

  • version (Version)

    Version that contains the resource



28
29
30
31
32
33
34
35
# File 'lib/twilio-ruby/rest/api/v2010/account/balance.rb', line 28

def initialize(version, account_sid: nil)
    super(version)
    
    # Path Solution
    @solution = { account_sid:  }
    @uri = "/Accounts/#{@solution[:account_sid]}/Balance.json"
    
end

Instance Method Details

#fetchBalanceInstance

Fetch the BalanceInstance

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/twilio-ruby/rest/api/v2010/account/balance.rb', line 39

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    BalanceInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
    )
end

#fetch_with_metadataBalanceInstance

Fetch the BalanceInstanceMetadata

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/twilio-ruby/rest/api/v2010/account/balance.rb', line 58

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    balance_instance = BalanceInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
    )
    BalanceInstanceMetadata.new(
        @version,
        balance_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



84
85
86
# File 'lib/twilio-ruby/rest/api/v2010/account/balance.rb', line 84

def to_s
    '#<Twilio.Api.V2010.BalanceList>'
end