Skip to content

Commit

Permalink
Past webinars absentees (#431)
Browse files Browse the repository at this point in the history
* add past webinars absentees endpoint

* added tests
  • Loading branch information
jbernardoviana authored Jul 26, 2022
1 parent 005c5f2 commit a93281a
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/zoom/actions/webinar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ module Webinar
get 'webinar_poll_get', '/webinars/:webinar_id/polls/:poll_id'

get 'webinar_panelist_list', '/webinars/:webinar_id/panelists'

get 'past_webinars_absentees', '/past_webinars/:webinar_uuid/absentees',
permit: %i[occurrence_id page_size next_page_token]
end
end
end
37 changes: 37 additions & 0 deletions spec/fixtures/webinar/past_webinars_absentees.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"next_page_token": "w7587w4eiyfsudgf",
"page_count": 1,
"page_number": 1,
"page_size": 30,
"total_records": 20,
"registrants": [
{
"id": "9tboDiHUQAeOnbmudzWa5g",
"address": "1800 Amphibious Blvd.",
"city": "Mountain View",
"comments": "Looking forward to the discussion.",
"country": "US",
"custom_questions": [
{
"title": "What do you hope to learn from this?",
"value": "Look forward to learning how you come up with new recipes and what other services you offer."
}
],
"email": "jchill@example.com",
"first_name": "Jill",
"industry": "Food",
"job_title": "Chef",
"last_name": "Chill",
"no_of_employees": "1-20",
"org": "Cooking Org",
"phone": "5550100",
"purchasing_time_frame": "1-3 months",
"role_in_purchase_process": "Influencer",
"state": "CA",
"status": "approved",
"zip": "94045",
"create_time": "2022-03-22T05:59:09Z",
"join_url": "https://example.com/j/11111"
}
]
}
42 changes: 42 additions & 0 deletions spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require 'spec_helper'

describe Zoom::Actions::Webinar do
let(:zc) { zoom_client }
let(:args) { { webinar_uuid: '123456789' } }

describe '#past_webinars_absentees' do
context 'with a valid response' do
before :each do
stub_request(
:get,
zoom_url("/past_webinars/#{args[:webinar_uuid]}/absentees")
).to_return(status: 200,
body: json_response('webinar', 'past_webinars_absentees'),
headers: { 'Content-Type' => 'application/json' })
end

it "requires a 'uuid' argument" do
expect { zc.past_webinars_absentees(filter_key(args, :webinar_uuid)) }.to raise_error(Zoom::ParameterMissing, [:webinar_uuid].to_s)
end

it 'returns a webinar instance with registrants as an array' do
expect(zc.past_webinars_absentees(args)['registrants']).to be_kind_of(Array)
end
end

context 'with a 4xx response' do
before :each do
stub_request(
:get,
zoom_url("/past_webinars/#{args[:webinar_uuid]}/absentees")
).to_return(status: 404,
body: json_response('error', 'validation'),
headers: { 'Content-Type' => 'application/json' })
end

it 'raises Zoom::Error exception' do
expect { zc.past_webinars_absentees(args) }.to raise_error(Zoom::Error)
end
end
end
end

0 comments on commit a93281a

Please sign in to comment.