Class: Diggr::Container
- Inherits:
-
Object
- Object
- Diggr::Container
- Defined in:
- lib/diggr/response_classes/container.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#short_name ⇒ Object
Returns the value of attribute short_name.
-
#topics ⇒ Object
Returns the value of attribute topics.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Container
constructor
A new instance of Container.
Constructor Details
#initialize ⇒ Container
Returns a new instance of Container.
9 10 11 |
# File 'lib/diggr/response_classes/container.rb', line 9 def initialize self.topics = [] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/diggr/response_classes/container.rb', line 7 def name @name end |
#short_name ⇒ Object
Returns the value of attribute short_name.
7 8 9 |
# File 'lib/diggr/response_classes/container.rb', line 7 def short_name @short_name end |
#topics ⇒ Object
Returns the value of attribute topics.
7 8 9 |
# File 'lib/diggr/response_classes/container.rb', line 7 def topics @topics end |
Class Method Details
.new_from_parsed_json(data) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/diggr/response_classes/container.rb', line 13 def self.new_from_parsed_json(data) container = Container.new container.name = data['name'] container.short_name = data['short_name'] if data.has_key? 'topics' data['topics'].each do | topic_data | container.topics << Topic.new_from_parsed_json(topic_data) end end container end |