Class: Eisenhower::Road
- Inherits:
-
Object
- Object
- Eisenhower::Road
- Defined in:
- lib/eisenhower/road.rb
Constant Summary collapse
- BOOLEANS =
%w(collapsed due)
Instance Attribute Summary collapse
-
#collapsed ⇒ Object
Returns the value of attribute collapsed.
-
#description ⇒ Object
Returns the value of attribute description.
-
#description_html ⇒ Object
Returns the value of attribute description_html.
-
#due ⇒ Object
Returns the value of attribute due.
-
#id ⇒ Object
Returns the value of attribute id.
-
#position ⇒ Object
Returns the value of attribute position.
-
#staff_ids ⇒ Object
Returns the value of attribute staff_ids.
-
#started ⇒ Object
Returns the value of attribute started.
-
#status ⇒ Object
Returns the value of attribute status.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
-
#update_ids ⇒ Object
Returns the value of attribute update_ids.
-
#updates_count ⇒ Object
Returns the value of attribute updates_count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Road
constructor
A new instance of Road.
- #staff ⇒ Object
- #updates ⇒ Object
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
#collapsed ⇒ Object
Returns the value of attribute collapsed.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def collapsed @collapsed end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def description @description end |
#description_html ⇒ Object
Returns the value of attribute description_html.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def description_html @description_html end |
#due ⇒ Object
Returns the value of attribute due.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def due @due end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def id @id end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def position @position end |
#staff_ids ⇒ Object
Returns the value of attribute staff_ids.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def staff_ids @staff_ids end |
#started ⇒ Object
Returns the value of attribute started.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def started @started end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def status @status end |
#title ⇒ Object 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_ids ⇒ Object
Returns the value of attribute update_ids.
3 4 5 |
# File 'lib/eisenhower/road.rb', line 3 def update_ids @update_ids end |
#updates_count ⇒ Object
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
#staff ⇒ Object
21 22 23 |
# File 'lib/eisenhower/road.rb', line 21 def staff self.staff_ids.collect{|id| Eisenhower::Staff.find(id)} end |
#updates ⇒ Object
17 18 19 |
# File 'lib/eisenhower/road.rb', line 17 def updates self.update_ids.collect{|id| Eisenhower::RoadUpdate.find(id)} end |