forked from mllocs/zoomus
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a past_webinars_participants action
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "jchill@example.com", | ||
"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
42
spec/lib/zoom/actions/webinar/past_webinar_participants_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |