Class: WowzaCloud::Schedule
- Defined in:
- lib/wowza_cloud/schedule.rb
Instance Attribute Summary collapse
-
#action_type ⇒ Object
Returns the value of attribute action_type.
-
#begins_at ⇒ Object
Returns the value of attribute begins_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#end_repeat ⇒ Object
Returns the value of attribute end_repeat.
-
#ends_at ⇒ Object
Returns the value of attribute ends_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#recurrence_data ⇒ Object
Returns the value of attribute recurrence_data.
-
#start_repeat ⇒ Object
Returns the value of attribute start_repeat.
-
#start_transcoder ⇒ Object
Returns the value of attribute start_transcoder.
-
#state ⇒ Object
Sets the attribute state.
-
#stop_transcoder ⇒ Object
Returns the value of attribute stop_transcoder.
-
#transcoder_id ⇒ Object
Returns the value of attribute transcoder_id.
-
#transcoder_name ⇒ Object
Returns the value of attribute transcoder_name.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes inherited from Client
Class Method Summary collapse
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
- #end_time ⇒ Object
-
#initialize(params = {}) ⇒ Schedule
constructor
A new instance of Schedule.
- #start_time ⇒ Object
- #status ⇒ Object (also: #state)
- #stream ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Schedule
Returns a new instance of Schedule.
25 26 27 28 29 30 |
# File 'lib/wowza_cloud/schedule.rb', line 25 def initialize(params = {}) super params.each do |k, v| instance_variable_set(:"@#{k}", v) if self.respond_to?("#{k}=") end end |
Instance Attribute Details
#action_type ⇒ Object
Returns the value of attribute action_type.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def action_type @action_type end |
#begins_at ⇒ Object
Returns the value of attribute begins_at.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def begins_at @begins_at end |
#created_at ⇒ Object
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def created_at @created_at end |
#end_repeat ⇒ Object
Returns the value of attribute end_repeat.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def end_repeat @end_repeat end |
#ends_at ⇒ Object
Returns the value of attribute ends_at.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def ends_at @ends_at end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def name @name end |
#recurrence_data ⇒ Object
Returns the value of attribute recurrence_data.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def recurrence_data @recurrence_data end |
#start_repeat ⇒ Object
Returns the value of attribute start_repeat.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def start_repeat @start_repeat end |
#start_transcoder ⇒ Object
Returns the value of attribute start_transcoder.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def start_transcoder @start_transcoder end |
#state=(value) ⇒ Object
Sets the attribute state
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def state=(value) @state = value end |
#stop_transcoder ⇒ Object
Returns the value of attribute stop_transcoder.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def stop_transcoder @stop_transcoder end |
#transcoder_id ⇒ Object
Returns the value of attribute transcoder_id.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def transcoder_id @transcoder_id end |
#transcoder_name ⇒ Object
Returns the value of attribute transcoder_name.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def transcoder_name @transcoder_name end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
6 7 8 |
# File 'lib/wowza_cloud/schedule.rb', line 6 def updated_at @updated_at end |
Class Method Details
.all ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/wowza_cloud/schedule.rb', line 10 def self.all() result = [] headers = {'wsc-api-key' => WowzaCloud.configuration.api_key, 'wsc-access-key' => WowzaCloud.configuration.access_key} raw_result = get('/schedules', headers: headers) raw_result['schedules'].each do |data| result << WowzaCloud::Schedule.new(data) end return result end |
.get_schedule(schedule_id) ⇒ Object
18 19 20 21 22 |
# File 'lib/wowza_cloud/schedule.rb', line 18 def self.get_schedule(schedule_id) headers = {'wsc-api-key' => WowzaCloud.configuration.api_key, 'wsc-access-key' => WowzaCloud.configuration.access_key} raw_result = get("/schedules/#{schedule_id}", headers: headers) return WowzaCloud::Schedule.new(raw_result['schedule']) end |
Instance Method Details
#disable ⇒ Object
52 53 54 55 |
# File 'lib/wowza_cloud/schedule.rb', line 52 def disable raw_response = self.class.put("/schedules/#{self.id}/disable", headers: @headers) return raw_response['schedule']['state'] end |
#enable ⇒ Object
47 48 49 50 |
# File 'lib/wowza_cloud/schedule.rb', line 47 def enable raw_response = self.class.put("/schedules/#{self.id}/enable", headers: @headers) return raw_response['schedule']['state'] end |
#end_time ⇒ Object
36 37 38 |
# File 'lib/wowza_cloud/schedule.rb', line 36 def end_time Time.parse(Time.parse(@stop_transcoder).strftime("%H:%M:%S")) end |
#start_time ⇒ Object
32 33 34 |
# File 'lib/wowza_cloud/schedule.rb', line 32 def start_time Time.parse(Time.parse(@start_transcoder).strftime("%H:%M:%S")) end |
#status ⇒ Object Also known as: state
40 41 42 43 |
# File 'lib/wowza_cloud/schedule.rb', line 40 def status raw_response = self.class.get("/schedules/#{self.id}/state/", headers: @headers) return raw_response['schedule']['state'] end |
#stream ⇒ Object
57 58 59 |
# File 'lib/wowza_cloud/schedule.rb', line 57 def stream Stream.get_stream(@transcoder_id) end |