Class: BoundioV2::AudioFile

Inherits:
Resource show all
Defined in:
lib/boundioV2/audio_file.rb

Defined Under Namespace

Classes: InsufficientParametersOrTooBigFile, VoiceConversionError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

create, #initialize, request

Constructor Details

This class inherits a constructor from BoundioV2::Resource

Instance Attribute Details

#convtextObject

Returns the value of attribute convtext.



3
4
5
# File 'lib/boundioV2/audio_file.rb', line 3

def convtext
  @convtext
end

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/boundioV2/audio_file.rb', line 3

def file
  @file
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/boundioV2/audio_file.rb', line 3

def id
  @id
end

Class Method Details

.api_versionObject



5
6
7
# File 'lib/boundioV2/audio_file.rb', line 5

def self.api_version
  "vd2"
end

.exceptionsObject



9
10
11
# File 'lib/boundioV2/audio_file.rb', line 9

def self.exceptions
  super.merge(2 => InsufficientParametersOrTooBigFile, 6 => VoiceConversionError)
end

Instance Method Details

#+(file) ⇒ Object



24
25
26
# File 'lib/boundioV2/audio_file.rb', line 24

def +(file)
  BoundioV2::Cast.new(self, file)
end

#saveObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/boundioV2/audio_file.rb', line 13

def save
  args = if file
    { :file => file, :filename => File.basename(file.path) }
  else
    { :convtext => convtext, :filename => convtext }
  end
  res = self.class.request :post, "/file/post", args
  self.id = res["fileid"]
  true
end