Class: Ari::Playback

Inherits:
Resource show all
Defined in:
lib/ari/resources/playback.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#add_listener, client, #client, #remove_all_listeners!, #remove_listener

Methods inherited from Model

#attributes=, #initialize

Constructor Details

This class inherits a constructor from Ari::Model

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/ari/resources/playback.rb', line 15

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



15
16
17
# File 'lib/ari/resources/playback.rb', line 15

def language
  @language
end

#media_uriObject (readonly)

Returns the value of attribute media_uri.



15
16
17
# File 'lib/ari/resources/playback.rb', line 15

def media_uri
  @media_uri
end

#stateObject (readonly)

Returns the value of attribute state.



15
16
17
# File 'lib/ari/resources/playback.rb', line 15

def state
  @state
end

#target_uriObject (readonly)

Returns the value of attribute target_uri.



15
16
17
# File 'lib/ari/resources/playback.rb', line 15

def target_uri
  @target_uri
end

Class Method Details

.control(options = {}) ⇒ Object

POST /playbacks/%playbackId/control

Control object for a playback operation.

Parameters:

playbackId (required) - Playback’s id operation (required) - Operation to perform on the playback.

Raises:

  • (ArgumentError)


69
70
71
72
73
74
# File 'lib/ari/resources/playback.rb', line 69

def self.control(options = {})
  raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
  raise ArgumentError.new("Parameter operation must be passed in options hash.") unless options[:operation]
  path = '/playbacks/%{playbackId}/control' % options
  response = client(options).post(path, options)
end

.get(options = {}) ⇒ Object

GET /playbacks/%playbackId

Control object for a playback operation.

Parameters:

playbackId (required) - Playback’s id

Raises:

  • (ArgumentError)


27
28
29
30
31
32
# File 'lib/ari/resources/playback.rb', line 27

def self.get(options = {})
  raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
  path = '/playbacks/%{playbackId}' % options
  response = client(options).get(path, options)
  Playback.new(response.merge(client: options[:client]))
end

.stop(options = {}) ⇒ Object

DELETE /playbacks/%playbackId

Control object for a playback operation.

Parameters:

playbackId (required) - Playback’s id



47
48
49
50
51
52
53
# File 'lib/ari/resources/playback.rb', line 47

def self.stop(options = {})
  raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
  path = '/playbacks/%{playbackId}' % options
  response = client(options).delete(path, options)
rescue Ari::RequestError => e
  raise unless e.code == '404'
end

Instance Method Details

#control(options = {}) ⇒ Object



76
77
78
# File 'lib/ari/resources/playback.rb', line 76

def control(options = {})
  self.class.control(options.merge(playbackId: self.id, client: @client))
end

#get(options = {}) ⇒ Object



34
35
36
# File 'lib/ari/resources/playback.rb', line 34

def get(options = {})
  self.class.get(options.merge(playbackId: self.id, client: @client))
end

#stop(options = {}) ⇒ Object



55
56
57
# File 'lib/ari/resources/playback.rb', line 55

def stop(options = {})
  self.class.stop(options.merge(playbackId: self.id, client: @client))
end