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
    * 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



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

def contact_id
    get('contact_id')
end

#contact_id=(value) ⇒ Object



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

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

#deleteObject

Deletes this data row.



61
62
63
# File 'lib/telerivet/datarow.rb', line 61

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

#from_numberObject



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

def from_number
    get('from_number')
end

#from_number=(value) ⇒ Object



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

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

#get_base_api_pathObject



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

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

#idObject



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

def id
    get('id')
end

#project_idObject



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

def project_id
    get('project_id')
end

#saveObject

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



54
55
56
# File 'lib/telerivet/datarow.rb', line 54

def save()
    super
end

#table_idObject



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

def table_id
    get('table_id')
end

#time_createdObject



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

def time_created
    get('time_created')
end

#time_updatedObject



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

def time_updated
    get('time_updated')
end