Class: Telerivet::Phone
Overview
Represents a basic route (i.e. a phone or gateway) that you use to send/receive messages via Telerivet.
Basic Routes were formerly referred to as “Phones” within Telerivet. API methods, parameters, and properties related to Basic Routes continue to use the term “Phone” to maintain backwards compatibility.
Fields:
- id (string, max 34 characters)
* ID of the phone
* Read-only
- name
* Name of the phone
* Updatable via API
- phone_number (string)
* Phone number or sender ID
* Updatable via API
- phone_type
* Type of this phone/route (e.g. android, twilio, nexmo, etc)
* Read-only
- country
* 2-letter country code (ISO 3166-1 alpha-2) where phone is from
* Read-only
- send_paused (bool)
* True if sending messages is currently paused, false if the phone can currently send
messages
* Updatable via API
- time_created (UNIX timestamp)
* Time the phone was created in Telerivet
* Read-only
- last_active_time (UNIX timestamp)
* Approximate time this phone last connected to Telerivet
* Read-only
- vars (Hash)
* Custom variables stored for this phone
* Updatable via API
- project_id
* ID of the project this phone belongs to
* Read-only
- battery (int)
* Current battery level, on a scale from 0 to 100, as of the last time the phone
connected to Telerivet (only present for Android phones)
* Read-only
- charging (bool)
* True if the phone is currently charging, false if it is running on battery, as of
the last time it connected to Telerivet (only present for Android phones)
* Read-only
- internet_type
* String describing the current type of internet connectivity for an Android phone,
for example WIFI or MOBILE (only present for Android phones)
* Read-only
- app_version
* Currently installed version of Telerivet Android app (only present for Android
phones)
* Read-only
- android_sdk (int)
* Android SDK level, indicating the approximate version of the Android OS installed on
this phone; see [list of Android SDK
levels](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)
(only present for Android phones)
* Read-only
- mccmnc
* Code indicating the Android phone's current country (MCC) and mobile network
operator (MNC); see [Mobile country code Wikipedia
article](https://en.wikipedia.org/wiki/Mobile_country_code) (only present for Android
phones). Note this is a string containing numeric digits, not an integer.
* Read-only
- manufacturer
* Android phone manufacturer (only present for Android phones)
* Read-only
- model
* Android phone model (only present for Android phones)
* Read-only
- send_limit (int)
* Maximum number of SMS messages per hour that can be sent by this Android phone. To
increase this limit, install additional SMS expansion packs in the Telerivet Gateway
app. (only present for Android phones)
* Read-only
Instance Method Summary collapse
- #android_sdk ⇒ Object
- #app_version ⇒ Object
- #battery ⇒ Object
- #charging ⇒ Object
- #country ⇒ Object
- #get_base_api_path ⇒ Object
- #id ⇒ Object
- #internet_type ⇒ Object
- #last_active_time ⇒ Object
- #manufacturer ⇒ Object
- #mccmnc ⇒ Object
- #model ⇒ Object
- #name ⇒ Object
- #name=(value) ⇒ Object
- #phone_number ⇒ Object
- #phone_number=(value) ⇒ Object
- #phone_type ⇒ Object
- #project_id ⇒ Object
-
#query_messages(options = nil) ⇒ Object
Queries messages sent or received by this basic route.
-
#save ⇒ Object
Saves any fields or custom variables that have changed for this basic route.
- #send_limit ⇒ Object
- #send_paused ⇒ Object
- #send_paused=(value) ⇒ Object
- #time_created ⇒ Object
Methods inherited from Entity
#get, #initialize, #load, #set, #set_data, #to_s, #vars
Constructor Details
This class inherits a constructor from Telerivet::Entity
Instance Method Details
#android_sdk ⇒ Object
257 258 259 |
# File 'lib/telerivet/phone.rb', line 257 def android_sdk get('android_sdk') end |
#app_version ⇒ Object
253 254 255 |
# File 'lib/telerivet/phone.rb', line 253 def app_version get('app_version') end |
#battery ⇒ Object
241 242 243 |
# File 'lib/telerivet/phone.rb', line 241 def battery get('battery') end |
#charging ⇒ Object
245 246 247 |
# File 'lib/telerivet/phone.rb', line 245 def charging get('charging') end |
#country ⇒ Object
217 218 219 |
# File 'lib/telerivet/phone.rb', line 217 def country get('country') end |
#get_base_api_path ⇒ Object
277 278 279 |
# File 'lib/telerivet/phone.rb', line 277 def get_base_api_path() "/projects/#{get('project_id')}/phones/#{get('id')}" end |
#id ⇒ Object
193 194 195 |
# File 'lib/telerivet/phone.rb', line 193 def id get('id') end |
#internet_type ⇒ Object
249 250 251 |
# File 'lib/telerivet/phone.rb', line 249 def internet_type get('internet_type') end |
#last_active_time ⇒ Object
233 234 235 |
# File 'lib/telerivet/phone.rb', line 233 def last_active_time get('last_active_time') end |
#manufacturer ⇒ Object
265 266 267 |
# File 'lib/telerivet/phone.rb', line 265 def manufacturer get('manufacturer') end |
#mccmnc ⇒ Object
261 262 263 |
# File 'lib/telerivet/phone.rb', line 261 def mccmnc get('mccmnc') end |
#model ⇒ Object
269 270 271 |
# File 'lib/telerivet/phone.rb', line 269 def model get('model') end |
#name ⇒ Object
197 198 199 |
# File 'lib/telerivet/phone.rb', line 197 def name get('name') end |
#name=(value) ⇒ Object
201 202 203 |
# File 'lib/telerivet/phone.rb', line 201 def name=(value) set('name', value) end |
#phone_number ⇒ Object
205 206 207 |
# File 'lib/telerivet/phone.rb', line 205 def phone_number get('phone_number') end |
#phone_number=(value) ⇒ Object
209 210 211 |
# File 'lib/telerivet/phone.rb', line 209 def phone_number=(value) set('phone_number', value) end |
#phone_type ⇒ Object
213 214 215 |
# File 'lib/telerivet/phone.rb', line 213 def phone_type get('phone_type') end |
#project_id ⇒ Object
237 238 239 |
# File 'lib/telerivet/phone.rb', line 237 def project_id get('project_id') end |
#query_messages(options = nil) ⇒ Object
Queries messages sent or received by this basic route.
Arguments:
- options (Hash)
- direction
* Filter messages by direction
* Allowed values: incoming, outgoing
- message_type
* Filter messages by message_type
* Allowed values: sms, mms, ussd, ussd_session, call, chat, service
- source
* Filter messages by source
* Allowed values: phone, provider, web, api, service, webhook, scheduled,
integration
- starred (bool)
* Filter messages by starred/unstarred
- status
* Filter messages by status
* Allowed values: ignored, processing, received, sent, queued, failed,
failed_queued, cancelled, delivered, not_delivered, read
- time_created[min] (UNIX timestamp)
* Filter messages created on or after a particular time
- time_created[max] (UNIX timestamp)
* Filter messages created before a particular time
- external_id
* Filter messages by ID from an external provider
* Allowed modifiers: external_id[ne], external_id[exists]
- contact_id
* ID of the contact who sent/received the message
* Allowed modifiers: contact_id[ne], contact_id[exists]
- phone_id
* ID of the phone (basic route) that sent/received the message
- broadcast_id
* ID of the broadcast containing the message
* Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
- scheduled_id
* ID of the scheduled message that created this message
* Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
- group_id
* Filter messages sent or received by contacts in a particular group. The group must
be a normal group, not a dynamic group.
- sort
* Sort the results based on a field
* Allowed values: default
* Default: default
- sort_dir
* Sort the results in ascending or descending order
* Allowed values: asc, desc
* Default: asc
- page_size (int)
* Number of results returned per page (max 500)
* Default: 50
- offset (int)
* Number of items to skip from beginning of result set
* Default: 0
Returns:
Telerivet::APICursor (of Telerivet::Message)
181 182 183 184 |
# File 'lib/telerivet/phone.rb', line 181 def ( = nil) require_relative 'message' @api.cursor(Message, get_base_api_path() + "/messages", ) end |
#save ⇒ Object
Saves any fields or custom variables that have changed for this basic route.
189 190 191 |
# File 'lib/telerivet/phone.rb', line 189 def save() super end |
#send_limit ⇒ Object
273 274 275 |
# File 'lib/telerivet/phone.rb', line 273 def send_limit get('send_limit') end |
#send_paused ⇒ Object
221 222 223 |
# File 'lib/telerivet/phone.rb', line 221 def send_paused get('send_paused') end |
#send_paused=(value) ⇒ Object
225 226 227 |
# File 'lib/telerivet/phone.rb', line 225 def send_paused=(value) set('send_paused', value) end |
#time_created ⇒ Object
229 230 231 |
# File 'lib/telerivet/phone.rb', line 229 def time_created get('time_created') end |