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. 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
- 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
262 263 264 |
# File 'lib/telerivet/phone.rb', line 262 def android_sdk get('android_sdk') end |
#app_version ⇒ Object
258 259 260 |
# File 'lib/telerivet/phone.rb', line 258 def app_version get('app_version') end |
#battery ⇒ Object
246 247 248 |
# File 'lib/telerivet/phone.rb', line 246 def battery get('battery') end |
#charging ⇒ Object
250 251 252 |
# File 'lib/telerivet/phone.rb', line 250 def charging get('charging') end |
#country ⇒ Object
222 223 224 |
# File 'lib/telerivet/phone.rb', line 222 def country get('country') end |
#get_base_api_path ⇒ Object
282 283 284 |
# File 'lib/telerivet/phone.rb', line 282 def get_base_api_path() "/projects/#{get('project_id')}/phones/#{get('id')}" end |
#id ⇒ Object
198 199 200 |
# File 'lib/telerivet/phone.rb', line 198 def id get('id') end |
#internet_type ⇒ Object
254 255 256 |
# File 'lib/telerivet/phone.rb', line 254 def internet_type get('internet_type') end |
#last_active_time ⇒ Object
238 239 240 |
# File 'lib/telerivet/phone.rb', line 238 def last_active_time get('last_active_time') end |
#manufacturer ⇒ Object
270 271 272 |
# File 'lib/telerivet/phone.rb', line 270 def manufacturer get('manufacturer') end |
#mccmnc ⇒ Object
266 267 268 |
# File 'lib/telerivet/phone.rb', line 266 def mccmnc get('mccmnc') end |
#model ⇒ Object
274 275 276 |
# File 'lib/telerivet/phone.rb', line 274 def model get('model') end |
#name ⇒ Object
202 203 204 |
# File 'lib/telerivet/phone.rb', line 202 def name get('name') end |
#name=(value) ⇒ Object
206 207 208 |
# File 'lib/telerivet/phone.rb', line 206 def name=(value) set('name', value) end |
#phone_number ⇒ Object
210 211 212 |
# File 'lib/telerivet/phone.rb', line 210 def phone_number get('phone_number') end |
#phone_number=(value) ⇒ Object
214 215 216 |
# File 'lib/telerivet/phone.rb', line 214 def phone_number=(value) set('phone_number', value) end |
#phone_type ⇒ Object
218 219 220 |
# File 'lib/telerivet/phone.rb', line 218 def phone_type get('phone_type') end |
#project_id ⇒ Object
242 243 244 |
# File 'lib/telerivet/phone.rb', line 242 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)
186 187 188 189 |
# File 'lib/telerivet/phone.rb', line 186 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.
194 195 196 |
# File 'lib/telerivet/phone.rb', line 194 def save() super end |
#send_limit ⇒ Object
278 279 280 |
# File 'lib/telerivet/phone.rb', line 278 def send_limit get('send_limit') end |
#send_paused ⇒ Object
226 227 228 |
# File 'lib/telerivet/phone.rb', line 226 def send_paused get('send_paused') end |
#send_paused=(value) ⇒ Object
230 231 232 |
# File 'lib/telerivet/phone.rb', line 230 def send_paused=(value) set('send_paused', value) end |
#time_created ⇒ Object
234 235 236 |
# File 'lib/telerivet/phone.rb', line 234 def time_created get('time_created') end |