Module: Legion::Extensions::MicrosoftTeams::Runners::MeetingArtifacts

Extended by:
Definitions
Includes:
Helpers::Lex, Helpers::Client
Defined in:
lib/legion/extensions/microsoft_teams/runners/meeting_artifacts.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



13
14
15
# File 'lib/legion/extensions/microsoft_teams/runners/meeting_artifacts.rb', line 13

def self.trigger_words
  %w[recording recordings whiteboard artifact artifacts]
end

Instance Method Details

#get_meeting_artifact(meeting_id:, artifact_id:, user_id: 'me') ⇒ Object



69
70
71
72
73
74
# File 'lib/legion/extensions/microsoft_teams/runners/meeting_artifacts.rb', line 69

def get_meeting_artifact(meeting_id:, artifact_id:, user_id: 'me', **)
  response = graph_connection(**).get(
    "#{user_path(user_id)}/onlineMeetings/#{meeting_id}/artifacts/#{artifact_id}"
  )
  { result: response.body }
end

#list_meeting_artifacts(meeting_id:, user_id: 'me', top: 50, max_pages: 1) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/legion/extensions/microsoft_teams/runners/meeting_artifacts.rb', line 31

def list_meeting_artifacts(meeting_id:, user_id: 'me', top: 50, max_pages: 1, **)
  params = { '$top' => top }
  conn = graph_connection(**)
  response = conn.get("#{user_path(user_id)}/onlineMeetings/#{meeting_id}/artifacts", params)
  body = response.body

  return { result: body } if max_pages <= 1

  all_values = Array(body['value'] || body[:value])
  next_link = body['@odata.nextLink'] || body[:'@odata.nextLink']
  pages_fetched = 1

  while next_link && pages_fetched < max_pages
    response = conn.get(next_link)
    page_body = response.body
    items = page_body['value'] || page_body[:value]
    all_values.concat(Array(items)) if items
    next_link = page_body['@odata.nextLink'] || page_body[:'@odata.nextLink']
    pages_fetched += 1
  end

  result = { '@odata.context' => body['@odata.context'] || body[:'@odata.context'],
             'value'          => all_values }
  result['@odata.nextLink'] = next_link if next_link
  { result: result }
end