Class: WebinarjamApi::Client

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

Constant Summary collapse

API_ENDPOINT =
"https://app.webinarjam.com/api/v2"

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



8
9
10
# File 'lib/webinarjam_api.rb', line 8

def initialize(api_key)
  @api_key = api_key
end

Instance Method Details

#get_webinar(webinar_id) ⇒ Object



17
18
19
20
# File 'lib/webinarjam_api.rb', line 17

def get_webinar(webinar_id)
  data = { api_key: @api_key, webinar_id: webinar_id }
  HTTParty.post("#{API_ENDPOINT}/webinar", body: data )
end

#get_webinarsObject



12
13
14
15
# File 'lib/webinarjam_api.rb', line 12

def get_webinars
  data = { api_key: @api_key }
  HTTParty.post("#{API_ENDPOINT}/webinars", body: data )
end

#register_person(webinar_id, schedule, lead) ⇒ Object



22
23
24
25
26
# File 'lib/webinarjam_api.rb', line 22

def register_person(webinar_id, schedule, lead)
  data      = { api_key: @api_key, webinar_id: webinar_id, schedule: schedule }
  lead_data = data.merge(lead)
  HTTParty.post("#{API_ENDPOINT}/register", body: lead_data )
end