clickmeetings 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clickmeetings.rb +7 -2
- data/lib/clickmeetings/model.rb +3 -12
- data/lib/clickmeetings/models/privatelabel/account.rb +1 -4
- data/lib/clickmeetings/models/privatelabel/conference.rb +1 -4
- data/lib/clickmeetings/models/privatelabel/model.rb +14 -0
- data/lib/clickmeetings/models/privatelabel/profile.rb +1 -4
- data/lib/clickmeetings/version.rb +1 -1
- data/spec/helpers/webmock_helpers.rb +3 -2
- data/spec/model_spec.rb +5 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 691edaedf8001434781df6680946dff8e5b3ae2c
|
4
|
+
data.tar.gz: 5a6398fd604bacc615ce07e78190199366111f2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e30ce8e040f11f47ff29a478eb1c98d7dce0aa41eed160ec82a27f1ae78bd8a1696e1e05e34b8425bea311d0f57660eaa3c12c30586712aaf3fdb60243c10ee
|
7
|
+
data.tar.gz: f8004f0f9a24dc12761d4d67f2d668757a84bbac1b139afd49731b28bafbefc5b058b90baa3339fdd5a90bfb6ba8fa196a2f38900c6fe138881400104ab66b0b
|
data/lib/clickmeetings.rb
CHANGED
@@ -4,6 +4,13 @@ require 'clickmeetings/client'
|
|
4
4
|
require 'clickmeetings/model'
|
5
5
|
require 'clickmeetings/exceptions'
|
6
6
|
|
7
|
+
require 'clickmeetings/models/privatelabel/model'
|
8
|
+
require 'clickmeetings/models/privatelabel/account'
|
9
|
+
require 'clickmeetings/models/privatelabel/conference'
|
10
|
+
require 'clickmeetings/models/privatelabel/profile'
|
11
|
+
|
12
|
+
Gem.find_files('clickmeetings/models/open_api/*.rb').each { |f| require f }
|
13
|
+
|
7
14
|
module Clickmeetings
|
8
15
|
def self.config
|
9
16
|
@config ||= Config.new
|
@@ -41,6 +48,4 @@ module Clickmeetings
|
|
41
48
|
end
|
42
49
|
|
43
50
|
require 'clickmeetings/engine' if defined?(Rails)
|
44
|
-
Gem.find_files('clickmeetings/models/open_api/*.rb').each { |f| require f }
|
45
|
-
Gem.find_files('clickmeetings/models/privatelabel/*.rb').each { |f| require f }
|
46
51
|
end
|
data/lib/clickmeetings/model.rb
CHANGED
@@ -44,23 +44,16 @@ module Clickmeetings
|
|
44
44
|
@resource_name = name
|
45
45
|
end
|
46
46
|
|
47
|
-
def set_client_host(host = nil)
|
48
|
-
@client_host = host
|
49
|
-
end
|
50
|
-
|
51
|
-
def set_client_api_key(api_key = nil)
|
52
|
-
@client_api_key = api_key
|
53
|
-
end
|
54
|
-
|
55
47
|
def client_options
|
56
48
|
{
|
57
|
-
url:
|
58
|
-
api_key:
|
49
|
+
url: Clickmeetings.config.host,
|
50
|
+
api_key: Clickmeetings.config.api_key
|
59
51
|
}
|
60
52
|
end
|
61
53
|
end
|
62
54
|
|
63
55
|
delegate :resource_name, to: :class
|
56
|
+
delegate :client_options, to: :class
|
64
57
|
|
65
58
|
def client
|
66
59
|
Clickmeetings.client
|
@@ -110,8 +103,6 @@ module Clickmeetings
|
|
110
103
|
|
111
104
|
private
|
112
105
|
|
113
|
-
delegate :client_options, to: :class
|
114
|
-
|
115
106
|
def merge_attributes(attrs)
|
116
107
|
if attrs.is_a?(Array)
|
117
108
|
merge_collection(attrs)
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Clickmeetings
|
2
2
|
module PrivateLabel
|
3
|
-
class Account < ::Clickmeetings::Model
|
4
|
-
set_client_host Clickmeetings.config.privatelabel_host
|
5
|
-
set_client_api_key Clickmeetings.config.privatelabel_api_key
|
6
|
-
|
3
|
+
class Account < ::Clickmeetings::PrivateLabel::Model
|
7
4
|
attr_accessor :account_expiration_date,
|
8
5
|
:meetings_allowed,
|
9
6
|
:package,
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Clickmeetings
|
2
2
|
module PrivateLabel
|
3
|
-
class Conference <
|
4
|
-
set_client_host Clickmeetings.config.privatelabel_host
|
5
|
-
set_client_api_key Clickmeetings.config.privatelabel_api_key
|
6
|
-
|
3
|
+
class Conference < Model
|
7
4
|
attr_accessor :id, :room_type, :room_pin, :name, :name_url, :description,
|
8
5
|
:access_type, :lobby_description, :status, :created_at,
|
9
6
|
:updated_at, :permanent_room, :ccc, :starts_at, :ends_at,
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Clickmeetings
|
2
|
+
module PrivateLabel
|
3
|
+
class Model < ::Clickmeetings::Model
|
4
|
+
class << self
|
5
|
+
def client_options
|
6
|
+
{
|
7
|
+
url: Clickmeetings.config.privatelabel_host,
|
8
|
+
api_key: Clickmeetings.config.privatelabel_api_key
|
9
|
+
}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Clickmeetings
|
2
2
|
module PrivateLabel
|
3
|
-
class Profile <
|
4
|
-
set_client_host Clickmeetings.config.privatelabel_host
|
5
|
-
set_client_api_key Clickmeetings.config.privatelabel_api_key
|
6
|
-
|
3
|
+
class Profile < Model
|
7
4
|
attr_accessor :id, :account_manager_email, :email, :phone,
|
8
5
|
:account_manager_name, :account_manager_phone,
|
9
6
|
:name, :packages
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module ClickmeetingWebMock
|
2
|
-
def mock_api(verb = nil, action = nil, status = 200)
|
2
|
+
def mock_api(verb = nil, action = nil, status = 200, open: false)
|
3
|
+
host = open ? Clickmeetings.config.host : Clickmeetings.config.privatelabel_host
|
3
4
|
params = [
|
4
|
-
verb,
|
5
|
+
verb, host,
|
5
6
|
action, status
|
6
7
|
]
|
7
8
|
action_stub(*params) unless action.nil? || verb.nil?
|
data/spec/model_spec.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Clickmeetings::Model do
|
4
|
-
before(:each) do
|
5
|
-
described_class.set_client_host Clickmeetings.config.privatelabel_host
|
6
|
-
described_class.set_client_api_key Clickmeetings.config.privatelabel_api_key
|
7
|
-
end
|
8
|
-
|
9
4
|
context "class methods" do
|
10
5
|
context ".find" do
|
11
6
|
subject { described_class.find(1) }
|
12
|
-
before(:each) { mock_api(:get, "#{described_class.resource_name}/1") }
|
7
|
+
before(:each) { mock_api(:get, "#{described_class.resource_name}/1", open: true) }
|
13
8
|
|
14
9
|
it "returns Model object", :aggregate_failures do
|
15
10
|
expect(subject).to be_instance_of described_class
|
@@ -19,7 +14,7 @@ describe Clickmeetings::Model do
|
|
19
14
|
|
20
15
|
context ".all" do
|
21
16
|
subject { described_class.all }
|
22
|
-
before(:each) { mock_api(:get, described_class.resource_name) }
|
17
|
+
before(:each) { mock_api(:get, described_class.resource_name, open: true) }
|
23
18
|
|
24
19
|
it "returns array of model objects", :aggregate_failures do
|
25
20
|
expect(subject).to be_instance_of Array
|
@@ -46,7 +41,7 @@ describe Clickmeetings::Model do
|
|
46
41
|
|
47
42
|
context ".create" do
|
48
43
|
subject { described_class.create }
|
49
|
-
before(:each) { mock_api(:post, described_class.resource_name) }
|
44
|
+
before(:each) { mock_api(:post, described_class.resource_name, open: true) }
|
50
45
|
|
51
46
|
it "returns Model objects" do
|
52
47
|
expect(subject).to be_instance_of described_class
|
@@ -61,7 +56,7 @@ describe Clickmeetings::Model do
|
|
61
56
|
let(:object) { described_class.new(id: 1) }
|
62
57
|
subject { object.update(params) }
|
63
58
|
|
64
|
-
before(:each) { mock_api(:put, "#{described_class.resource_name}/#{object.id}") }
|
59
|
+
before(:each) { mock_api(:put, "#{described_class.resource_name}/#{object.id}", open: true) }
|
65
60
|
|
66
61
|
it "returns updated Mode object" do
|
67
62
|
expect(subject).to be_instance_of described_class
|
@@ -73,7 +68,7 @@ describe Clickmeetings::Model do
|
|
73
68
|
let(:object) { described_class.new(id: 1) }
|
74
69
|
subject { object.destroy }
|
75
70
|
|
76
|
-
before(:each) { mock_api(:delete, "#{described_class.resource_name}/#{object.id}") }
|
71
|
+
before(:each) { mock_api(:delete, "#{described_class.resource_name}/#{object.id}", open: true) }
|
77
72
|
|
78
73
|
it "returns destroyed object" do
|
79
74
|
expect(subject).to be_instance_of described_class
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clickmeetings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Alekseenko
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/clickmeetings/models/open_api/.keep
|
189
189
|
- lib/clickmeetings/models/privatelabel/account.rb
|
190
190
|
- lib/clickmeetings/models/privatelabel/conference.rb
|
191
|
+
- lib/clickmeetings/models/privatelabel/model.rb
|
191
192
|
- lib/clickmeetings/models/privatelabel/profile.rb
|
192
193
|
- lib/clickmeetings/version.rb
|
193
194
|
- spec/clickmeetings_spec.rb
|
@@ -233,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
234
|
version: '0'
|
234
235
|
requirements: []
|
235
236
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.5.1
|
237
238
|
signing_key:
|
238
239
|
specification_version: 4
|
239
240
|
summary: Simple REST API client for ClickMeetings Private Label API
|