Class: Telerivet::ScheduledService
- Inherits:
-
Entity
- Object
- Entity
- Telerivet::ScheduledService
show all
- Defined in:
- lib/telerivet/scheduledservice.rb
Overview
Represents a scheduled service within Telerivet.
Scheduled services allow services to be triggered automatically at specified
times.
The ScheduledService object is only used for services that are triggered for
a project (e.g. scheduled_actions or scheduled_script).
Note: To schedule services that are triggered for a contact, the
ScheduledMessage object should be used instead, with
message_type=service.
Fields:
- id (string, max 34 characters)
* ID of the scheduled service
* Read-only
- service_id (string, max 34 characters)
* ID of the service to be triggered
* Read-only
- rrule
* Recurrence rule for recurring scheduled services, e.g. 'FREQ=MONTHLY' or
'FREQ=WEEKLY;INTERVAL=2'; see
[RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
* Updatable via API
- timezone_id
* Timezone ID used to compute times for recurring scheduled services; see [List of tz
database time zones Wikipedia
article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
* Updatable via API
- time_created (UNIX timestamp)
* Time the scheduled service was created in Telerivet
* Read-only
- start_time (UNIX timestamp)
* The time that the service will be triggered (or first triggered for recurring
scheduled services)
* Updatable via API
- end_time (UNIX timestamp)
* Time after which a recurring scheduled service will stop (not applicable to
non-recurring scheduled services)
* Updatable via API
- prev_time (UNIX timestamp)
* The most recent time that Telerivet triggered this scheduled service (null if it has
never been triggered)
* Read-only
- next_time (UNIX timestamp)
* The next upcoming time that Telerivet will trigger this scheduled service (null if
it will not be triggered again)
* Read-only
- occurrences (int)
* Number of times this scheduled service has already been triggered
* Read-only
- vars (Hash)
* Custom variables stored for this scheduled service. 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 scheduled service belongs to
* Read-only
Instance Method Summary
collapse
Methods inherited from Entity
#get, #initialize, #load, #set, #set_data, #to_s, #vars
Instance Method Details
#delete ⇒ Object
Cancels this scheduled service.
90
91
92
|
# File 'lib/telerivet/scheduledservice.rb', line 90
def delete()
@api.do_request("DELETE", get_base_api_path())
end
|
#end_time ⇒ Object
130
131
132
|
# File 'lib/telerivet/scheduledservice.rb', line 130
def end_time
get('end_time')
end
|
#end_time=(value) ⇒ Object
134
135
136
|
# File 'lib/telerivet/scheduledservice.rb', line 134
def end_time=(value)
set('end_time', value)
end
|
#get_base_api_path ⇒ Object
154
155
156
|
# File 'lib/telerivet/scheduledservice.rb', line 154
def get_base_api_path()
"/projects/#{get('project_id')}/scheduled_services/#{get('id')}"
end
|
#id ⇒ Object
94
95
96
|
# File 'lib/telerivet/scheduledservice.rb', line 94
def id
get('id')
end
|
#next_time ⇒ Object
142
143
144
|
# File 'lib/telerivet/scheduledservice.rb', line 142
def next_time
get('next_time')
end
|
#occurrences ⇒ Object
146
147
148
|
# File 'lib/telerivet/scheduledservice.rb', line 146
def occurrences
get('occurrences')
end
|
#prev_time ⇒ Object
138
139
140
|
# File 'lib/telerivet/scheduledservice.rb', line 138
def prev_time
get('prev_time')
end
|
#project_id ⇒ Object
150
151
152
|
# File 'lib/telerivet/scheduledservice.rb', line 150
def project_id
get('project_id')
end
|
#rrule ⇒ Object
102
103
104
|
# File 'lib/telerivet/scheduledservice.rb', line 102
def rrule
get('rrule')
end
|
#rrule=(value) ⇒ Object
106
107
108
|
# File 'lib/telerivet/scheduledservice.rb', line 106
def rrule=(value)
set('rrule', value)
end
|
#save ⇒ Object
Saves any fields or custom variables that have changed for this scheduled service.
83
84
85
|
# File 'lib/telerivet/scheduledservice.rb', line 83
def save()
super
end
|
#service_id ⇒ Object
98
99
100
|
# File 'lib/telerivet/scheduledservice.rb', line 98
def service_id
get('service_id')
end
|
#start_time ⇒ Object
122
123
124
|
# File 'lib/telerivet/scheduledservice.rb', line 122
def start_time
get('start_time')
end
|
#start_time=(value) ⇒ Object
126
127
128
|
# File 'lib/telerivet/scheduledservice.rb', line 126
def start_time=(value)
set('start_time', value)
end
|
#time_created ⇒ Object
118
119
120
|
# File 'lib/telerivet/scheduledservice.rb', line 118
def time_created
get('time_created')
end
|
#timezone_id ⇒ Object
110
111
112
|
# File 'lib/telerivet/scheduledservice.rb', line 110
def timezone_id
get('timezone_id')
end
|
#timezone_id=(value) ⇒ Object
114
115
116
|
# File 'lib/telerivet/scheduledservice.rb', line 114
def timezone_id=(value)
set('timezone_id', value)
end
|