|
| 1 | +# coding=utf-8 |
| 2 | +""" |
| 3 | +This code was generated by |
| 4 | +\ / _ _ _| _ _ |
| 5 | + | (_)\/(_)(_|\/| |(/_ v1.0.0 |
| 6 | + / / |
| 7 | +""" |
| 8 | + |
| 9 | +from twilio.base import values |
| 10 | +from twilio.base.instance_resource import InstanceResource |
| 11 | +from twilio.base.list_resource import ListResource |
| 12 | +from twilio.base.page import Page |
| 13 | + |
| 14 | + |
| 15 | +class BalanceList(ListResource): |
| 16 | + """ """ |
| 17 | + |
| 18 | + def __init__(self, version, account_sid): |
| 19 | + """ |
| 20 | + Initialize the BalanceList |
| 21 | +
|
| 22 | + :param Version version: Version that contains the resource |
| 23 | + :param account_sid: Account Sid. |
| 24 | +
|
| 25 | + :returns: twilio.rest.api.v2010.account.balance.BalanceList |
| 26 | + :rtype: twilio.rest.api.v2010.account.balance.BalanceList |
| 27 | + """ |
| 28 | + super(BalanceList, self).__init__(version) |
| 29 | + |
| 30 | + # Path Solution |
| 31 | + self._solution = {'account_sid': account_sid, } |
| 32 | + self._uri = '/Accounts/{account_sid}/Balance.json'.format(**self._solution) |
| 33 | + |
| 34 | + def fetch(self): |
| 35 | + """ |
| 36 | + Fetch a BalanceInstance |
| 37 | +
|
| 38 | + :returns: Fetched BalanceInstance |
| 39 | + :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance |
| 40 | + """ |
| 41 | + params = values.of({}) |
| 42 | + |
| 43 | + payload = self._version.fetch( |
| 44 | + 'GET', |
| 45 | + self._uri, |
| 46 | + params=params, |
| 47 | + ) |
| 48 | + |
| 49 | + return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) |
| 50 | + |
| 51 | + def __repr__(self): |
| 52 | + """ |
| 53 | + Provide a friendly representation |
| 54 | +
|
| 55 | + :returns: Machine friendly representation |
| 56 | + :rtype: str |
| 57 | + """ |
| 58 | + return '<Twilio.Api.V2010.BalanceList>' |
| 59 | + |
| 60 | + |
| 61 | +class BalancePage(Page): |
| 62 | + """ """ |
| 63 | + |
| 64 | + def __init__(self, version, response, solution): |
| 65 | + """ |
| 66 | + Initialize the BalancePage |
| 67 | +
|
| 68 | + :param Version version: Version that contains the resource |
| 69 | + :param Response response: Response from the API |
| 70 | + :param account_sid: Account Sid. |
| 71 | +
|
| 72 | + :returns: twilio.rest.api.v2010.account.balance.BalancePage |
| 73 | + :rtype: twilio.rest.api.v2010.account.balance.BalancePage |
| 74 | + """ |
| 75 | + super(BalancePage, self).__init__(version, response) |
| 76 | + |
| 77 | + # Path Solution |
| 78 | + self._solution = solution |
| 79 | + |
| 80 | + def get_instance(self, payload): |
| 81 | + """ |
| 82 | + Build an instance of BalanceInstance |
| 83 | +
|
| 84 | + :param dict payload: Payload response from the API |
| 85 | +
|
| 86 | + :returns: twilio.rest.api.v2010.account.balance.BalanceInstance |
| 87 | + :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance |
| 88 | + """ |
| 89 | + return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) |
| 90 | + |
| 91 | + def __repr__(self): |
| 92 | + """ |
| 93 | + Provide a friendly representation |
| 94 | +
|
| 95 | + :returns: Machine friendly representation |
| 96 | + :rtype: str |
| 97 | + """ |
| 98 | + return '<Twilio.Api.V2010.BalancePage>' |
| 99 | + |
| 100 | + |
| 101 | +class BalanceInstance(InstanceResource): |
| 102 | + """ """ |
| 103 | + |
| 104 | + def __init__(self, version, payload, account_sid): |
| 105 | + """ |
| 106 | + Initialize the BalanceInstance |
| 107 | +
|
| 108 | + :returns: twilio.rest.api.v2010.account.balance.BalanceInstance |
| 109 | + :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance |
| 110 | + """ |
| 111 | + super(BalanceInstance, self).__init__(version) |
| 112 | + |
| 113 | + # Marshaled Properties |
| 114 | + self._properties = { |
| 115 | + 'account_sid': payload['account_sid'], |
| 116 | + 'balance': payload['balance'], |
| 117 | + 'currency': payload['currency'], |
| 118 | + } |
| 119 | + |
| 120 | + # Context |
| 121 | + self._context = None |
| 122 | + self._solution = {'account_sid': account_sid, } |
| 123 | + |
| 124 | + @property |
| 125 | + def account_sid(self): |
| 126 | + """ |
| 127 | + :returns: Account Sid. |
| 128 | + :rtype: unicode |
| 129 | + """ |
| 130 | + return self._properties['account_sid'] |
| 131 | + |
| 132 | + @property |
| 133 | + def balance(self): |
| 134 | + """ |
| 135 | + :returns: Account balance |
| 136 | + :rtype: unicode |
| 137 | + """ |
| 138 | + return self._properties['balance'] |
| 139 | + |
| 140 | + @property |
| 141 | + def currency(self): |
| 142 | + """ |
| 143 | + :returns: Currency units |
| 144 | + :rtype: unicode |
| 145 | + """ |
| 146 | + return self._properties['currency'] |
| 147 | + |
| 148 | + def __repr__(self): |
| 149 | + """ |
| 150 | + Provide a friendly representation |
| 151 | +
|
| 152 | + :returns: Machine friendly representation |
| 153 | + :rtype: str |
| 154 | + """ |
| 155 | + return '<Twilio.Api.V2010.BalanceInstance>' |
0 commit comments