Skip to content

added report_getaudioreport #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Or install it yourself as:
- meeting/list
- meeting/update
- report/getaccountreport
- report/getaudioreport
- report/getuserreport
- report/getdailyreport
- webinar/create
Expand Down
7 changes: 7 additions & 0 deletions lib/zoomus/actions/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ def report_getaccountreport(*args)
Utils.parse_response self.class.post("/report/getaccountreport", :query => options)
end

def report_getaudioreport(*args)
options = Utils.extract_options!(args)
Utils.require_params([:from, :to], options)
Utils.process_datetime_params!([:from, :to], options)
Utils.parse_response self.class.post("/report/getaudioreport", :query => options)
end

def report_getuserreport(*args)
options = Utils.extract_options!(args)
Utils.require_params([:user_id, :from, :to], options)
Expand Down
22 changes: 22 additions & 0 deletions spec/fixtures/report_getaudioreport.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"from": "2016-01-08",
"to": "2016-01-21",
"page_count": 1,
"page_number": 1,
"page_size": 30,
"total_records": 1,
"telephony_usage": [
{
"meeting_id": 2932547621,
"phone_number": "+86 8208",
"type": "call-out",
"host_name": "test",
"host_email": "[email protected]",
"department": "",
"start_time": "2016-01-12T02:25:34Z",
"end_time": "2016-01-12T02:26:48Z",
"duration": 2,
"total": 0.12
}
]
}
58 changes: 58 additions & 0 deletions spec/lib/zoomus/actions/report/getaudioreport_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
require 'spec_helper'

describe Zoomus::Actions::Report do

before :all do
@zc = zoomus_client
@args = {:from => '2013-04-05T15:50:47Z',
:to => '2013-04-09T19:00:00Z'}
end

describe "#report_getaudioreport action" do
before :each do
stub_request(
:post,
zoomus_url("/report/getaudioreport")
).to_return(:body => json_response("report_getaudioreport"))
end

it "requires a 'from' argument" do
expect {
@zc.report_getaudioreport(filter_key(@args, :from))
}.to raise_error(ArgumentError)
end

it "requires a 'to' argument" do
expect {
@zc.report_getaudioreport(filter_key(@args, :to))
}.to raise_error(ArgumentError)
end

it "returns a hash" do
expect(@zc.report_getaudioreport(@args)).to be_kind_of(Hash)
end

it "returns 'total_records'" do
expect(@zc.report_getaudioreport(@args)["total_records"]).to eq(1)
end

it "returns 'telephony_usage' Array" do
expect(@zc.report_getaudioreport(@args)["telephony_usage"]).to be_kind_of(Array)
end
end

describe "#report_getaudioreport! action" do
before :each do
stub_request(
:post,
zoomus_url("/report/getaudioreport")
).to_return(:body => json_response("error"))
end

it "raises Zoomus::Error exception" do
expect {
@zc.report_getaudioreport!(@args)
}.to raise_error(Zoomus::Error)
end
end
end