Class: GoToWebinar::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/go_to_webinar/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Session

Returns a new instance of Session.



5
6
7
# File 'lib/go_to_webinar/session.rb', line 5

def initialize(data)
  @data = data
end

Class Method Details

.allObject



59
60
61
# File 'lib/go_to_webinar/session.rb', line 59

def self.all
  make(GoToWebinar.client.get('/organizers/:organizer_key:/sessions'))
end

.find(webinar_key:, session_key:) ⇒ Object



50
51
52
53
# File 'lib/go_to_webinar/session.rb', line 50

def self.find(webinar_key:, session_key:)
  data = make(GoToWebinar.client.get("/organizers/:organizer_key:/webinars/#{webinar_key}/sessions/#{session_key}"))
  Session.new(data)
end

.for_webinar(webinar_key:) ⇒ Object



55
56
57
# File 'lib/go_to_webinar/session.rb', line 55

def self.for_webinar(webinar_key:)
  make(GoToWebinar.client.get("/organizers/:organizer_key:/webinars/#{webinar_key}/sessions"))
end

.make(data) ⇒ Object



63
64
65
# File 'lib/go_to_webinar/session.rb', line 63

def self.make(data)
  data.map { |registrant| Session.new(registrant) }
end

Instance Method Details

#attendeesObject

Get session attendees



46
47
48
# File 'lib/go_to_webinar/session.rb', line 46

def attendees
  Attendee.all_for_session(webinar_key: webinar_key, session_key: session_key)
end

#end_timeObject

endTime* string($date-time) The ending time of the webinar session



41
42
43
# File 'lib/go_to_webinar/session.rb', line 41

def end_time
  @data['endTime']&.to_datetime
end

#registrants_attendedObject

registrantsAttended* integer($int32) The number of registrants who attended the webinar session



17
18
19
# File 'lib/go_to_webinar/session.rb', line 17

def registrants_attended
  @data['registrantsAttended'].to_s
end

#session_keyObject

sessionKey* integer($int64) The unique key of the webinar session



35
36
37
# File 'lib/go_to_webinar/session.rb', line 35

def session_key
  @data['sessionKey'].to_s
end

#start_timeObject

startTime* string($date-time) The starting time of the webinar session



11
12
13
# File 'lib/go_to_webinar/session.rb', line 11

def start_time
  @data['startTime']&.to_datetime
end

#webinar_idObject

webinarID* string The 9-digit webinar ID



29
30
31
# File 'lib/go_to_webinar/session.rb', line 29

def webinar_id
  @data['webinarID'].to_s
end

#webinar_keyObject

webinarKey* integer($int64) The unique key of the webinar



23
24
25
# File 'lib/go_to_webinar/session.rb', line 23

def webinar_key
  @data['webinarKey'].to_s
end