Class: Pobo::DTO::Content
- Inherits:
-
Object
- Object
- Pobo::DTO::Content
- Defined in:
- lib/pobo/dto/content.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#marketplace ⇒ Object
readonly
Returns the value of attribute marketplace.
Class Method Summary collapse
Instance Method Summary collapse
- #get_html(language) ⇒ Object
- #get_marketplace(language) ⇒ Object
- #html_default ⇒ Object
-
#initialize(html: {}, marketplace: {}) ⇒ Content
constructor
A new instance of Content.
- #marketplace_default ⇒ Object
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(html: {}, marketplace: {}) ⇒ Content
Returns a new instance of Content.
8 9 10 11 |
# File 'lib/pobo/dto/content.rb', line 8 def initialize(html: {}, marketplace: {}) @html = html.transform_keys(&:to_s) @marketplace = marketplace.transform_keys(&:to_s) end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
6 7 8 |
# File 'lib/pobo/dto/content.rb', line 6 def html @html end |
#marketplace ⇒ Object (readonly)
Returns the value of attribute marketplace.
6 7 8 |
# File 'lib/pobo/dto/content.rb', line 6 def marketplace @marketplace end |
Class Method Details
.from_hash(hash) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pobo/dto/content.rb', line 13 def self.from_hash(hash) return nil if hash.nil? new( html: hash["html"] || hash[:html] || {}, marketplace: hash["marketplace"] || hash[:marketplace] || {} ) end |
Instance Method Details
#get_html(language) ⇒ Object
22 23 24 |
# File 'lib/pobo/dto/content.rb', line 22 def get_html(language) @html[language.to_s] end |
#get_marketplace(language) ⇒ Object
26 27 28 |
# File 'lib/pobo/dto/content.rb', line 26 def get_marketplace(language) @marketplace[language.to_s] end |
#html_default ⇒ Object
30 31 32 |
# File 'lib/pobo/dto/content.rb', line 30 def html_default @html["default"] end |
#marketplace_default ⇒ Object
34 35 36 |
# File 'lib/pobo/dto/content.rb', line 34 def marketplace_default @marketplace["default"] end |
#to_hash ⇒ Object Also known as: to_h
38 39 40 41 42 43 |
# File 'lib/pobo/dto/content.rb', line 38 def to_hash { "html" => @html, "marketplace" => @marketplace } end |