Class: GoToWebinar::Webinar
- Inherits:
-
Object
- Object
- GoToWebinar::Webinar
- Defined in:
- lib/go_to_webinar/webinar.rb
Class Method Summary collapse
- .find(webinar_key:) ⇒ Object
-
.for_account(account_key:, from:, to:, page: nil, page_size: nil) ⇒ Object
Retrieves the list of webinars for an account within a given date range.
-
.for_organizer ⇒ Object
Returns webinars scheduled for the future for a specified organizer.
-
.historical(from: nil, to: nil) ⇒ Object
Returns details for completed webinars for the specified organizer and completed webinars of other organizers where the specified organizer is a co-organizer.
- .make(data) ⇒ Object
-
.upcoming ⇒ Object
Returns webinars scheduled for the future for the specified organizer and webinars of other organizers where the specified organizer is a co-organizer.
Instance Method Summary collapse
- #add_registrant(first_name:, last_name:, email:) ⇒ Object
- #get_session(session_key:) ⇒ Object
-
#initialize(data) ⇒ Webinar
constructor
A new instance of Webinar.
- #sessions ⇒ Object
- #webinar_key ⇒ Object
Constructor Details
#initialize(data) ⇒ Webinar
Returns a new instance of Webinar.
5 6 7 |
# File 'lib/go_to_webinar/webinar.rb', line 5 def initialize(data) @data = data end |
Class Method Details
.find(webinar_key:) ⇒ Object
28 29 30 31 |
# File 'lib/go_to_webinar/webinar.rb', line 28 def self.find(webinar_key:) data = GoToWebinar.client.get("/organizers/:organizer_key:/webinars/#{webinar_key}") Webinar.new(data) end |
.for_account(account_key:, from:, to:, page: nil, page_size: nil) ⇒ Object
Retrieves the list of webinars for an account within a given date range. Page and size parameters are optional. Default page is 0 and default size is 20.
36 37 38 39 40 41 42 43 |
# File 'lib/go_to_webinar/webinar.rb', line 36 def self.for_account(account_key:, from:, to:, page: nil, page_size: nil) = { fromTime: from, toTime: to } [:page] = page if page.present? [:size] = page_size if page_size.present? GoToWebinar.client.get("/accounts/#{account_key}/webinars", ) # TODO: montar retorno end |
.for_organizer ⇒ Object
Returns webinars scheduled for the future for a specified organizer.
54 55 56 |
# File 'lib/go_to_webinar/webinar.rb', line 54 def self.for_organizer make(GoToWebinar.client.get('/organizers/:organizer_key:/webinars')) end |
.historical(from: nil, to: nil) ⇒ Object
Returns details for completed webinars for the specified organizer and completed webinars of other organizers where the specified organizer is a co-organizer.
48 49 50 51 |
# File 'lib/go_to_webinar/webinar.rb', line 48 def self.historical(from: nil, to: nil) = { fromTime: from, toTime: to } make(GoToWebinar.client.get('/organizers/:organizer_key:/historicalWebinars', )) end |
.make(data) ⇒ Object
65 66 67 |
# File 'lib/go_to_webinar/webinar.rb', line 65 def self.make(data) data.map { |webinar| Webinar.new(webinar) } end |
.upcoming ⇒ Object
Returns webinars scheduled for the future for the specified organizer and webinars of other organizers where the specified organizer is a co-organizer.
61 62 63 |
# File 'lib/go_to_webinar/webinar.rb', line 61 def self.upcoming make(GoToWebinar.client.get('/organizers/:organizer_key:/upcomingWebinars')) end |
Instance Method Details
#add_registrant(first_name:, last_name:, email:) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/go_to_webinar/webinar.rb', line 13 def add_registrant(first_name:, last_name:, email:) Registrant.create( webinar_key: webinar_key, data: { firstName: first_name, lastName: last_name, email: email }.to_json ) end |
#get_session(session_key:) ⇒ Object
24 25 26 |
# File 'lib/go_to_webinar/webinar.rb', line 24 def get_session(session_key:) Session.find(webinar_key: webinar_key, session_key: session_key) end |
#sessions ⇒ Object
20 21 22 |
# File 'lib/go_to_webinar/webinar.rb', line 20 def sessions Session.for_webinar(webinar_key: webinar_key) end |
#webinar_key ⇒ Object
9 10 11 |
# File 'lib/go_to_webinar/webinar.rb', line 9 def webinar_key @data['webinarKey'].to_s end |