Class: Eisenhower::RoadUpdate

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RoadUpdate

Returns a new instance of RoadUpdate.



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

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

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



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

def app_id
  @app_id
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#road_idObject

Returns the value of attribute road_id.



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

def road_id
  @road_id
end

#road_map_idObject

Returns the value of attribute road_map_id.



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

def road_map_id
  @road_map_id
end

#staffObject

Returns the value of attribute staff.



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

def staff
  @staff
end

#staff_idObject

Returns the value of attribute staff_id.



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

def staff_id
  @staff_id
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end

#updateObject

Returns the value of attribute update.



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

def update
  @update
end

Class Method Details

.all(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/eisenhower/road_update.rb', line 17

def all(options={})
  roadmap_id=nil, app_id=nil, limit=3, skip=0
  options = {
      :roadmap_id => nil, 
      :app_id => nil,
      :limit => 3,
      :skip => 0
      }.merge(options)
      
  body = Eisenhower::Client.get_and_parse("/update/listAll/roadmap/#{options[:roadmap_id]}/app/#{options[:app_id]}/limit/#{options[:limit]}/skip/#{options[:skip]}")
  body["updates"].collect{|update| 
    Eisenhower::RoadUpdate.new({
      :id               => update["_id"],
      :road_id          => update["roadId"],
      :staff_id         => update["staffId"],
      :time             => update["time"],
      :update           => update["update"]
    })}
end

.find(road_update_id) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/eisenhower/road_update.rb', line 37

def find(road_update_id)
  body = Eisenhower::Client.get_and_parse("/update/get/id/#{road_update_id}")
  Eisenhower::RoadUpdate.new({
    :id               => body["_id"],
    :road_id          => body["roadId"],
    :staff_id         => body["staffId"],
    :time             => body["time"],
    :update           => body["update"]
  })
end

Instance Method Details

#ownerObject

Returns the value of attribute staff.



5
6
7
# File 'lib/eisenhower/road_update.rb', line 5

def staff
  @staff
end

#userObject

Returns the value of attribute staff.



4
5
6
# File 'lib/eisenhower/road_update.rb', line 4

def staff
  @staff
end