Class: Ari::Sound

Inherits:
Resource show all
Defined in:
lib/ari/resources/sound.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

#formatsObject

Returns the value of attribute formats.



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

def formats
  @formats
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Class Method Details

.get(options = {}) ⇒ Object

GET /sounds/%soundId

Individual sound

Parameters:

soundId (required) - Sound’s id

Raises:

  • (ArgumentError)


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

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

.list(options = {}) ⇒ Object

GET /sounds

Sounds

Parameters:

lang - Lookup sound for a specific language. format - Lookup sound in a specific format.



32
33
34
35
36
# File 'lib/ari/resources/sound.rb', line 32

def self.list(options = {})
  path = '/sounds'
  response = client(options).get(path, options)
  response.map { |hash| Sound.new(hash.merge(client: options[:client])) }
end

Instance Method Details

#get(options = {}) ⇒ Object



54
55
56
# File 'lib/ari/resources/sound.rb', line 54

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