Class: Moo::Model::ImageData
Instance Attribute Summary collapse
-
#enhance ⇒ Object
Returns the value of attribute enhance.
-
#image_box ⇒ Object
Returns the value of attribute image_box.
-
#image_store_file_id ⇒ Object
Returns the value of attribute image_store_file_id.
-
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
Attributes inherited from Data
Instance Method Summary collapse
- #from_hash(hash) ⇒ Object
- #from_json(json) ⇒ Object
-
#initialize {|_self| ... } ⇒ ImageData
constructor
A new instance of ImageData.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Data
Constructor Details
#initialize {|_self| ... } ⇒ ImageData
Returns a new instance of ImageData.
6 7 8 9 |
# File 'lib/moo/model/image_data.rb', line 6 def initialize @enhance = false yield self if block_given? end |
Instance Attribute Details
#enhance ⇒ Object
Returns the value of attribute enhance.
4 5 6 |
# File 'lib/moo/model/image_data.rb', line 4 def enhance @enhance end |
#image_box ⇒ Object
Returns the value of attribute image_box.
4 5 6 |
# File 'lib/moo/model/image_data.rb', line 4 def image_box @image_box end |
#image_store_file_id ⇒ Object
Returns the value of attribute image_store_file_id.
4 5 6 |
# File 'lib/moo/model/image_data.rb', line 4 def image_store_file_id @image_store_file_id end |
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
4 5 6 |
# File 'lib/moo/model/image_data.rb', line 4 def resource_uri @resource_uri end |
Instance Method Details
#from_hash(hash) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/moo/model/image_data.rb', line 49 def from_hash hash self.link_id = hash[:linkId] b = BoundingBox.new b.from_json(hash[:imageBox].to_json) self.image_box = b self.resource_uri = hash[:resourceUri] self.image_store_file_id = hash[:imageStoreFileId] if hash[:imageStoreFileId] self.enhance = hash[:enhance] end |
#from_json(json) ⇒ Object
59 60 61 |
# File 'lib/moo/model/image_data.rb', line 59 def from_json json from_hash(JSON.parse(json, :symbolize_names => true)) end |
#to_hash ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/moo/model/image_data.rb', line 37 def to_hash hash = { type: type, linkId: link_id, imageBox: image_box.to_hash, resourceUri: resource_uri, } hash[:imageStoreFileId] = image_store_file_id unless image_store_file_id.nil? hash[:enhance] = enhance hash end |
#to_json ⇒ Object
33 34 35 |
# File 'lib/moo/model/image_data.rb', line 33 def to_json to_hash.to_json end |