clickmeetings 0.1.3.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/run-tests.yml +26 -0
- data/.gitignore +1 -0
- data/README.md +305 -7
- data/clickmeetings.gemspec +24 -19
- data/lib/clickmeetings/client.rb +8 -9
- data/lib/clickmeetings/config.rb +2 -1
- data/lib/clickmeetings/engine.rb +0 -1
- data/lib/clickmeetings/model.rb +36 -22
- data/lib/clickmeetings/models/open/chat.rb +19 -0
- data/lib/clickmeetings/models/open/concerns/with_conference.rb +35 -0
- data/lib/clickmeetings/models/open/concerns/with_locale.rb +20 -0
- data/lib/clickmeetings/models/open/conference.rb +72 -0
- data/lib/clickmeetings/models/open/contact.rb +14 -0
- data/lib/clickmeetings/models/open/file_library.rb +43 -0
- data/lib/clickmeetings/models/open/invitation.rb +30 -0
- data/lib/clickmeetings/models/open/login_hash.rb +50 -0
- data/lib/clickmeetings/models/open/model.rb +38 -0
- data/lib/clickmeetings/models/open/phone_gateway.rb +9 -0
- data/lib/clickmeetings/models/open/recording.rb +22 -0
- data/lib/clickmeetings/models/open/registration.rb +20 -0
- data/lib/clickmeetings/models/open/session.rb +56 -0
- data/lib/clickmeetings/models/open/time_zone.rb +15 -0
- data/lib/clickmeetings/models/open/token.rb +35 -0
- data/lib/clickmeetings/models/privatelabel/account.rb +3 -1
- data/lib/clickmeetings/models/privatelabel/conference.rb +20 -11
- data/lib/clickmeetings/models/privatelabel/model.rb +5 -4
- data/lib/clickmeetings/models/privatelabel/profile.rb +2 -2
- data/lib/clickmeetings/storage.rb +10 -0
- data/lib/clickmeetings/version.rb +1 -1
- data/lib/clickmeetings.rb +6 -8
- data/spec/clickmeetings_spec.rb +46 -0
- data/spec/client_spec.rb +26 -4
- data/spec/fixtures/delete_conferences_1_recordings.json +3 -0
- data/spec/fixtures/get_chats_1.zip +0 -0
- data/spec/fixtures/get_conferences.json +48 -0
- data/spec/fixtures/get_conferences_1.json +45 -0
- data/spec/fixtures/get_conferences_1_recordings.json +10 -0
- data/spec/fixtures/get_conferences_1_registrations.json +42 -0
- data/spec/fixtures/get_conferences_1_sessions.json +16 -0
- data/spec/fixtures/get_conferences_1_sessions_1.json +54 -0
- data/spec/fixtures/get_conferences_1_sessions_1_attendees.json +38 -0
- data/spec/fixtures/get_conferences_1_sessions_1_generate-pdf_en.json +4 -0
- data/spec/fixtures/get_conferences_1_sessions_1_generate-pdf_pl.json +5 -0
- data/spec/fixtures/get_conferences_1_sessions_1_generate-pdf_ru.json +4 -0
- data/spec/fixtures/get_conferences_1_sessions_1_registrations.json +42 -0
- data/spec/fixtures/get_conferences_1_tokens.json +254 -0
- data/spec/fixtures/get_conferences_2.json +45 -0
- data/spec/fixtures/get_conferences_active.json +1 -0
- data/spec/fixtures/get_conferences_inactive.json +1 -0
- data/spec/fixtures/get_conferences_skins.json +57 -0
- data/spec/fixtures/get_file-library_conferences_1.json +13 -0
- data/spec/fixtures/get_time_zone_list.json +422 -0
- data/spec/fixtures/get_time_zone_list_ru.json +26 -0
- data/spec/fixtures/post_conferences_1_invitation_email_en.json +1 -0
- data/spec/fixtures/post_conferences_1_invitation_email_ru.json +1 -0
- data/spec/fixtures/post_conferences_1_registration.json +6 -0
- data/spec/fixtures/post_conferences_1_room_autologin_hash.json +3 -0
- data/spec/fixtures/post_conferences_1_tokens.json +14 -0
- data/spec/fixtures/post_conferences_2_invitation_email_en.json +1 -0
- data/spec/fixtures/post_contacts.json +3 -0
- data/spec/fixtures/post_file-library.json +10 -0
- data/spec/fixtures/presentation.pdf +0 -0
- data/spec/helpers/fixtures_helpers.rb +1 -1
- data/spec/models/open/chat_spec.rb +25 -0
- data/spec/models/open/concerns/with_conference_spec.rb +55 -0
- data/spec/models/open/concerns/with_locale_spec.rb +23 -0
- data/spec/models/open/conference_spec.rb +132 -0
- data/spec/models/open/contact_spec.rb +17 -0
- data/spec/models/open/file_spec.rb +46 -0
- data/spec/models/open/invitation_spec.rb +43 -0
- data/spec/models/open/login_hash_spec.rb +59 -0
- data/spec/models/open/model_spec.rb +55 -0
- data/spec/models/open/recording_spec.rb +21 -0
- data/spec/models/open/registration_spec.rb +25 -0
- data/spec/models/open/session_spec.rb +73 -0
- data/spec/models/open/time_zone_spec.rb +27 -0
- data/spec/models/open/token_spec.rb +54 -0
- data/spec/models/privatelabel/conference_spec.rb +25 -7
- data/spec/shared_examples/tokens_examples.rb +6 -0
- data/spec/spec_helper.rb +7 -0
- metadata +187 -49
- data/.travis.yml +0 -5
- data/lib/clickmeetings/models/open_api/.keep +0 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe 'WithLocale' do
|
4
|
+
before(:all) do
|
5
|
+
class TestClassWithLocale < Clickmeetings::Open::Model
|
6
|
+
include Clickmeetings::Open::WithLocale
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:described_class) { TestClassWithLocale }
|
11
|
+
|
12
|
+
describe '::with_locale' do
|
13
|
+
subject { described_class.with_locale("ru") { described_class.locale } }
|
14
|
+
|
15
|
+
it "uses specified locale in block" do
|
16
|
+
expect(subject).to eq("ru")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "uses default locale out of block" do
|
20
|
+
expect(described_class.locale).to eq(:en)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Conference do
|
4
|
+
describe '::all' do
|
5
|
+
subject { described_class.all }
|
6
|
+
|
7
|
+
before do
|
8
|
+
mock_api(:get, 'conferences/active', open: true)
|
9
|
+
mock_api(:get, 'conferences/inactive', open: true)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "responds with array of conferences", :aggregate_failures do
|
13
|
+
expect(subject).to be_an_instance_of(Array)
|
14
|
+
expect(subject.first).to be_an_instance_of(described_class)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
%w(active inactive).each do |m|
|
19
|
+
describe "::#{m}" do
|
20
|
+
subject { described_class.send m }
|
21
|
+
|
22
|
+
before { mock_api(:get, "conferences/#{m}", open: true) }
|
23
|
+
|
24
|
+
it "responds with array of conferences", :aggregate_failures do
|
25
|
+
expect(subject).to be_an_instance_of(Array)
|
26
|
+
expect(subject.first).to be_an_instance_of(described_class)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '::skins' do
|
32
|
+
before { mock_api(:get, 'conferences/skins', open: true) }
|
33
|
+
|
34
|
+
subject { described_class.skins }
|
35
|
+
|
36
|
+
it "responds with array of hashes", :aggregate_failures do
|
37
|
+
expect(subject).to be_an_instance_of(Array)
|
38
|
+
expect(subject.first).to be_an_instance_of(Hash)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#tokens' do
|
43
|
+
before { mock_api(:get, 'conferences/1/tokens', open: true) }
|
44
|
+
|
45
|
+
subject { described_class.new(id: 1).tokens }
|
46
|
+
|
47
|
+
it_behaves_like 'tokens list'
|
48
|
+
end
|
49
|
+
|
50
|
+
%w(sessions registrations recordings).each do |m|
|
51
|
+
context "##{m}" do
|
52
|
+
before { mock_api :get, "conferences/1/#{m}", open: true }
|
53
|
+
|
54
|
+
subject { described_class.new(id: 1).send m }
|
55
|
+
|
56
|
+
it "responds with an array of #{m}" do
|
57
|
+
klass = "Clickmeetings::Open::#{m.singularize.capitalize}".constantize
|
58
|
+
expect(subject).to be_an_instance_of(Array)
|
59
|
+
expect(subject.first).to be_an_instance_of(klass)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "response has conference_id" do
|
63
|
+
expect(subject.first.conference_id).to eq(1)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'files' do
|
69
|
+
before { mock_api :get, "file-library/conferences/1", open: true }
|
70
|
+
|
71
|
+
subject { described_class.new(id: 1).files }
|
72
|
+
|
73
|
+
it "responds with an array of files" do
|
74
|
+
expect(subject).to be_an_instance_of(Array)
|
75
|
+
expect(subject.first).to be_an_instance_of Clickmeetings::Open::FileLibrary
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#create_tokens' do
|
80
|
+
before { mock_api(:post, 'conferences/1/tokens', open: true) }
|
81
|
+
|
82
|
+
subject { described_class.new(id: 1).create_tokens 2 }
|
83
|
+
|
84
|
+
it_behaves_like 'tokens list'
|
85
|
+
|
86
|
+
it "response has conference_id" do
|
87
|
+
expect(subject.first.conference_id).to eq(1)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#create_hash' do
|
92
|
+
before do
|
93
|
+
mock_api :get, 'conferences/1', open: true
|
94
|
+
mock_api :post, 'conferences/1/room/autologin_hash', open: true
|
95
|
+
end
|
96
|
+
|
97
|
+
subject do
|
98
|
+
described_class.new(id: 1).create_hash(
|
99
|
+
nickname: 'qwe',
|
100
|
+
email: 'qwe',
|
101
|
+
role: 'listener',
|
102
|
+
token: 'qweqwe'
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "responds with LoginHash object" do
|
107
|
+
expect(subject).to be_an_instance_of(Clickmeetings::Open::LoginHash)
|
108
|
+
expect(subject.conference_id).to eq(1)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe '#send_invites' do
|
113
|
+
before { mock_api(:post, 'conferences/1/invitation/email/en', open: true) }
|
114
|
+
subject { described_class.new(id: 1).send_invites(attendees: [{email: "q@q.qq"}], role: "listener") }
|
115
|
+
|
116
|
+
it "responds with Invitation object" do
|
117
|
+
expect(subject).to be_an_instance_of(Clickmeetings::Open::Invitation)
|
118
|
+
expect(subject.conference_id).to eq 1
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe '#register' do
|
123
|
+
before { mock_api :post, "conferences/1/registration", open: true }
|
124
|
+
|
125
|
+
let(:params) { {registration: {1 => "qwer", 2 => 'qwer', 3 => 'qwer@qwer.qw'}} }
|
126
|
+
subject { described_class.new(id: 1).register(params) }
|
127
|
+
|
128
|
+
it "responds with hash" do
|
129
|
+
expect(subject).to be_an_instance_of(Hash)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Contact do
|
4
|
+
describe '::create' do
|
5
|
+
before { mock_api :post, 'contacts', open: true }
|
6
|
+
|
7
|
+
let(:params) { {email: "q@q.qq", firstname: 'q', lastname: 'Q'} }
|
8
|
+
subject { described_class.create(params) }
|
9
|
+
|
10
|
+
it "responds with a Contact object", :aggregate_failures do
|
11
|
+
expect(subject).to be_an_instance_of(described_class)
|
12
|
+
expect(subject.email).to eq('q@q.qq')
|
13
|
+
expect(subject.firstname).to eq('q')
|
14
|
+
expect(subject.lastname).to eq('Q')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::FileLibrary do
|
4
|
+
describe '::create' do
|
5
|
+
before { mock_api :post, 'file-library', open: true }
|
6
|
+
|
7
|
+
subject { described_class.create(path: 'spec/fixtures/presentation.pdf') }
|
8
|
+
|
9
|
+
it "responds with FileLibrary object" do
|
10
|
+
expect(subject).to be_an_instance_of(described_class)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '::for_conference' do
|
15
|
+
before { mock_api :get, 'file-library/conferences/1', open: true }
|
16
|
+
|
17
|
+
subject { described_class.for_conference(conference_id: 1) }
|
18
|
+
|
19
|
+
it "responds with an array of files" do
|
20
|
+
expect(subject).to be_an_instance_of(Array)
|
21
|
+
expect(subject.first).to be_an_instance_of(described_class)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#download' do
|
26
|
+
before do
|
27
|
+
stub_request(:get, 'https://api.clickmeeting.com/v1/file-library/1/download')
|
28
|
+
.to_return(status: 200,
|
29
|
+
body: File.read('spec/fixtures/presentation.pdf'),
|
30
|
+
headers: {
|
31
|
+
"Content-Type"=>"application/octet-stream",
|
32
|
+
"Content-Length"=>"357552",
|
33
|
+
"Connection"=>"close",
|
34
|
+
"Pragma"=>"public",
|
35
|
+
"Content-Disposition"=>"attachment; filename=\"pdf.pdf\"",
|
36
|
+
"Content-Transfer-Encoding"=>"binary"
|
37
|
+
})
|
38
|
+
end
|
39
|
+
|
40
|
+
subject { described_class.new(id: 1).download }
|
41
|
+
|
42
|
+
it "responds with file content" do
|
43
|
+
expect(subject).to eq File.read('spec/fixtures/presentation.pdf')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Invitation do
|
4
|
+
describe '::send_emails' do
|
5
|
+
let(:params) { {attendees: [{email: "qwer@qwer.qw"}], role: "listener"} }
|
6
|
+
let(:additional_params) { {} }
|
7
|
+
subject do
|
8
|
+
described_class.by_conference(conference_id: 1).send_emails(params.merge additional_params)
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'without additional params' do
|
12
|
+
before { mock_api(:post, 'conferences/1/invitation/email/en', open: true) }
|
13
|
+
|
14
|
+
it "returns Invitation", :aggregate_failures do
|
15
|
+
expect(subject).to be_an_instance_of(described_class)
|
16
|
+
expect(subject.attendees).to be_an_instance_of(Array)
|
17
|
+
expect(subject.attendees.first).to be_an_instance_of(Hash)
|
18
|
+
expect(subject.attendees.first[:email]).to eq("qwer@qwer.qw")
|
19
|
+
expect(subject.role).to eq("listener")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when params include lang' do
|
24
|
+
let(:additional_params) { {lang: :ru} }
|
25
|
+
|
26
|
+
before { mock_api(:post, 'conferences/1/invitation/email/ru', open: true) }
|
27
|
+
|
28
|
+
it "uses lang from params" do
|
29
|
+
expect(subject).to be_an_instance_of(described_class)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when params include conference_id' do
|
34
|
+
let(:additional_params) { {conference_id: 2} }
|
35
|
+
|
36
|
+
before { mock_api(:post, 'conferences/2/invitation/email/en', open: true) }
|
37
|
+
|
38
|
+
it "uses conference_id from params" do
|
39
|
+
expect(subject).to be_an_instance_of(described_class)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::LoginHash do
|
4
|
+
describe '::create' do
|
5
|
+
let(:params) do
|
6
|
+
{
|
7
|
+
conference_id: 1, nickname: 'makar', email: 'qwer@qwer.qw',
|
8
|
+
token: Clickmeetings::Open::Token.new(token: "QWEQWE"),
|
9
|
+
role: 'listener'
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
before do
|
14
|
+
mock_api(:get, 'conferences/1', open: true)
|
15
|
+
mock_api(:post, 'conferences/1/room/autologin_hash', open: true)
|
16
|
+
end
|
17
|
+
|
18
|
+
subject { described_class.create(params) }
|
19
|
+
|
20
|
+
it "responds with LoginHash object", :aggregate_failures do
|
21
|
+
expect(subject).to be_an_instance_of(described_class)
|
22
|
+
expect(subject.conference_id).to eq(1)
|
23
|
+
expect(subject.nickname).to eq('makar')
|
24
|
+
expect(subject.email).to eq('qwer@qwer.qw')
|
25
|
+
expect(subject.role).to eq('listener')
|
26
|
+
expect(subject.token).to eq("QWEQWE")
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'validation' do
|
30
|
+
%i(conference_id nickname email role token).each do |opt_name|
|
31
|
+
context opt_name.to_s do
|
32
|
+
let(:bad_params) do
|
33
|
+
p = params
|
34
|
+
p[opt_name] = nil
|
35
|
+
p
|
36
|
+
end
|
37
|
+
|
38
|
+
subject { described_class.create(bad_params) }
|
39
|
+
|
40
|
+
specify { expect { subject }.to raise_error(described_class::InvalidParamsError) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'password' do
|
45
|
+
before do
|
46
|
+
mock_api(:get, 'conferences/2', open: true)
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:bad_params) do
|
50
|
+
{ conference_id: 2, nickname: 'makar', email: 'qwe@qwe.qw', role: 'listener' }
|
51
|
+
end
|
52
|
+
|
53
|
+
subject { described_class.create(bad_params) }
|
54
|
+
|
55
|
+
specify { expect { subject }.to raise_error(described_class::InvalidParamsError) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Model do
|
4
|
+
describe '#default_headers' do
|
5
|
+
subject { described_class.default_headers["X-Api-Key"] }
|
6
|
+
|
7
|
+
it "uses default account_api_key" do
|
8
|
+
expect(subject).to eq Clickmeetings.config.api_key
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '::with_account' do
|
13
|
+
context 'when use without block' do
|
14
|
+
before { described_class.with_account account_api_key: "some_else_key" }
|
15
|
+
after(:all) { described_class.with_account account_api_key: nil }
|
16
|
+
|
17
|
+
subject { described_class.default_headers["X-Api-Key"] }
|
18
|
+
|
19
|
+
it "uses specified key" do
|
20
|
+
expect(subject).to eq "some_else_key"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when use with block' do
|
25
|
+
subject do
|
26
|
+
subj = described_class.with_account account_api_key: "anykey" do
|
27
|
+
described_class.default_headers
|
28
|
+
end
|
29
|
+
subj["X-Api-Key"]
|
30
|
+
end
|
31
|
+
|
32
|
+
it "uses specified key in block" do
|
33
|
+
expect(subject).to eq "anykey"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "uses default key out of block" do
|
37
|
+
expect(described_class.default_headers["X-Api-Key"]).to eq Clickmeetings.config.api_key
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '::ping' do
|
43
|
+
before do
|
44
|
+
stub_request(:get, "#{Clickmeetings.config.host}/ping")
|
45
|
+
.to_return(status: 200, body: "{\"ping\":\"pong\"}")
|
46
|
+
end
|
47
|
+
|
48
|
+
subject { described_class.ping }
|
49
|
+
|
50
|
+
it "responds with {\"ping\":\"pong\"}", :aggregate_failures do
|
51
|
+
expect(subject).to be_instance_of Hash
|
52
|
+
expect(subject).to eq({"ping" => "pong"})
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Recording do
|
4
|
+
describe '::destroy_all' do
|
5
|
+
before do
|
6
|
+
mock_api :get, 'conferences/1/recordings', open: true
|
7
|
+
mock_api :delete, 'conferences/1/recordings', open: true
|
8
|
+
end
|
9
|
+
|
10
|
+
subject { described_class.by_conference(conference_id: 1).destroy_all }
|
11
|
+
|
12
|
+
it "responds with array of recordings" do
|
13
|
+
expect(subject).to be_an_instance_of(Array)
|
14
|
+
expect(subject.first).to be_an_instance_of(described_class)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "response has conference_id" do
|
18
|
+
expect(subject.first.conference_id).to eq 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Registration do
|
4
|
+
describe '::for_session' do
|
5
|
+
before { mock_api :get, 'conferences/1/sessions/1/registrations', open: true }
|
6
|
+
|
7
|
+
subject { described_class.by_conference(conference_id: 1).for_session(session_id: 1) }
|
8
|
+
|
9
|
+
it "responds with an array of registrations" do
|
10
|
+
expect(subject).to be_an_instance_of(Array)
|
11
|
+
expect(subject.first).to be_an_instance_of(described_class)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '::create' do
|
16
|
+
before { mock_api :post, "conferences/1/registration", open: true }
|
17
|
+
|
18
|
+
let(:params) { {registration: {1 => "qwer", 2 => 'qwer', 3 => 'qwer@qwer.qw'}} }
|
19
|
+
subject { described_class.by_conference(conference_id: 1).create(params) }
|
20
|
+
|
21
|
+
it "responds with hash" do
|
22
|
+
expect(subject).to be_an_instance_of(Hash)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Session do
|
4
|
+
describe '::find' do
|
5
|
+
before { mock_api :get, 'conferences/1/sessions/1', open: true }
|
6
|
+
|
7
|
+
subject { described_class.by_conference(conference_id: 1).find(1) }
|
8
|
+
|
9
|
+
it "sets an id" do
|
10
|
+
expect(subject.id).to eq 1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#attendees' do
|
15
|
+
before { mock_api :get, 'conferences/1/sessions/1/attendees', open: true }
|
16
|
+
|
17
|
+
subject { described_class.by_conference(conference_id: 1).new(id: 1).attendees }
|
18
|
+
|
19
|
+
it "responds with hashes", :aggregate_failures do
|
20
|
+
expect(subject).to be_an_instance_of(Array)
|
21
|
+
expect(subject.first).to be_an_instance_of(Hash)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#generate_pdf' do
|
26
|
+
before { mock_api :get, 'conferences/1/sessions/1/generate-pdf/en', open: true }
|
27
|
+
|
28
|
+
subject { described_class.by_conference(conference_id: 1).new(id: 1).generate_pdf }
|
29
|
+
|
30
|
+
it "responds with a hash", :aggregate_failures do
|
31
|
+
expect(subject).to be_an_instance_of(Hash)
|
32
|
+
expect(subject.keys).to include("status")
|
33
|
+
expect(subject.keys).to include("progress")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#get_report' do
|
38
|
+
context 'when \'in progress\'' do
|
39
|
+
before { mock_api :get, 'conferences/1/sessions/1/generate-pdf/ru', open: true }
|
40
|
+
|
41
|
+
subject { described_class.by_conference(conference_id: 1).new(id: 1).get_report :ru }
|
42
|
+
|
43
|
+
it "responds with nil" do
|
44
|
+
expect(subject).to be_nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when \'finished\'' do
|
49
|
+
before { mock_api :get, 'conferences/1/sessions/1/generate-pdf/pl', open: true }
|
50
|
+
|
51
|
+
subject { described_class.by_conference(conference_id: 1).new(id: 1).get_report :pl }
|
52
|
+
|
53
|
+
it 'responds with url' do
|
54
|
+
expect(subject).to eq("http://api.anysecond.com/panel/pdf/ru/5342110/VAqcdc")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'registrations' do
|
60
|
+
before { mock_api :get, 'conferences/1/sessions/1/registrations', open: true }
|
61
|
+
|
62
|
+
subject { described_class.by_conference(conference_id: 1).new(id: 1).registrations }
|
63
|
+
|
64
|
+
it 'responds with an array of Registration objects' do
|
65
|
+
expect(subject).to be_an_instance_of(Array)
|
66
|
+
expect(subject.first).to be_an_instance_of(Clickmeetings::Open::Registration)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'respond contains conference_id' do
|
70
|
+
expect(subject.first.conference_id).to eq(1)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::TimeZone do
|
4
|
+
describe '::all' do
|
5
|
+
context 'without params' do
|
6
|
+
before { mock_api :get, 'time_zone_list/', open: true }
|
7
|
+
|
8
|
+
subject { described_class.all }
|
9
|
+
|
10
|
+
it "responds with an array" do
|
11
|
+
expect(subject).to be_an_instance_of(Array)
|
12
|
+
expect(subject.count).to eq(420)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with params' do
|
17
|
+
before { mock_api :get, 'time_zone_list/ru', open: true }
|
18
|
+
|
19
|
+
subject { described_class.all country: :ru }
|
20
|
+
|
21
|
+
it "responds with an array" do
|
22
|
+
expect(subject).to be_an_instance_of(Array)
|
23
|
+
expect(subject.count).to eq(24)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clickmeetings::Open::Token do
|
4
|
+
context 'without conference' do
|
5
|
+
%w(all create).each do |m|
|
6
|
+
describe "::#{m}" do
|
7
|
+
subject { described_class.send m }
|
8
|
+
|
9
|
+
specify { expect { subject }.to raise_error(Clickmeetings::Open::Token::NoConferenceError) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'with conference' do
|
15
|
+
before { described_class.by_conference(conference_id: 1) }
|
16
|
+
|
17
|
+
describe '::all' do
|
18
|
+
before { mock_api :get, 'conferences/1/tokens', open: true }
|
19
|
+
|
20
|
+
subject { described_class.all }
|
21
|
+
|
22
|
+
it_behaves_like 'tokens list'
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '::create' do
|
26
|
+
before { mock_api :post, 'conferences/1/tokens', open: true }
|
27
|
+
|
28
|
+
subject { described_class.create how_many: 2 }
|
29
|
+
|
30
|
+
it_behaves_like 'tokens list'
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#create_hash' do
|
34
|
+
before do
|
35
|
+
mock_api :get, 'conferences/1', open: true
|
36
|
+
mock_api :post, 'conferences/1/room/autologin_hash', open: true
|
37
|
+
end
|
38
|
+
|
39
|
+
subject do
|
40
|
+
described_class.new(token: 'qweqwe').create_hash(
|
41
|
+
nickname: 'makar',
|
42
|
+
email: 'qweqew@qweqew.com',
|
43
|
+
role: 'listener'
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'responds with LoginHash object' do
|
48
|
+
expect(subject).to be_an_instance_of(Clickmeetings::Open::LoginHash)
|
49
|
+
expect(subject.conference_id).to eq(1)
|
50
|
+
expect(subject.token).to eq 'qweqwe'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -2,17 +2,35 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Clickmeetings::PrivateLabel::Conference do
|
4
4
|
context '::by_account' do
|
5
|
-
|
6
|
-
|
5
|
+
context "without block" do
|
6
|
+
before { described_class.by_account(account_id: 1) }
|
7
|
+
after(:all) { described_class.by_account(account_id: nil) }
|
7
8
|
|
8
|
-
|
9
|
+
subject { described_class.account_id }
|
9
10
|
|
10
|
-
|
11
|
+
specify { expect(subject).to eq 1 }
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
context "gives account_id to objects" do
|
14
|
+
subject { described_class.new.account_id }
|
14
15
|
|
15
|
-
|
16
|
+
specify { expect(subject).to eq 1 }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with block' do
|
21
|
+
subject do
|
22
|
+
described_class.by_account account_id: 1 do
|
23
|
+
described_class.account_id
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "uses specified account_id in block" do
|
28
|
+
expect(subject).to eq 1
|
29
|
+
end
|
30
|
+
|
31
|
+
it "hasn't account_id out of block" do
|
32
|
+
expect(described_class.account_id).to be_nil
|
33
|
+
end
|
16
34
|
end
|
17
35
|
end
|
18
36
|
|