Class: Eisenhower::Road

Inherits:
Object
  • Object
show all
Defined in:
lib/eisenhower/road.rb

Constant Summary collapse

BOOLEANS =
%w(collapsed due)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Road

Returns a new instance of Road.



7
8
9
# File 'lib/eisenhower/road.rb', line 7

def initialize(attributes={})
  attributes.each { |key, val| send("#{key}=", val) if respond_to?("#{key}=") }
end

Instance Attribute Details

#collapsedObject

Returns the value of attribute collapsed.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def collapsed
  @collapsed
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def description
  @description
end

#description_htmlObject

Returns the value of attribute description_html.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def description_html
  @description_html
end

#dueObject

Returns the value of attribute due.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def due
  @due
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def id
  @id
end

#positionObject

Returns the value of attribute position.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def position
  @position
end

#staff_idsObject

Returns the value of attribute staff_ids.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def staff_ids
  @staff_ids
end

#startedObject

Returns the value of attribute started.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def started
  @started
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def status
  @status
end

#titleObject Also known as: name

Returns the value of attribute title.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def title
  @title
end

#update_idsObject

Returns the value of attribute update_ids.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def update_ids
  @update_ids
end

#updates_countObject

Returns the value of attribute updates_count.



3
4
5
# File 'lib/eisenhower/road.rb', line 3

def updates_count
  @updates_count
end

Class Method Details

.find(road_id) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/eisenhower/road.rb', line 27

def find(road_id)
  body = Eisenhower::Client.get_and_parse("/road/get/id/#{road_id}")
  Eisenhower::Road.new({
    :id               => body["_id"], 
    :title            => body["title"], 
    :description      => body["description"], 
    :description_html => body["descriptionHtml"], 
    :collapsed        => body["collapsed"], 
    :status           => body["status"]["status"], 
    :due              => body["due"] ? body["due"]["dmy"] : false,
    :started          => body["start"] ? body["start"]["dmy"] : false,
    :position         => body["order"]["position"], 
    :updates_count    => body["updatesCount"],
    :update_ids       => body["updates"].collect{|up| up["_id"]},
    :staff_ids        => body["staffList"]
  })
end

Instance Method Details

#staffObject



21
22
23
# File 'lib/eisenhower/road.rb', line 21

def staff
  self.staff_ids.collect{|id| Eisenhower::Staff.find(id)}
end

#updatesObject



17
18
19
# File 'lib/eisenhower/road.rb', line 17

def updates
  self.update_ids.collect{|id| Eisenhower::RoadUpdate.find(id)}
end