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

- 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

- 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



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

def contact_id
    get('contact_id')
end

#countryObject



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

def country
    get('country')
end

#get_base_api_pathObject



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

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

#idObject



73
74
75
# File 'lib/telerivet/airtimetransaction.rb', line 73

def id
    get('id')
end

#operator_nameObject



81
82
83
# File 'lib/telerivet/airtimetransaction.rb', line 81

def operator_name
    get('operator_name')
end

#priceObject



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

def price
    get('price')
end

#price_currencyObject



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

def price_currency
    get('price_currency')
end

#project_idObject



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

def project_id
    get('project_id')
end

#service_idObject



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

def service_id
    get('service_id')
end

#statusObject



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

def status
    get('status')
end

#status_textObject



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

def status_text
    get('status_text')
end

#to_numberObject



77
78
79
# File 'lib/telerivet/airtimetransaction.rb', line 77

def to_number
    get('to_number')
end

#valueObject



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

def value
    get('value')
end

#value_currencyObject



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

def value_currency
    get('value_currency')
end