Class: Telerivet::DataRow

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

Overview

Represents a row in a custom data table.

For example, each response to a poll is stored as one row in a data table. If a poll has a question with ID ‘q1’, the verbatim response to that question would be stored in row.vars.q1, and the response code would be stored in row.vars.q1_code.

Each custom variable name within a data row corresponds to a different column/field of the data table.

Fields:

- id (string, max 34 characters)
    * ID of the data row
    * Read-only

- contact_id
    * ID of the contact this row is associated with (or null if not associated with any
        contact)
    * Updatable via API

- from_number (string)
    * Phone number that this row is associated with (or null if not associated with any
        phone number)
    * Updatable via API

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

- time_created (UNIX timestamp)
    * The time this row was created in Telerivet
    * Read-only

- time_updated (UNIX timestamp)
    * The time this row was last updated in Telerivet
    * Read-only

- table_id
    * ID of the table this data row belongs to
    * Read-only

- project_id
    * ID of the project this data row belongs to
    * Read-only

Instance Method Summary collapse

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

#contact_idObject



74
75
76
# File 'lib/telerivet/datarow.rb', line 74

def contact_id
    get('contact_id')
end

#contact_id=(value) ⇒ Object



78
79
80
# File 'lib/telerivet/datarow.rb', line 78

def contact_id=(value)
    set('contact_id', value)
end

#deleteObject

Deletes this data row.



66
67
68
# File 'lib/telerivet/datarow.rb', line 66

def delete()
    @api.do_request("DELETE", get_base_api_path())
end

#from_numberObject



82
83
84
# File 'lib/telerivet/datarow.rb', line 82

def from_number
    get('from_number')
end

#from_number=(value) ⇒ Object



86
87
88
# File 'lib/telerivet/datarow.rb', line 86

def from_number=(value)
    set('from_number', value)
end

#get_base_api_pathObject



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

def get_base_api_path()
    "/projects/#{get('project_id')}/tables/#{get('table_id')}/rows/#{get('id')}"
end

#idObject



70
71
72
# File 'lib/telerivet/datarow.rb', line 70

def id
    get('id')
end

#project_idObject



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

def project_id
    get('project_id')
end

#saveObject

Saves any fields or custom variables that have changed for this data row.



59
60
61
# File 'lib/telerivet/datarow.rb', line 59

def save()
    super
end

#table_idObject



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

def table_id
    get('table_id')
end

#time_createdObject



90
91
92
# File 'lib/telerivet/datarow.rb', line 90

def time_created
    get('time_created')
end

#time_updatedObject



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

def time_updated
    get('time_updated')
end