clickmeetings 0.1.3.1 → 0.1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/README.md +303 -7
- data/clickmeetings.gemspec +5 -3
- data/lib/clickmeetings.rb +6 -8
- data/lib/clickmeetings/client.rb +7 -8
- data/lib/clickmeetings/config.rb +2 -1
- data/lib/clickmeetings/engine.rb +0 -1
- data/lib/clickmeetings/model.rb +29 -19
- 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/spec/clickmeetings_spec.rb +46 -0
- data/spec/client_spec.rb +27 -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 +147 -8
- data/lib/clickmeetings/models/open_api/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 336db3b3ca9ea2cbb9da2d2c0186523fe54ebf73
|
4
|
+
data.tar.gz: 6256f1f29ba1ebb4ce9d5a88b7aca192f67973ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1308dadd29880672728a60d859728cadf7470b5f0a352bd63176a8cb3f303bf344345a00709858117d06463b6b3297f01739150786c893adfcc76b99b9797b6f
|
7
|
+
data.tar.gz: df59f7fccd8a6b91254498185e7ae864a8b7d28b1ac92bc2104ea906444b4d36c7cd634c5469dcef91ba6f56676912ede0ac6423e3cacb3a8880389bcfffe9bb
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Clickmeetings
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple REST API client to interact with [Clickmeeting](https://clickmeeting.com) open and Privatelabel API.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,315 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
### Configuration
|
24
|
+
|
25
|
+
With Rails:
|
26
|
+
|
27
|
+
+ in `config/secrets.yml` add:
|
28
|
+
```yml
|
29
|
+
clickmeetings:
|
30
|
+
privatelabel_host: https://api.clickmeetings.com/privatelabel/v1 # or http://api.anysecond.com/privatelabel/v1
|
31
|
+
privatelabel_api_key: your_privatelabel_api_key
|
32
|
+
host: https://api.clickmeetings.com/v1 # or http://api.anysecond.com/v1
|
33
|
+
api_key: your_open_api_key
|
34
|
+
locale: es # default language (uses e.g. in invitations)
|
35
|
+
```
|
36
|
+
+ in `config/clickmeetings.yml`:
|
37
|
+
```yml
|
38
|
+
privatelabel_host: https://api.clickmeetings.com/privatelabel/v1 # or http://api.anysecond.com/privatelabel/v1
|
39
|
+
privatelabel_api_key: your_privatelabel_api_key
|
40
|
+
host: https://api.clickmeetings.com/v1 # or http://api.anysecond.com/v1
|
41
|
+
api_key: your_open_api_key
|
42
|
+
locale: es # default language (uses e.g. in invitations)
|
43
|
+
```
|
44
|
+
|
45
|
+
With or without Rails:
|
46
|
+
|
47
|
+
+ Use environment variables `CLICKMEETINGS_*` (e.g. `CLICKMEETINGS_PRIVATELABEL_HOST`).
|
48
|
+
+ Use `configure` method:
|
49
|
+
```ruby
|
50
|
+
Clickmeetings.configure do |config|
|
51
|
+
config.privatelabel_api_key = 'your_privatelabel_api_key'
|
52
|
+
# and another configs like above
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
### Usage
|
57
|
+
|
58
|
+
+ Privatelabel API
|
59
|
+
+ Your profile
|
60
|
+
```ruby
|
61
|
+
profile = Clickmeetings::PrivateLabel::Profile.get # => get your PrivateLabel profile details
|
62
|
+
```
|
63
|
+
+ Accounts
|
64
|
+
```ruby
|
65
|
+
account = Clickmeetings::PrivateLabel::Account.create(params)
|
66
|
+
# => Clickmeetings::PrivateLabel::Account object
|
67
|
+
# params is a Hash; see specification for params
|
68
|
+
# in your clickmeeting account
|
69
|
+
account = account.update username: "New account name"
|
70
|
+
# => updated Clickmeetings::PrivateLabel::Account object
|
71
|
+
# see specification to know what params you can provide
|
72
|
+
account = account.disable # sets account's status to 'disabled'
|
73
|
+
account = account.enable # sets account's status to 'active'
|
74
|
+
account.destroy # => deleted account
|
75
|
+
Clickmeetings::PrivateLabel::Account.all # => array of accounts
|
76
|
+
Clickmeetings::PrivateLabel::Account.find(1) # => account details with id = 1 or
|
77
|
+
# Clickmeetings::NotFoundError
|
78
|
+
```
|
79
|
+
+ Conferences
|
80
|
+
+ Specify an account
|
81
|
+
```ruby
|
82
|
+
Clickmeetings::PrivateLabel::Conference.account_id # => nil
|
83
|
+
Clickmeetings::PrivateLabel::Conference.by_account(account_id: 1)
|
84
|
+
# => Clickmeetings::PrivateLabel::Conference, so you can use #create,
|
85
|
+
# #update and #find in chain
|
86
|
+
Clickmeetings::PrivateLabel::Conference.account_id # => 1
|
87
|
+
```
|
88
|
+
or
|
89
|
+
```ruby
|
90
|
+
# Clickmeetings::PrivateLabel::Conference.account_id equals to nil
|
91
|
+
Clickmeetings::PrivateLabel::Conference.by_account(account_id: 1) do
|
92
|
+
# there Clickmeetings::PrivateLabel::Conference.account_id equals to 1
|
93
|
+
end
|
94
|
+
# and there Clickmeetings::PrivateLabel::Conference.account_id equals to nil
|
95
|
+
|
96
|
+
Clickmeetings::PrivateLabel::Conference.by_account(account_id: 1).new
|
97
|
+
# => #<Clickmeetings::PrivateLabel::Conference:0x... @account_id=1>
|
98
|
+
```
|
99
|
+
+ Do anything
|
100
|
+
```ruby
|
101
|
+
Clickmeetings::PrivateLabel::Conference.by_account(account_id: 1) do
|
102
|
+
# use Clickmeetings::PrivateLabel::Conference.create, .all and .find methods+
|
103
|
+
# to create conference, get list of conferences for account or get conference
|
104
|
+
# details
|
105
|
+
|
106
|
+
# and #update and #destroy instance methods to change or delete any conference
|
107
|
+
|
108
|
+
# params same as in Open API (see below)
|
109
|
+
end
|
110
|
+
```
|
111
|
+
+ [Open API](http://dev.clickmeeting.com/api-doc/)
|
112
|
+
|
113
|
+
Account is based on your config (from api key) or with every class you can use
|
114
|
+
```ruby
|
115
|
+
Clickmeetings::Open::Conference.with_account(account_api_key: 'another_account_api_key') do
|
116
|
+
# do anything in another account
|
117
|
+
end
|
118
|
+
```
|
119
|
+
+ Сonference
|
120
|
+
```ruby
|
121
|
+
Clickmeetings::Open::Conference.active # => list of active conferences
|
122
|
+
Clickmeetings::Open::Conference.inactive # => list of inactive conferences
|
123
|
+
# .all, .find, .create, #update, #destroy as usual
|
124
|
+
```
|
125
|
+
+ params for `.create` and `#update`
|
126
|
+
+ Required:
|
127
|
+
+ name (String): room name
|
128
|
+
+ room_type (String): 'webinar' or 'meeting'
|
129
|
+
+ permanent_room (Integer): 1 - room is permanent; 0 - has start time and duration
|
130
|
+
+ access_type (Integer): 1 - open, 2 - password (requires password in params), 3 - token
|
131
|
+
+ Optional
|
132
|
+
+ password (String): password for rooms with access_type 2
|
133
|
+
+ custom_room_url_name (String): room url will be `https://{account_name}.clickmeeting.com/{custom_room_url_name}`
|
134
|
+
+ lobby_description (String): Messagee in lobby
|
135
|
+
+ lobby_enabled (String): 1 - true, 0 - false
|
136
|
+
+ starts_at (iso8601 datetime): time conference starts at (if it is not permanent). Default is `now`
|
137
|
+
+ duration (String "h:mm"): duration of conference, between 0:05 and 3:00
|
138
|
+
+ timezone (String): Time zone of conference (e.g. “America/New_York”)
|
139
|
+
+ skin_id (integer): Skin identifier
|
140
|
+
+ registration (Hash):
|
141
|
+
+ enabled (Boolean)
|
142
|
+
+ template (Integer): registration template, between 1 and 3
|
143
|
+
+ status (String): "active" or "inactive"
|
144
|
+
+ settings (Hash): please, see on [Clickmeting API documentation](http://dev.clickmeeting.com/api-doc/#post_conferences) if need
|
145
|
+
+ Other helpful methods
|
146
|
+
```ruby
|
147
|
+
Clickmeetings::Open::Conference.skins # => array of available skins; each skin is a Hash
|
148
|
+
Clickmeetings::Open::Conference.find(1).create_tokens(10)
|
149
|
+
# creates tokens for confereces with access_type = 3;
|
150
|
+
# param specifies how many tokens will be created (default is 1)
|
151
|
+
|
152
|
+
Clickmeetings::Open::Conference.new(id: 1).send_invites(
|
153
|
+
attendees: [
|
154
|
+
{email: "first@teachbase.ru"},
|
155
|
+
{email: "second@teachbase.ru"}
|
156
|
+
]
|
157
|
+
role: "presenter",
|
158
|
+
template: "basic" # or "advanced"
|
159
|
+
)
|
160
|
+
# send invites to emails in attendees for specified role. Template means view of email
|
161
|
+
# .new(id: 1) specifies id of conference. Unlike .find(1) it doesn't request to clickmeetings
|
162
|
+
|
163
|
+
Clickmeetings::Open::Conference.new(id: 1).files # => files for conference
|
164
|
+
Clickmeetings::Open::Conference.new(id: 1).tokens # => tokens for conference (if access_type is 3)
|
165
|
+
Clickmeetings::Open::Conference.new(id: 1).sessions # => sessions for conference
|
166
|
+
Clickmeetings::Open::Conference.new(id: 1).registrations # => registrations for conference
|
167
|
+
Clickmeetings::Open::Conference.new(id: 1).recordings # => recordings for conference
|
168
|
+
|
169
|
+
Clickmeetings::Open::Conference.new(id: 1).register(
|
170
|
+
registration: {
|
171
|
+
1 => "firstname",
|
172
|
+
2 => "lastname",
|
173
|
+
3 => "email@teachbase.ru"
|
174
|
+
},
|
175
|
+
confirmation_email: { # optional
|
176
|
+
enabled: 1, # or 0
|
177
|
+
lang: "ru", # or something else
|
178
|
+
}
|
179
|
+
)
|
180
|
+
|
181
|
+
Clickmeetings::Open::Conference.find(1).create_hash(
|
182
|
+
nickname: "User#1",
|
183
|
+
role: "presenter",
|
184
|
+
email: "user1@teachbase.ru
|
185
|
+
# :password for conference with access_type 2
|
186
|
+
# :token for conference with access_type 3
|
187
|
+
)
|
188
|
+
# creates autologin hash for user, specified in params
|
189
|
+
```
|
190
|
+
For more information about autologin hashes see [docs](http://dev.clickmeeting.com/api-doc/#post_autologin_hash).
|
191
|
+
+ Session
|
192
|
+
```ruby
|
193
|
+
Clickmeetings::Open::Session.by_conference(conference_id: 1).all
|
194
|
+
# => sessions for conference with id 1
|
195
|
+
# now u can use
|
196
|
+
Clickmeetings::Open::Session.all
|
197
|
+
# => sessions for conference with id 1
|
198
|
+
Сlickmeetings::Open::Session.find(1)
|
199
|
+
# => session with id 1 in conference with id 1
|
200
|
+
```
|
201
|
+
or
|
202
|
+
```ruby
|
203
|
+
Clickmeetings::Open::Session.by_conference(conferecne_id: 1) do
|
204
|
+
Clickmeetings::Open::Session.all
|
205
|
+
# => sessions for conference with id 1
|
206
|
+
Сlickmeetings::Open::Session.find(1)
|
207
|
+
# => session with id 1 in conference with id 1
|
208
|
+
end
|
209
|
+
Clickmeetings::Open::Session.all
|
210
|
+
# => Clickmeetings::NotFoundError
|
211
|
+
```
|
212
|
+
You can use only `.all`, `.find` and one of methods below
|
213
|
+
+ `#attendees`
|
214
|
+
|
215
|
+
```ruby
|
216
|
+
Clickmeetings::Open::Session.by_conference(conferecne_id: 1) do
|
217
|
+
Сlickmeetings::Open::Session.find(1).attendees
|
218
|
+
# => array of attendees; each attendee is a hash
|
219
|
+
end
|
220
|
+
```
|
221
|
+
+ `#generate_pdf`
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
Clickmeetings::Open::Session.by_conference(conferecne_id: 1) do
|
225
|
+
Сlickmeetings::Open::Session.find(1).generate_pdf :ru
|
226
|
+
# => hash { status: "...", ... }
|
227
|
+
# if status id "FINISHED", it contains :url key with url of pdf
|
228
|
+
# params sets locale; default locale in config; default for config is "en"
|
229
|
+
end
|
230
|
+
```
|
231
|
+
+ `#get_report`
|
232
|
+
|
233
|
+
```ruby
|
234
|
+
Clickmeetings::Open::Session.by_conference(conferecne_id: 1) do
|
235
|
+
Сlickmeetings::Open::Session.find(1).generate_pdf :ru
|
236
|
+
# => url of pdf is status for specified locale is "FINISHED"
|
237
|
+
# nil else
|
238
|
+
end
|
239
|
+
```
|
240
|
+
+ `#registrations`
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
Clickmeetings::Open::Session.by_conference(conferecne_id: 1) do
|
244
|
+
Сlickmeetings::Open::Session.find(1).registrations
|
245
|
+
# => array of registrations
|
246
|
+
end
|
247
|
+
```
|
248
|
+
+ Contacts
|
249
|
+
|
250
|
+
Only `.create` method:
|
251
|
+
```ruby
|
252
|
+
Clickmeetings::Open::Contact.create(
|
253
|
+
email: "...",
|
254
|
+
firstname: "...",
|
255
|
+
lastname: "...",
|
256
|
+
phone: "...", # optional
|
257
|
+
company: "...", # optional
|
258
|
+
country: "..." # optional
|
259
|
+
)
|
260
|
+
```
|
261
|
+
If contact with passed email exists, it will be updated
|
262
|
+
|
263
|
+
+ TimeZone
|
264
|
+
|
265
|
+
Only `.all` method with optional param `:country`. Returns array of strings.
|
266
|
+
```ruby
|
267
|
+
Clickmeetings::Open::TimeZone.all country: :ru # => time zones in Russia
|
268
|
+
Clickmeetings::Open::TimeZone.all # => all time zones
|
269
|
+
```
|
270
|
+
|
271
|
+
+ PhoneGateway
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
Clickmeetings::Open::PhoneGateway.all # => array of phone gateways
|
275
|
+
```
|
276
|
+
|
277
|
+
+ Registration
|
278
|
+
|
279
|
+
```ruby
|
280
|
+
Clickmeetings::Open::Registration.by_conference(conference_id: 1) do
|
281
|
+
Clickmeetings::Open::Registration.all # => array of registrations
|
282
|
+
Clickmeetings::Open::Registration.active # => array of active registrations
|
283
|
+
Clickmeetings::Open::Registration.create(params) # => registration hash
|
284
|
+
# => params like in Clickmeetings::Open::Conference#register
|
285
|
+
Clickmeetings::Open::Registration.for_session(session_id: 1)
|
286
|
+
# => registrations for session with id 1
|
287
|
+
end
|
288
|
+
```
|
289
|
+
|
290
|
+
+ FileLibrary
|
291
|
+
|
292
|
+
```ruby
|
293
|
+
Clickmeetings::Open::FileLibrary.create(path: '/path/to/file.pdf')
|
294
|
+
# => FileLibrary instance; creates file in your library
|
295
|
+
Clickmeetings::Open::FileLibrary.create(path: '/path/to/file.pdf', conference_id: 1)
|
296
|
+
# => FileLibrary instance; creates file in conference with id 1
|
297
|
+
Clickmeetings::Open::FileLibrary.all # => array of FileLibrary instances
|
298
|
+
Clickmeetings::Open::FileLibrary.for_conference(conference_id: 1)
|
299
|
+
# array of files in conference with id 1
|
300
|
+
|
301
|
+
# find and destroy as usually
|
302
|
+
|
303
|
+
Clickmeetings::Open::FileLibrary.new(id: 1).download # => content of file with id 1 as String
|
304
|
+
```
|
305
|
+
|
306
|
+
+ Recording
|
307
|
+
|
308
|
+
`Clickmeetings::Open::Recordings` interacts with recordings. Specify a conference with `by_conference` (as above) method and use `.all`, `.find`, and `.destroy_all` (to destroy all recordings of conference) methods.
|
309
|
+
|
310
|
+
+ Chat
|
311
|
+
|
312
|
+
`Clickmeetings::Open::Chat` interacts with chats. Use `.all` to get info about chats. `.find` returns content of zip-archive with a chat.
|
313
|
+
|
314
|
+
+ Other
|
315
|
+
|
316
|
+
Use `.ping` with any class to check API status.
|
26
317
|
|
27
318
|
## Development
|
28
319
|
|
29
|
-
|
320
|
+
+ Fork repo
|
321
|
+
+ Create new branch
|
322
|
+
+ install dependencies
|
323
|
+
|
324
|
+
$ bundle install
|
30
325
|
|
31
|
-
|
326
|
+
+ Commit your changes (do not forget about specs)
|
327
|
+
+ Create a pull request
|
32
328
|
|
33
329
|
## Contributing
|
34
330
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
331
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/teachbase/clickmeetings.
|
36
332
|
|
37
333
|
|
38
334
|
## License
|
data/clickmeetings.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Clickmeetings::VERSION
|
9
9
|
spec.authors = ["Sergei Alekseenko", "Makar Ermokhin"]
|
10
10
|
spec.email = ["alekseenkoss@gmail.com", "ermak95@gmail.com"]
|
11
|
-
spec.summary = %q{Simple REST API client for ClickMeetings Private Label API}
|
12
|
-
spec.description = %q{Simple REST API client for ClickMeetings Private Label API}
|
11
|
+
spec.summary = %q{Simple REST API client for ClickMeetings Private Label and Open API}
|
12
|
+
spec.description = %q{Simple REST API client for ClickMeetings Private Label and Open API}
|
13
13
|
spec.homepage = "https://github.com/teachbase/clickmeetings"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -23,9 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
24
|
spec.add_development_dependency "webmock", "~> 2"
|
25
25
|
spec.add_development_dependency 'pry', "~> 0.10"
|
26
|
+
spec.add_development_dependency 'simplecov'
|
27
|
+
spec.add_development_dependency "simplecov-gem-profile"
|
26
28
|
spec.add_dependency "anyway_config", "~> 0", ">= 0.3"
|
27
29
|
spec.add_dependency "faraday", "~> 0.9"
|
28
30
|
spec.add_dependency "faraday_middleware", "~> 0.10"
|
29
|
-
spec.add_dependency 'activemodel', "
|
31
|
+
spec.add_dependency 'activemodel', ">= 4.1", "< 6"
|
30
32
|
spec.add_dependency 'json', '~> 1.0'
|
31
33
|
end
|
data/lib/clickmeetings.rb
CHANGED
@@ -3,23 +3,20 @@ require 'clickmeetings/config'
|
|
3
3
|
require 'clickmeetings/client'
|
4
4
|
require 'clickmeetings/model'
|
5
5
|
require 'clickmeetings/exceptions'
|
6
|
+
require 'clickmeetings/storage'
|
6
7
|
|
7
8
|
require 'clickmeetings/models/privatelabel/model'
|
8
|
-
|
9
|
-
require 'clickmeetings/models/privatelabel/conference'
|
10
|
-
require 'clickmeetings/models/privatelabel/profile'
|
9
|
+
Gem.find_files('clickmeetings/models/privatelabel/*.rb').each { |f| require f }
|
11
10
|
|
12
|
-
|
11
|
+
require 'clickmeetings/models/open/model'
|
12
|
+
Gem.find_files('clickmeetings/models/open/concerns/*.rb').each { |f| require f }
|
13
|
+
Gem.find_files('clickmeetings/models/open/*.rb').each { |f| require f }
|
13
14
|
|
14
15
|
module Clickmeetings
|
15
16
|
def self.config
|
16
17
|
@config ||= Config.new
|
17
18
|
end
|
18
19
|
|
19
|
-
def self.properties
|
20
|
-
client.properties
|
21
|
-
end
|
22
|
-
|
23
20
|
def self.configure
|
24
21
|
yield(config) if block_given?
|
25
22
|
end
|
@@ -31,6 +28,7 @@ module Clickmeetings
|
|
31
28
|
def self.reset
|
32
29
|
@config = nil
|
33
30
|
@client = nil
|
31
|
+
ClientRegistry.client = nil
|
34
32
|
end
|
35
33
|
|
36
34
|
def self.with_client(client)
|
data/lib/clickmeetings/client.rb
CHANGED
@@ -4,15 +4,14 @@ require 'json'
|
|
4
4
|
|
5
5
|
module Clickmeetings
|
6
6
|
class Client
|
7
|
-
attr_reader :url, :
|
8
|
-
|
9
|
-
def initialize(url: Clickmeetings.config.host,
|
10
|
-
api_key: Clickmeetings.config.api_key)
|
7
|
+
attr_reader :url, :connect
|
11
8
|
|
9
|
+
def initialize(url: Clickmeetings.config.host)
|
12
10
|
@url = url
|
13
|
-
@api_key = api_key
|
14
11
|
|
15
12
|
@connect = Faraday.new(url: url) do |faraday|
|
13
|
+
faraday.request :multipart
|
14
|
+
faraday.request :url_encoded
|
16
15
|
faraday.adapter Faraday.default_adapter
|
17
16
|
faraday.use :instrumentation
|
18
17
|
end
|
@@ -52,10 +51,10 @@ module Clickmeetings
|
|
52
51
|
end
|
53
52
|
|
54
53
|
%w(get post put patch delete).each do |method|
|
55
|
-
define_method method do |url, params = {}|
|
54
|
+
define_method method do |url, params = {}, headers = {}|
|
56
55
|
l = lambda do |req|
|
57
|
-
req.headers
|
58
|
-
req.body = params
|
56
|
+
req.headers.merge! headers
|
57
|
+
req.body = params
|
59
58
|
end
|
60
59
|
request(method, url, &l)
|
61
60
|
end
|
data/lib/clickmeetings/config.rb
CHANGED
@@ -6,6 +6,7 @@ module Clickmeetings
|
|
6
6
|
attr_config privatelabel_host: 'https://api.clickmeeting.com/privatelabel/v1',
|
7
7
|
host: 'https://api.clickmeeting.com/v1',
|
8
8
|
api_key: 'test_key',
|
9
|
-
privatelabel_api_key: 'privatelabel_api_key'
|
9
|
+
privatelabel_api_key: 'privatelabel_api_key',
|
10
|
+
locale: :en
|
10
11
|
end
|
11
12
|
end
|