Class: Resumator::Activities

Inherits:
Object
  • Object
show all
Defined in:
lib/resumator-client/activities.rb

Defined Under Namespace

Classes: StatusChange

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Activities

Returns a new instance of Activities.



6
7
8
# File 'lib/resumator-client/activities.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#status_history(obj_id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/resumator-client/activities.rb', line 10

def status_history(obj_id)
  resp = @client.activities(object_id: obj_id, category: "resume_status")
  resp = [resp] if resp.is_a? Hash # If there is only one activity, it comes back on its own not in an array.
  history = []
  resp.each do |r|
    data = r["action"].scan /"([^"]+)"/
    change = StatusChange.new()
    change.time = r["time"]
    change.date = r["date"]
    change.from = data[0].first
    change.to = data[1].first
    change.position = data[2].first
    history << change
  end
  history
end