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`, `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

- vars (Hash)
    * Custom variables stored for this transaction
    * 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



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

def contact_id
    get('contact_id')
end

#countryObject



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

def country
    get('country')
end

#external_idObject



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

def external_id
    get('external_id')
end

#get_base_api_pathObject



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

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

#idObject



85
86
87
# File 'lib/telerivet/airtimetransaction.rb', line 85

def id
    get('id')
end

#operator_nameObject



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

def operator_name
    get('operator_name')
end

#priceObject



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

def price
    get('price')
end

#price_currencyObject



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

def price_currency
    get('price_currency')
end

#project_idObject



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

def project_id
    get('project_id')
end

#service_idObject



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

def service_id
    get('service_id')
end

#statusObject



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

def status
    get('status')
end

#status_textObject



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

def status_text
    get('status_text')
end

#time_createdObject



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

def time_created
    get('time_created')
end

#to_numberObject



89
90
91
# File 'lib/telerivet/airtimetransaction.rb', line 89

def to_number
    get('to_number')
end

#transaction_timeObject



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

def transaction_time
    get('transaction_time')
end

#valueObject



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

def value
    get('value')
end

#value_currencyObject



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

def value_currency
    get('value_currency')
end