Class: Redox::Models::Media
- Inherits:
-
AbstractModel
- Object
- Hashie::Trash
- AbstractModel
- Redox::Models::Media
- Defined in:
- lib/redox/models/media.rb
Constant Summary collapse
- BLOB_REQUIRED_SIZE =
200 * 1024
Constants inherited from AbstractModel
AbstractModel::HIGH_LEVEL_KEYS
Instance Method Summary collapse
Methods inherited from AbstractModel
from_response, from_response_inflected, #insurances, #to_json
Instance Method Details
#add_filepath(path) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/redox/models/media.rb', line 41 def add_filepath(path) if File.size(path) > BLOB_REQUIRED_SIZE raise 'Not implemented' else self.file_contents = Base64::encode64(File.read(path)) self.file_type = "#{File.extname(path)}".delete_prefix('.').upcase self.file_name = File.basename(path, '.*') end end |
#availability=(value) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/redox/models/media.rb', line 30 def availability=(value) case value when true self[:Availability] = 'Available' when false self[:Availability] = 'Unavailable' else self[:Availability] = value end end |