bridge_api 0.1.36 → 0.1.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e190d33cc89910b4490e64a7b460019cffc472d8
4
- data.tar.gz: a7164182d78d0f3983612230a906dc416d9e58f1
3
+ metadata.gz: 5d378de0ed191a54a78659a84a95558d7df192e1
4
+ data.tar.gz: 6f9526f496419ec2b51bfb4430b61c13d5ea38ee
5
5
  SHA512:
6
- metadata.gz: d622cfc13a8616da819ce15684194711f326051028ccc0090a2be459070542ca7a487b549bce73b6dca3f564963f30d780efda8adaa9883f12e1e1a430f69b34
7
- data.tar.gz: 6db35ec490c5d51d938c82b73a1673d18a53a0d69e97fae8c49ca4629798b1377780caae6dd985b35c9c6b5e493e3c86a30253ca27bda2bc2c0c60e47d85a2da
6
+ metadata.gz: 9806534f173060d13aa71a5839f867c232844bcc71fbd6e3fa6a131384502c5510fd35a435655a4ef80202e7e357c68285795817aed2547cb641b9aed089b508
7
+ data.tar.gz: 802496cc90a7440b37dcf74093269d199f1b3fd99f21904246fddc8ba8ff38d660132d991888dd522265b1f891a7af229794a79b910f8281c6b923e371c65102
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bridge_api (0.1.35)
4
+ bridge_api (0.1.37)
5
5
  faraday (~> 0.9.0)
6
6
  faraday_middleware (~> 0.9.0)
7
7
  footrest (>= 0.5.1)
@@ -34,6 +34,9 @@ module BridgeAPI
34
34
  ROLE_PATH = '/roles'.freeze
35
35
  AFFILIATED_SUBACCOUNTS = '/affiliated_sub_accounts'.freeze
36
36
  BATCH_PATH = '/batch'.freeze
37
+ LIVE_COURSES_PATH = '/live_courses'.freeze
38
+ SESSIONS_PATH = '/sessions'.freeze
39
+ PUBLISH_PATH = '/publish'.freeze
37
40
  RESULT_MAPPING = {}
38
41
 
39
42
  Dir[File.dirname(__FILE__) + '/client/*.rb'].each do |file|
@@ -0,0 +1,22 @@
1
+ module BridgeAPI
2
+ class Client
3
+ module LiveCourseSession
4
+
5
+ def create_live_course_session(live_course_id, params = {})
6
+ post("#{API_PATH}#{AUTHOR_PATH}#{LIVE_COURSES_PATH}/#{live_course_id}#{SESSIONS_PATH}", params)
7
+ end
8
+
9
+ def delete_live_course_session(live_course_id, session_id)
10
+ delete("#{API_PATH}#{AUTHOR_PATH}#{LIVE_COURSES_PATH}/#{live_course_id}#{SESSIONS_PATH}/#{session_id}")
11
+ end
12
+
13
+ def update_live_course_session(live_course_id, session_id, params = {})
14
+ put("#{API_PATH}#{AUTHOR_PATH}#{LIVE_COURSES_PATH}/#{live_course_id}#{SESSIONS_PATH}/#{session_id}", params)
15
+ end
16
+
17
+ def publish_live_course_session(live_course_id, session_id)
18
+ post("#{API_PATH}#{AUTHOR_PATH}#{LIVE_COURSES_PATH}/#{live_course_id}#{SESSIONS_PATH}/#{session_id}#{PUBLISH_PATH}")
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,6 +5,10 @@ module BridgeAPI
5
5
  get("#{API_PATH}#{ADMIN_PATH}#{SUB_ACCOUNT_PATH}", params)
6
6
  end
7
7
 
8
+ def get_sub_account(subaccount_id, params = {})
9
+ get("#{API_PATH}#{ADMIN_PATH}#{SUB_ACCOUNT_PATH}/#{subaccount_id}", params)
10
+ end
11
+
8
12
  def deactivate_sub_account(subaccount_id, params = {})
9
13
  put("#{API_PATH}#{ADMIN_PATH}#{SUB_ACCOUNT_PATH}/#{subaccount_id}/disable", params)
10
14
  end
@@ -1,3 +1,3 @@
1
1
  module BridgeAPI
2
- VERSION = '0.1.36'.freeze unless defined?(BridgeAPI::VERSION)
2
+ VERSION = '0.1.37'.freeze unless defined?(BridgeAPI::VERSION)
3
3
  end
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+
3
+ describe BridgeAPI::Client::LiveCourseSession do
4
+ before do
5
+ @client = BridgeAPI::Client.new(prefix: 'http://test.bridge.com', token: 'test_token')
6
+ end
7
+
8
+ it 'should create a live course session in bridge' do
9
+ params = {
10
+ sessions: [{
11
+ start_at: '2018-08-07T15:00:00.918Z',
12
+ end_at: '2018-08-07T16:00:00.918Z',
13
+ timezone: 'America/Denver'
14
+ }]
15
+ }
16
+ response = @client.create_live_course_session(1, params)
17
+ expect(response.status).to eq(201)
18
+ end
19
+
20
+ it 'should delete a live course session in bridge' do
21
+ response = @client.delete_live_course_session(1,5)
22
+ expect(response.status).to eq(204)
23
+ end
24
+
25
+ it 'should update the existing live course session' do
26
+ params = {
27
+ sessions: [{
28
+ seats: 5
29
+ }]
30
+ }
31
+ response = @client.update_live_course_session(1, 5, params)
32
+ expect(response.status).to eq(200)
33
+ end
34
+
35
+ it 'should publish a live course session' do
36
+ response = @client.publish_live_course_session(1, 5)
37
+ expect(response.status).to eq(200)
38
+ end
39
+ end
@@ -13,6 +13,12 @@ describe BridgeAPI::Client::SubAccount do
13
13
  expect(response.first['id']).to(eq('141'))
14
14
  end
15
15
 
16
+ it 'should get a single subaccount' do
17
+ subaccounts = @client.get_sub_account(1)
18
+ expect(subaccounts.count).to(eq(1))
19
+ expect(subaccounts.first['name']).to(eq('Customers'))
20
+ end
21
+
16
22
  it 'should activate a subaccount' do
17
23
  response = @client.activate_sub_account(1)
18
24
  expect(response.first['id']).to(eq('141'))
@@ -0,0 +1,21 @@
1
+ {
2
+ "sessions":
3
+ [{
4
+ "id":"5",
5
+ "title":null,
6
+ "start_at":"2018-08-07T15:00:00.918Z",
7
+ "end_at":"2018-08-07T16:00:00.918Z",
8
+ "location":null,
9
+ "seats":5,
10
+ "registered_count":0,
11
+ "present_count":0,
12
+ "notes":null,
13
+ "live_course_id":"1",
14
+ "concluded_at":null,
15
+ "multi_part":false,
16
+ "is_published":false,
17
+ "timezone":"America/Denver",
18
+ "enroll_url":"http://bridge.lvh.me:3000/learner/training/a918ab45/sessions/5/enroll",
19
+ "has_web_conference":false
20
+ }]
21
+ }
@@ -168,6 +168,23 @@ class FakeBridge < Sinatra::Base
168
168
  get_json_data 200, 'live_course_enrollments.json'
169
169
  end
170
170
 
171
+ # Live Course Sessions
172
+ post %r{/api/author/live_courses/\d+/sessions/\d+/publish} do
173
+ get_json_data 200, 'live_course_sessions.json'
174
+ end
175
+
176
+ post %r{/api/author/live_courses/\d+/sessions} do
177
+ get_json_data 201, 'live_course_sessions.json'
178
+ end
179
+
180
+ delete %r{/api/author/live_courses/\d+/sessions/\d+} do
181
+ get_json_data 204, 'live_course_sessions.json'
182
+ end
183
+
184
+ put %r{/api/author/live_courses/\d+/sessions} do
185
+ get_json_data 200, 'live_course_sessions.json'
186
+ end
187
+
171
188
  # Sub Accounts
172
189
  post %r{/api/admin/sub_accounts$} do
173
190
  get_json_data 200, 'sub_accounts.json'
@@ -177,6 +194,10 @@ class FakeBridge < Sinatra::Base
177
194
  get_json_data 200, 'sub_accounts.json'
178
195
  end
179
196
 
197
+ get %r{/api/admin/sub_accounts/\d+$} do
198
+ get_json_data 200, 'sub_accounts.json'
199
+ end
200
+
180
201
  put %r{/api/admin/sub_accounts$} do
181
202
  get_json_data 200, 'sub_accounts.json'
182
203
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.36
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-27 00:00:00.000000000 Z
11
+ date: 2018-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,6 +218,7 @@ files:
218
218
  - lib/bridge_api/client/group.rb
219
219
  - lib/bridge_api/client/live_course.rb
220
220
  - lib/bridge_api/client/live_course_enrollment.rb
221
+ - lib/bridge_api/client/live_course_session.rb
221
222
  - lib/bridge_api/client/manager.rb
222
223
  - lib/bridge_api/client/program_enrollment.rb
223
224
  - lib/bridge_api/client/role.rb
@@ -233,6 +234,7 @@ files:
233
234
  - spec/bridge_api/client/enrollment_spec.rb
234
235
  - spec/bridge_api/client/group_spec.rb
235
236
  - spec/bridge_api/client/live_course_enrollments_spec.rb
237
+ - spec/bridge_api/client/live_course_session_spec.rb
236
238
  - spec/bridge_api/client/live_course_spec.rb
237
239
  - spec/bridge_api/client/manager_spec.rb
238
240
  - spec/bridge_api/client/program_enrollment_spec.rb
@@ -253,6 +255,7 @@ files:
253
255
  - spec/fixtures/enrollments.json
254
256
  - spec/fixtures/group.json
255
257
  - spec/fixtures/live_course_enrollments.json
258
+ - spec/fixtures/live_course_sessions.json
256
259
  - spec/fixtures/live_courses.json
257
260
  - spec/fixtures/managers.json
258
261
  - spec/fixtures/program_enrollments.json
@@ -301,6 +304,7 @@ test_files:
301
304
  - spec/bridge_api/client/enrollment_spec.rb
302
305
  - spec/bridge_api/client/group_spec.rb
303
306
  - spec/bridge_api/client/live_course_enrollments_spec.rb
307
+ - spec/bridge_api/client/live_course_session_spec.rb
304
308
  - spec/bridge_api/client/live_course_spec.rb
305
309
  - spec/bridge_api/client/manager_spec.rb
306
310
  - spec/bridge_api/client/program_enrollment_spec.rb
@@ -321,6 +325,7 @@ test_files:
321
325
  - spec/fixtures/enrollments.json
322
326
  - spec/fixtures/group.json
323
327
  - spec/fixtures/live_course_enrollments.json
328
+ - spec/fixtures/live_course_sessions.json
324
329
  - spec/fixtures/live_courses.json
325
330
  - spec/fixtures/managers.json
326
331
  - spec/fixtures/program_enrollments.json