Class: Telerivet::AirtimeTransaction
- Defined in:
- lib/telerivet/airtimetransaction.rb
Overview
Represents a transaction where airtime is sent to a mobile phone number. This also is used to represent non-airtime value transfers such as data bundles or gift cards.
To send airtime, first create a Custom Actions service to send a particular amount of airtime, then trigger the service using service.invoke, project.sendBroadcast, or project.scheduleMessage.
Fields:
- id
* ID of the airtime transaction
* Read-only
- to_number
* Destination phone number in international format (no leading +)
* Read-only
- operator_name
* Operator name
* Read-only
- country
* Country code
* Read-only
- time_created (UNIX timestamp)
* The time that the airtime transaction was created on Telerivet's servers
* Read-only
- transaction_time (UNIX timestamp)
* The time that the airtime transaction was sent, or null if it has not been sent
* Read-only
- status
* Current status of airtime transaction (`successful`, `failed`, `cancelled`,
`queued`, `processing`, `submitted`, `pending_approval`, or `pending_payment`)
* Allowed values: successful, failed, cancelled, queued, processing, submitted,
pending_approval, pending_payment
* Read-only
- status_text
* Error or success message returned by airtime provider, if available
* Read-only
- value
* Value of airtime sent to destination phone number, in units of value_currency
* Read-only
- value_currency
* Currency code of price
* Read-only
- price
* Price charged for airtime transaction, in units of price_currency
* Read-only
- price_currency
* Currency code of price
* Read-only
- contact_id
* ID of the contact the airtime was sent to
* Read-only
- service_id
* ID of the service that sent the airtime
* Read-only
- project_id
* ID of the project that the airtime transaction belongs to
* Read-only
- external_id
* The ID of this transaction from an external airtime gateway provider, if available.
* Read-only
- user_id (string, max 34 characters)
* ID of the Telerivet user who sent the airtime transaction (if applicable)
* Read-only
- vars (Hash)
* Custom variables stored for this transaction. Variable names may be up to 32
characters in length and can contain the characters a-z, A-Z, 0-9, and _.
Values may be strings, numbers, or boolean (true/false).
String values may be up to 4096 bytes in length when encoded as UTF-8.
Up to 100 variables are supported per object.
Setting a variable to null will delete the variable.
* Updatable via API
Instance Method Summary collapse
- #contact_id ⇒ Object
- #country ⇒ Object
- #external_id ⇒ Object
- #get_base_api_path ⇒ Object
- #id ⇒ Object
- #operator_name ⇒ Object
- #price ⇒ Object
- #price_currency ⇒ Object
- #project_id ⇒ Object
- #service_id ⇒ Object
- #status ⇒ Object
- #status_text ⇒ Object
- #time_created ⇒ Object
- #to_number ⇒ Object
- #transaction_time ⇒ Object
- #user_id ⇒ Object
- #value ⇒ Object
- #value_currency ⇒ Object
Methods inherited from Entity
#get, #initialize, #load, #save, #set, #set_data, #to_s, #vars
Constructor Details
This class inherits a constructor from Telerivet::Entity
Instance Method Details
#contact_id ⇒ Object
145 146 147 |
# File 'lib/telerivet/airtimetransaction.rb', line 145 def contact_id get('contact_id') end |
#country ⇒ Object
109 110 111 |
# File 'lib/telerivet/airtimetransaction.rb', line 109 def country get('country') end |
#external_id ⇒ Object
157 158 159 |
# File 'lib/telerivet/airtimetransaction.rb', line 157 def external_id get('external_id') end |
#get_base_api_path ⇒ Object
165 166 167 |
# File 'lib/telerivet/airtimetransaction.rb', line 165 def get_base_api_path() "/projects/#{get('project_id')}/airtime_transactions/#{get('id')}" end |
#id ⇒ Object
97 98 99 |
# File 'lib/telerivet/airtimetransaction.rb', line 97 def id get('id') end |
#operator_name ⇒ Object
105 106 107 |
# File 'lib/telerivet/airtimetransaction.rb', line 105 def operator_name get('operator_name') end |
#price ⇒ Object
137 138 139 |
# File 'lib/telerivet/airtimetransaction.rb', line 137 def price get('price') end |
#price_currency ⇒ Object
141 142 143 |
# File 'lib/telerivet/airtimetransaction.rb', line 141 def price_currency get('price_currency') end |
#project_id ⇒ Object
153 154 155 |
# File 'lib/telerivet/airtimetransaction.rb', line 153 def project_id get('project_id') end |
#service_id ⇒ Object
149 150 151 |
# File 'lib/telerivet/airtimetransaction.rb', line 149 def service_id get('service_id') end |
#status ⇒ Object
121 122 123 |
# File 'lib/telerivet/airtimetransaction.rb', line 121 def status get('status') end |
#status_text ⇒ Object
125 126 127 |
# File 'lib/telerivet/airtimetransaction.rb', line 125 def status_text get('status_text') end |
#time_created ⇒ Object
113 114 115 |
# File 'lib/telerivet/airtimetransaction.rb', line 113 def time_created get('time_created') end |
#to_number ⇒ Object
101 102 103 |
# File 'lib/telerivet/airtimetransaction.rb', line 101 def to_number get('to_number') end |
#transaction_time ⇒ Object
117 118 119 |
# File 'lib/telerivet/airtimetransaction.rb', line 117 def transaction_time get('transaction_time') end |
#user_id ⇒ Object
161 162 163 |
# File 'lib/telerivet/airtimetransaction.rb', line 161 def user_id get('user_id') end |
#value ⇒ Object
129 130 131 |
# File 'lib/telerivet/airtimetransaction.rb', line 129 def value get('value') end |
#value_currency ⇒ Object
133 134 135 |
# File 'lib/telerivet/airtimetransaction.rb', line 133 def value_currency get('value_currency') end |