Class: WowzaCloud::Schedule

Inherits:
Client
  • Object
show all
Defined in:
lib/wowza_cloud/schedule.rb

Instance Attribute Summary collapse

Attributes inherited from Client

#headers

Class Method Summary collapse

Instance Method Summary collapse

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_typeObject

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_atObject

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_atObject

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_repeatObject

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_atObject

Returns the value of attribute ends_at.



6
7
8
# File 'lib/wowza_cloud/schedule.rb', line 6

def ends_at
  @ends_at
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/wowza_cloud/schedule.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/wowza_cloud/schedule.rb', line 6

def name
  @name
end

#recurrence_dataObject

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_repeatObject

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_transcoderObject

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

Parameters:

  • value

    the value to set the attribute state to.



6
7
8
# File 'lib/wowza_cloud/schedule.rb', line 6

def state=(value)
  @state = value
end

#stop_transcoderObject

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_idObject

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_nameObject

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_atObject

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

.allObject



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

#disableObject



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

#enableObject



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_timeObject



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_timeObject



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

#statusObject 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

#streamObject



57
58
59
# File 'lib/wowza_cloud/schedule.rb', line 57

def stream
  Stream.get_stream(@transcoder_id) 
end