Class: LabClient::Events

Inherits:
Common
  • Object
show all
Defined in:
lib/labclient/keys/user.rb,
lib/labclient/events/list.rb,
lib/labclient/events/user.rb,
lib/labclient/keys/project.rb,
lib/labclient/events/project.rb

Overview

Specifics

Constant Summary

Constants included from AccessLevel

AccessLevel::HUMAN_ACCESS_LEVELS, AccessLevel::MACHINE_ACCESS_LEVELS

Instance Attribute Summary

Attributes inherited from Common

#client

Instance Method Summary collapse

Methods inherited from Common

#api_methods, #api_methods_help, #format_id, #format_query_id, #format_query_ids, #format_time?, #group_name, #help, #initialize, #inspect, #klass, #protected_query_access_level, #query_access_level, #query_format_time

Methods included from Docs

#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title

Methods included from AccessLevel

#human_access_level, #human_protected_access_level, #machine_access_level, #machine_protected_access_level

Constructor Details

This class inherits a constructor from LabClient::Common

Instance Method Details

#list(query = {}) ⇒ Object

List



60
61
62
63
64
65
# File 'lib/labclient/events/list.rb', line 60

def list(query = {})
  query[:before] = query[:before].to_time.iso8601 if format_time?(query[:before])
  query[:after] = query[:after].to_time.iso8601 if format_time?(query[:after])

  client.request(:get, 'events', Event, query)
end

#project(project_id, query = {}) ⇒ Object



59
60
61
62
63
64
65
66
# File 'lib/labclient/keys/project.rb', line 59

def project(project_id, query = {})
  project_id = format_id(project_id)

  query[:before] = query[:before].to_time.iso8601 if format_time?(query[:before])
  query[:after] = query[:after].to_time.iso8601 if format_time?(query[:after])

  client.request(:get, "projects/#{project_id}/events", Event, query)
end

#user(user_id, query = {}) ⇒ Object



59
60
61
62
63
64
# File 'lib/labclient/keys/user.rb', line 59

def user(user_id, query = {})
  query[:before] = query[:before].to_time.iso8601 if format_time?(query[:before])
  query[:after] = query[:after].to_time.iso8601 if format_time?(query[:after])

  client.request(:get, "users/#{user_id}/events", Event, query)
end