Class: PRX::Model::AudioFile
- Includes:
- Representer::Full::AudioFileRepresenter, Roar::Representer::JSON
- Defined in:
- lib/prx/model/audio_file.rb
Instance Attribute Summary collapse
-
#attach_file ⇒ Object
Returns the value of attribute attach_file.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#label ⇒ Object
Returns the value of attribute label.
-
#length ⇒ Object
Returns the value of attribute length.
-
#size ⇒ Object
Returns the value of attribute size.
-
#status ⇒ Object
Returns the value of attribute status.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(*args) ⇒ AudioFile
constructor
A new instance of AudioFile.
- #prepare_file_upload ⇒ Object
Methods inherited from Base
#class_path_part, #find_by_id, request, #request, #save
Constructor Details
#initialize(*args) ⇒ AudioFile
Returns a new instance of AudioFile.
30 31 32 33 34 |
# File 'lib/prx/model/audio_file.rb', line 30 def initialize(*args) self.content_type = 'audio/mpeg' super self end |
Instance Attribute Details
#attach_file ⇒ Object
Returns the value of attribute attach_file.
13 14 15 |
# File 'lib/prx/model/audio_file.rb', line 13 def attach_file @attach_file end |
#content_type ⇒ Object
Returns the value of attribute content_type.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def content_type @content_type end |
#label ⇒ Object
Returns the value of attribute label.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def label @label end |
#length ⇒ Object
Returns the value of attribute length.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def length @length end |
#size ⇒ Object
Returns the value of attribute size.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def size @size end |
#status ⇒ Object
Returns the value of attribute status.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def status @status end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/prx/model/audio_file.rb', line 12 def url @url end |
Instance Method Details
#prepare_file_upload ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/prx/model/audio_file.rb', line 21 def prepare_file_upload if self.attach_file && self.attach_file.is_a?(String) uri = URI.parse(self.attach_file) if uri.scheme.blank? || (uri.scheme == 'file') self.attach_file = Faraday::UploadIO.new(uri.path, self.content_type) end end end |