Class: Trajectory::Ideas

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/trajectory/domain/ideas.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*ideas) ⇒ Ideas

Creates a new collection of Trajectory::Idea

Parameters:



8
9
10
# File 'lib/trajectory/domain/ideas.rb', line 8

def initialize(*ideas)
  super(ideas)
end

Class Method Details

.from_json(project, json_attributes) ⇒ Object

Create a new collection of Trajectory::Idea from a JSON array of attributes from trajectory API

Parameters:

  • project (Project)

    the project the iterations belongs to

  • json_attributes (Hash)

    the hash of attributes of each idea of the collection



16
17
18
19
20
21
# File 'lib/trajectory/domain/ideas.rb', line 16

def self.from_json(project, json_attributes)
  new(*json_attributes.map do |attributes|
    attributes = attributes.symbolize_keys!.merge({project_id: project.id})
    Idea.new(attributes)
  end)
end