Class: Telerivet::AirtimeTransaction

Inherits:
Entity
  • Object
show all
Defined in:
lib/telerivet/airtimetransaction.rb

Overview

Represents a transaction where airtime is sent to a mobile phone number.

To send airtime, first [create a Custom Actions service to send a particular amount of airtime](/dashboard/add_service?subtype_id=main.service.rules.contact&action_id=main.rule.sendairtime), then trigger the service using [service.invoke](#Service.invoke), [project.sendBroadcast](#Project.sendBroadcast), or [project.scheduleMessage](#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`)
    * 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

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_idObject



142
143
144
# File 'lib/telerivet/airtimetransaction.rb', line 142

def contact_id
    get('contact_id')
end

#countryObject



106
107
108
# File 'lib/telerivet/airtimetransaction.rb', line 106

def country
    get('country')
end

#external_idObject



154
155
156
# File 'lib/telerivet/airtimetransaction.rb', line 154

def external_id
    get('external_id')
end

#get_base_api_pathObject



162
163
164
# File 'lib/telerivet/airtimetransaction.rb', line 162

def get_base_api_path()
    "/projects/#{get('project_id')}/airtime_transactions/#{get('id')}"
end

#idObject



94
95
96
# File 'lib/telerivet/airtimetransaction.rb', line 94

def id
    get('id')
end

#operator_nameObject



102
103
104
# File 'lib/telerivet/airtimetransaction.rb', line 102

def operator_name
    get('operator_name')
end

#priceObject



134
135
136
# File 'lib/telerivet/airtimetransaction.rb', line 134

def price
    get('price')
end

#price_currencyObject



138
139
140
# File 'lib/telerivet/airtimetransaction.rb', line 138

def price_currency
    get('price_currency')
end

#project_idObject



150
151
152
# File 'lib/telerivet/airtimetransaction.rb', line 150

def project_id
    get('project_id')
end

#service_idObject



146
147
148
# File 'lib/telerivet/airtimetransaction.rb', line 146

def service_id
    get('service_id')
end

#statusObject



118
119
120
# File 'lib/telerivet/airtimetransaction.rb', line 118

def status
    get('status')
end

#status_textObject



122
123
124
# File 'lib/telerivet/airtimetransaction.rb', line 122

def status_text
    get('status_text')
end

#time_createdObject



110
111
112
# File 'lib/telerivet/airtimetransaction.rb', line 110

def time_created
    get('time_created')
end

#to_numberObject



98
99
100
# File 'lib/telerivet/airtimetransaction.rb', line 98

def to_number
    get('to_number')
end

#transaction_timeObject



114
115
116
# File 'lib/telerivet/airtimetransaction.rb', line 114

def transaction_time
    get('transaction_time')
end

#user_idObject



158
159
160
# File 'lib/telerivet/airtimetransaction.rb', line 158

def user_id
    get('user_id')
end

#valueObject



126
127
128
# File 'lib/telerivet/airtimetransaction.rb', line 126

def value
    get('value')
end

#value_currencyObject



130
131
132
# File 'lib/telerivet/airtimetransaction.rb', line 130

def value_currency
    get('value_currency')
end