Class: CanvasConnect::MeetingArchive

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas_connect/meeting_archive.rb

Constant Summary collapse

ATTRIBUTES =
[:name, :url_path, :date_begin, :date_end, :date_modified, :duration, :date_created]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(archive) ⇒ MeetingArchive

Public: Create a new MeetingArchive.

meeting_id - The id of the meeting on Adobe Connect (must already exist). client - A CanvasConnect::Service to make requests with. (default: CanvasConnect.client)



34
35
36
37
# File 'lib/canvas_connect/meeting_archive.rb', line 34

def initialize(archive)
  @attr_cache = {}
  @archive = archive
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/canvas_connect/meeting_archive.rb', line 43

def method_missing(meth, *args, &block)
  if ATTRIBUTES.include?(meth)
    @attr_cache[meth] ||= @archive.at_xpath("//#{meth.to_s.dasherize}").try(:text)
  else
    super
  end
end

Instance Attribute Details

#meeting_idObject

Returns the value of attribute meeting_id.



21
22
23
# File 'lib/canvas_connect/meeting_archive.rb', line 21

def meeting_id
  @meeting_id
end

Class Method Details

.retrieve(meeting_id, client = CanvasConnect.client) ⇒ Object



23
24
25
26
27
28
# File 'lib/canvas_connect/meeting_archive.rb', line 23

def self.retrieve(meeting_id, client = CanvasConnect.client)
  result = client.sco_contents(sco_id: meeting_id, filter_icon: 'archive')
  Array(result.at_xpath('results/scos').try(:children)).map do |archive|
    MeetingArchive.new(Nokogiri::XML(archive.to_xml))
  end
end

Instance Method Details

#idObject



39
40
41
# File 'lib/canvas_connect/meeting_archive.rb', line 39

def id
  @archive.attr('sco-id')
end