Class: Eisenhower::Roadmap
- Inherits:
-
Object
- Object
- Eisenhower::Roadmap
- Defined in:
- lib/eisenhower/roadmap.rb
Constant Summary collapse
- BOOLEANS =
%w(archived public)
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#archived ⇒ Object
Returns the value of attribute archived.
-
#id ⇒ Object
Returns the value of attribute id.
-
#public ⇒ Object
Returns the value of attribute public.
-
#staff_ids ⇒ Object
Returns the value of attribute staff_ids.
-
#time ⇒ Object
Returns the value of attribute time.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Roadmap
constructor
A new instance of Roadmap.
- #roads ⇒ Object
- #staff ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Roadmap
Returns a new instance of Roadmap.
7 8 9 |
# File 'lib/eisenhower/roadmap.rb', line 7 def initialize(attributes={}) attributes.each { |key, val| send("#{key}=", val) if respond_to?("#{key}=") } end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def app_id @app_id end |
#archived ⇒ Object
Returns the value of attribute archived.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def archived @archived end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def id @id end |
#public ⇒ Object
Returns the value of attribute public.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def public @public end |
#staff_ids ⇒ Object
Returns the value of attribute staff_ids.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def staff_ids @staff_ids end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def time @time end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
3 4 5 |
# File 'lib/eisenhower/roadmap.rb', line 3 def title @title end |
Class Method Details
.all ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/eisenhower/roadmap.rb', line 41 def all return body = Eisenhower::Client.get_and_parse('/roadmap/listAll') #body.collect{|roadmap| Eisenhower::Roadmap.new({ # :id => roadmap.last.last["_id"], # :app_id => roadmap.last.last["appId"], # :archived => roadmap.last.last["archived"], # :public => roadmap.last.last["public"], # :title => roadmap.last.last["title"], # :time => roadmap.last.last["time"], # :staff_ids => roadmap.last.last["staff"].collect{|staff| staff["_id"]} # } #)} end |
.find(app_id) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/eisenhower/roadmap.rb', line 55 def find(app_id) body = Eisenhower::Client.get_and_parse("/roadmap/get/id/#{app_id}") Eisenhower::Roadmap.new({ :id => body["_id"], :app_id => body["appId"], :archived => body["archived"], :public => body["public"], :title => body["title"], :staff_ids => body["staff"].collect{|staff| staff["_id"]} }) end |
Instance Method Details
#roads ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eisenhower/roadmap.rb', line 21 def roads response = Eisenhower::Client.fetch("/roadmap/roads/id/#{self.id}") body = Crack::JSON.parse(response.body)["response"] body.collect{|road| Eisenhower::Road.new({ :id => road["_id"], :title => road["title"], :description => road["description"], :description_html => road["descriptionHtml"], :collapsed => road["collapsed"], :status => road["status"]["status"], :due => road["due"] ? road["due"]["dmy"] : false, :started => road["start"] ? road["start"]["dmy"] : false, :position => road["order"]["position"], :updates_count => road["updatesCount"], :update_ids => road["updates"].collect{|up| up["_id"]}, :staff_ids => road["staffList"] })} end |
#staff ⇒ Object
17 18 19 |
# File 'lib/eisenhower/roadmap.rb', line 17 def staff self.staff_ids.collect{|id| Eisenhower::Staff.find(id) } end |