Class: Brandmaker::ExternalMediaVariable
- Defined in:
- lib/brandmaker/external_media_variable.rb
Instance Attribute Summary collapse
-
#downloadUrl ⇒ Object
Returns the value of attribute downloadUrl.
-
#fileOriginalName ⇒ Object
Returns the value of attribute fileOriginalName.
-
#fileType ⇒ Object
Returns the value of attribute fileType.
Attributes inherited from Variable
Instance Method Summary collapse
Methods inherited from Variable
#data, #initialize, #label, #purpose, #technical_name, #type_id
Constructor Details
This class inherits a constructor from Brandmaker::Variable
Instance Attribute Details
#downloadUrl ⇒ Object
Returns the value of attribute downloadUrl.
6 7 8 |
# File 'lib/brandmaker/external_media_variable.rb', line 6 def downloadUrl @downloadUrl end |
#fileOriginalName ⇒ Object
Returns the value of attribute fileOriginalName.
7 8 9 |
# File 'lib/brandmaker/external_media_variable.rb', line 7 def fileOriginalName @fileOriginalName end |
#fileType ⇒ Object
Returns the value of attribute fileType.
8 9 10 |
# File 'lib/brandmaker/external_media_variable.rb', line 8 def fileType @fileType end |
Instance Method Details
#reload ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/brandmaker/external_media_variable.rb', line 14 def reload if value.present? res = RestClient.get( Brandmaker.configuration.external_media_service, { :params => { :mediaID => value, :secret => Brandmaker.configuration.external_media_service_secret } } ) hash = JSON.parse(res) error = hash['ERROR'].presence if error raise error end self.fileOriginalName = hash['fileOriginalName'] self.downloadUrl = hash['downloadUrl'] self.fileType = hash['fileType'] self end end |
#value ⇒ Object
10 11 12 |
# File 'lib/brandmaker/external_media_variable.rb', line 10 def value super.split(",").last rescue nil end |