Skip to content

Commit

Permalink
Add a past_webinars_participants action
Browse files Browse the repository at this point in the history
  • Loading branch information
nm committed May 10, 2024
1 parent 39cbdd8 commit e1afae4
Show file tree
Hide file tree
Showing 3 changed files with 65 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 @@ -91,6 +91,9 @@ module Webinar

get 'past_webinars_absentees', '/past_webinars/:webinar_uuid/absentees',
permit: %i[occurrence_id page_size next_page_token]

get 'past_webinars_participants', '/past_webinars/:webinar_id/participants',
permit: %i[page_size next_page_token]
end
end
end
20 changes: 20 additions & 0 deletions spec/fixtures/webinar/past_webinars_participants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"next_page_token": "Tva2CuIdTgsv8wAnhyAdU3m06Y2HuLQtlh3",
"page_count": 1,
"page_size": 30,
"participants": [
{
"id": "30R7kT7bTIKSNUFEuH_Qlg",
"name": "Jill Chill",
"user_id": "ABCDEF123456",
"registrant_id": "_f08HhPJS82MIVLuuFaJPg",
"user_email": "[email protected]",
"join_time": "2019-02-01T12:34:12.660Z",
"leave_time": "2019-02-01T12:54:12.660Z",
"duration": 20,
"failover": false,
"status": "in_meeting"
}
],
"total_records": 1
}
42 changes: 42 additions & 0 deletions spec/lib/zoom/actions/webinar/past_webinar_participants_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_id: '123456789' } }

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

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

it 'returns a webinar instance with participants as an array' do
expect(zc.past_webinars_participants(args)['participants']).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_id]}/participants")
).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_participants(args) }.to raise_error(Zoom::Error)
end
end
end
end

0 comments on commit e1afae4

Please sign in to comment.