Module: Legion::Extensions::MicrosoftTeams::Runners::People

Includes:
Helpers::Lex, Helpers::Client
Included in:
Client
Defined in:
lib/legion/extensions/microsoft_teams/runners/people.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Client

#bot_connection, #graph_connection, #oauth_connection, #user_path

Class Method Details

.trigger_wordsObject



12
13
14
# File 'lib/legion/extensions/microsoft_teams/runners/people.rb', line 12

def self.trigger_words
  %w[profile people person colleague colleagues contact contacts]
end

Instance Method Details

#get_profile(user_id: 'me') ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/legion/extensions/microsoft_teams/runners/people.rb', line 24

def get_profile(user_id: 'me', **)
  log.debug("People#get_profile user_id=#{user_id}")
  response = graph_connection(**).get(user_path(user_id).to_s)
  { result: response.body }
rescue StandardError => e
  handle_exception(e, level: :error, operation: 'People#get_profile', user_id: user_id)
  { error: e.message }
end

#list_people(user_id: 'me', top: 25) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/legion/extensions/microsoft_teams/runners/people.rb', line 41

def list_people(user_id: 'me', top: 25, **)
  log.debug("People#list_people user_id=#{user_id} top=#{top}")
  params = { '$top' => top }
  response = graph_connection(**).get("#{user_path(user_id)}/people", params)
  { result: response.body }
rescue StandardError => e
  handle_exception(e, level: :error, operation: 'People#list_people', user_id: user_id)
  { error: e.message }
end