bridge_api 0.1.24 → 0.1.25

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: 41b849a3dc1ff52b4b877a7bd79df110ba14967c
4
- data.tar.gz: b78071208feaba95390d8a922b3803773bcdd9f1
3
+ metadata.gz: 4410c0f827b50bd67647f072bfbadc92c6644cb4
4
+ data.tar.gz: 043fba9339bd05973defad1895adcc338ba11650
5
5
  SHA512:
6
- metadata.gz: c5acc23051ae8843ed7e5f9b45e5b5d02df997594e8fecca38842b49b155884eba60a334ffc58afb5df4624256a5c5fb36879c6f803c5b84ccf625e44a164033
7
- data.tar.gz: c8bf74dcd83c059cdf34e2b7160f41af35db5062919da46df8a92d36d7e55bf0e09d9b0e0a06753509f5393305cc3a4d94528a33c4346cbdd3752a71951b1c11
6
+ metadata.gz: 8fdcb3e98ef8ddf288d5c2f7983eab1e2e333bb92bdae849cb92fa54c54816e918ad6a2487a26790195922e960dd6f87e8f6eff627b32f020dfad023721d0c2f
7
+ data.tar.gz: e811105b99fe5ce453464265df47f60b4ff9148ad5f8aababc1345ce0c4dd4572740f1b3ca0c98fccb33d17dadc5558986fab873d15ab0f23ceb0b318c6f2414
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bridge_api (0.1.24)
4
+ bridge_api (0.1.25)
5
5
  faraday (~> 0.9.0)
6
6
  faraday_middleware (~> 0.9.0)
7
7
  footrest (>= 0.5.1)
@@ -9,15 +9,15 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (5.1.5)
12
+ activesupport (5.2.0)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (~> 0.7)
14
+ i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
- addressable (2.5.1)
18
- public_suffix (~> 2.0, >= 2.0.2)
17
+ addressable (2.5.2)
18
+ public_suffix (>= 2.0.2, < 4.0)
19
19
  byebug (8.2.5)
20
- coderay (1.1.1)
20
+ coderay (1.1.2)
21
21
  concurrent-ruby (1.0.5)
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
@@ -30,20 +30,19 @@ GEM
30
30
  activesupport (>= 3.0.0)
31
31
  faraday (~> 0.9.0)
32
32
  link_header (>= 0.0.7)
33
- hashdiff (0.3.2)
34
- i18n (0.9.5)
33
+ hashdiff (0.3.7)
34
+ i18n (1.0.1)
35
35
  concurrent-ruby (~> 1.0)
36
36
  link_header (0.0.8)
37
- method_source (0.8.2)
37
+ method_source (0.9.0)
38
38
  minitest (5.11.3)
39
39
  multipart-post (2.0.0)
40
- pry (0.10.4)
40
+ pry (0.11.3)
41
41
  coderay (~> 1.1.0)
42
- method_source (~> 0.8.1)
43
- slop (~> 3.4)
44
- public_suffix (2.0.5)
45
- rack (1.6.5)
46
- rack-protection (1.5.3)
42
+ method_source (~> 0.9.0)
43
+ public_suffix (3.0.2)
44
+ rack (1.6.10)
45
+ rack-protection (1.5.5)
47
46
  rack
48
47
  rake (0.9.6)
49
48
  rspec (2.99.0)
@@ -59,7 +58,6 @@ GEM
59
58
  rack (~> 1.5)
60
59
  rack-protection (~> 1.4)
61
60
  tilt (>= 1.3, < 3)
62
- slop (3.6.0)
63
61
  thread_safe (0.3.6)
64
62
  tilt (1.4.1)
65
63
  tzinfo (1.2.5)
@@ -26,6 +26,7 @@ module BridgeAPI
26
26
  SUB_ACCOUNT_PATH = '/sub_accounts'.freeze
27
27
  SUPPORT_PATH = '/support'.freeze
28
28
  ACCOUNT_PATH = '/accounts'.freeze
29
+ CLONE_OBJECTS_PATH = '/clone_objects'
29
30
  API_VERSION = 1
30
31
  API_PATH = '/api'.freeze
31
32
  ROLE_PATH = '/roles'.freeze
@@ -0,0 +1,15 @@
1
+ module BridgeAPI
2
+ class Client
3
+ module CloneObject
4
+
5
+ def clone_objects(params = {})
6
+ post("#{API_PATH}#{ADMIN_PATH}#{CLONE_OBJECTS_PATH}", params)
7
+ end
8
+
9
+ def clone_object_status(id, params={})
10
+ get("#{API_PATH}#{ADMIN_PATH}#{CLONE_OBJECTS_PATH}/#{id}", params)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module BridgeAPI
2
- VERSION = '0.1.24'.freeze unless defined?(BridgeAPI::VERSION)
2
+ VERSION = '0.1.25'.freeze unless defined?(BridgeAPI::VERSION)
3
3
  end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ describe BridgeAPI::Client::CloneObject do
4
+ before do
5
+ @client = BridgeAPI::Client.new(prefix: 'http://test.bridge.com', token: 'test_token')
6
+ end
7
+
8
+ it 'should clone an object' do
9
+ response = @client.clone_objects(
10
+ {
11
+ clone_objects: [
12
+ {
13
+ source_type: 'CourseTemplate',
14
+ source_id: 1
15
+ }
16
+ ]
17
+ }
18
+ ).first
19
+ expect(response['destination_id']).to(eq(1))
20
+ end
21
+
22
+ it 'should get the clone_object' do
23
+ response = @client.clone_object_status(1).first
24
+ expect(response['state']).to(eq('completed'))
25
+ end
26
+
27
+ end
@@ -0,0 +1,16 @@
1
+ {
2
+ "meta": {},
3
+ "clone_objects": [
4
+ {
5
+ "id":1,
6
+ "state": "completed",
7
+ "destination_id": 1,
8
+ "destination_type": "CourseTemplate",
9
+ "source_id":1,
10
+ "source_type":"CourseTemplate",
11
+ "error_messages":[],
12
+ "created_at":"2018-05-16T13:17:59.110-06:00",
13
+ "updated_at":"2018-05-16T13:17:59.144-06:00"
14
+ }
15
+ ]
16
+ }
@@ -2,6 +2,16 @@ require 'sinatra/base'
2
2
  require 'tilt'
3
3
 
4
4
  class FakeBridge < Sinatra::Base
5
+ ## Clone Objects
6
+
7
+ post %r{/api/admin/clone_objects$} do
8
+ get_json_data 200, 'clone_objects.json'
9
+ end
10
+
11
+ get %r{/api/admin/clone_objects/\d+$} do
12
+ get_json_data 200, 'clone_objects.json'
13
+ end
14
+
5
15
  ## Course Templates
6
16
 
7
17
  get %r{/api/author/course_templates$} do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
@@ -195,6 +195,7 @@ files:
195
195
  - lib/bridge_api/api_array.rb
196
196
  - lib/bridge_api/client.rb
197
197
  - lib/bridge_api/client/account.rb
198
+ - lib/bridge_api/client/clone_object.rb
198
199
  - lib/bridge_api/client/course_template.rb
199
200
  - lib/bridge_api/client/custom_field.rb
200
201
  - lib/bridge_api/client/data_dump.rb
@@ -209,6 +210,7 @@ files:
209
210
  - lib/bridge_api/client/user.rb
210
211
  - lib/bridge_api/version.rb
211
212
  - spec/bridge_api/client/account_spec.rb
213
+ - spec/bridge_api/client/clone_object_spec.rb
212
214
  - spec/bridge_api/client/course_template_spec.rb
213
215
  - spec/bridge_api/client/custom_field_spec.rb
214
216
  - spec/bridge_api/client/data_dump_spec.rb
@@ -222,6 +224,7 @@ files:
222
224
  - spec/bridge_api/client/user_spec.rb
223
225
  - spec/bridge_api/client_spec.rb
224
226
  - spec/fixtures/accounts.json
227
+ - spec/fixtures/clone_objects.json
225
228
  - spec/fixtures/course.json
226
229
  - spec/fixtures/courses.json
227
230
  - spec/fixtures/custom_fields.json
@@ -267,6 +270,7 @@ specification_version: 4
267
270
  summary: Bridge API
268
271
  test_files:
269
272
  - spec/bridge_api/client/account_spec.rb
273
+ - spec/bridge_api/client/clone_object_spec.rb
270
274
  - spec/bridge_api/client/course_template_spec.rb
271
275
  - spec/bridge_api/client/custom_field_spec.rb
272
276
  - spec/bridge_api/client/data_dump_spec.rb
@@ -280,6 +284,7 @@ test_files:
280
284
  - spec/bridge_api/client/user_spec.rb
281
285
  - spec/bridge_api/client_spec.rb
282
286
  - spec/fixtures/accounts.json
287
+ - spec/fixtures/clone_objects.json
283
288
  - spec/fixtures/course.json
284
289
  - spec/fixtures/courses.json
285
290
  - spec/fixtures/custom_fields.json