bearcat 1.3.13 → 1.3.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4017848830f53fece7f85a94a62e421f7d1ec1bd
4
- data.tar.gz: 5d9eaa1f2a20f86d8645b4eb3c11dd4503b00fb4
3
+ metadata.gz: 634cf3aab55a6019c01d68f5ec1946244f9f92fe
4
+ data.tar.gz: 660a9a0fb83d02a60b6e69350d6dec5087c58ddc
5
5
  SHA512:
6
- metadata.gz: 926b53ae82f7772736c6f97365791652eca27e6be3b224436c75a0737ee6351c27013187c056b28b038d0a248f0d249e00471ee206d8a3aa643e30d87337106c
7
- data.tar.gz: 190b3f22ec84e138dc389a5bb6d406d8e1356f00c7e018d1770af780b3d0b2fd29e3bb78c5f87925c5130ffecc0e2b2276f6d81090aa3fffbad3a0c70bb0333b
6
+ metadata.gz: e0af6addb849e2cbeeb68defe4b633fa306b354df8c2ee21ac9839f2f571c12443c99cafaad501f27b33d48ff43b0202d2b62f59720a2bde7ff3ac7e6b615774
7
+ data.tar.gz: 8ceb9e9a59da4ce71c0e5923be511fce6eb3011094cabe8e1760c18c4b4aad11a78e3edf03d85ac2dfa6c7e6da5b2193c2a50b8d54ab95984572f4209b78240c
@@ -30,11 +30,16 @@ module Bearcat
30
30
  get("/api/v1/courses/#{course}/outcome_results", params)
31
31
  end
32
32
 
33
- def create_content_migration(course, file_path, params={})
34
- response = post("/api/v1/courses/#{course}/content_migrations", params)
35
- pre_attachment = response['pre_attachment']
33
+ def create_content_migration_with_both_responses(course, file_path, params={})
34
+ content_migration_response = post("/api/v1/courses/#{course}/content_migrations", params)
35
+ pre_attachment = content_migration_response['pre_attachment']
36
36
  confirmation_url = post_file(pre_attachment['upload_url'], pre_attachment['upload_params'], file_path)
37
- confirm_file_upload(confirmation_url)
37
+ [content_migration_response, confirm_file_upload(confirmation_url)]
38
+ end
39
+
40
+ def create_content_migration(course, file_path, params={})
41
+ content_migration_response, file_upload_response = create_content_migration_with_both_responses(course, file_path, params)
42
+ file_upload_response
38
43
  end
39
44
 
40
45
  # Performs effectively the same operation as #create_content_migration, but without the need to specify a file to be uploaded
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.13' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.14' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -74,10 +74,11 @@ describe Bearcat::Client::Accounts do
74
74
  account_admin = @client.delete_account_admin(1, "sis_user_id:user1_sis_id", {role_id:1})
75
75
  expect(account_admin['id']).to eq 99
76
76
  expect(account_admin['status']).to eq 'deleted'
77
+ end
77
78
 
78
79
  it 'returns a list of sis_imports' do
79
80
  stub_get(@client, "/api/v1/accounts/1/sis_imports").to_return(json_response("account_sis_imports.json"))
80
- sis_imports = @client.account_sis_imports(1)
81
+ sis_imports = @client.account_sis_imports(1)['sis_imports']
81
82
  expect(sis_imports.first['id']).to eq 30
82
83
  expect(sis_imports.first['workflow_state']).to eq 'imported'
83
84
  end
@@ -57,6 +57,25 @@ describe Bearcat::Client::Sections do
57
57
  expect(response['id']).to eq 293
58
58
  end
59
59
 
60
+ describe '#create_content_migration_with_both_responses' do
61
+ it 'creates a content migration and returns the content migration response and the file creation response' do
62
+ stub_post(@client, "/api/v1/courses/659/content_migrations").
63
+ with(:body => {"migration_type"=>"canvas_cartridge_importer", "pre_attachment"=>{"name"=>"cc.imscc", "size"=>"2034"}}).
64
+ to_return(json_response('content_migration_files', 'response.json'))
65
+
66
+ stub_request(:post, "http://host/files_api").
67
+ to_return(status: 302, headers: {'Location' => 'https://confirm-upload.invalid/confirm?param=true'})
68
+
69
+ stub_post(@client, "/confirm").
70
+ with(:body => {"param" => ["true"]}).to_return(json_response('content_migration_files', 'upload_success.json'))
71
+
72
+ opts = {'migration_type' => 'canvas_cartridge_importer', 'pre_attachment[name]' => 'cc.imscc', 'pre_attachment[size]' => '2034'}
73
+ content_migration_response, file_upload_response = @client.create_content_migration_with_both_responses('659', fixture('cc.imscc'), opts)
74
+ expect(content_migration_response['id']).to eq 21
75
+ expect(file_upload_response['id']).to eq 293
76
+ end
77
+ end
78
+
60
79
  it 'throws an error on a failed file upload' do
61
80
  stub_post(@client, "/api/v1/courses/659/content_migrations").
62
81
  with(:body => {"migration_type"=>"canvas_cartridge_importer", "pre_attachment"=>{"name"=>"cc.imscc", "size"=>"2034"}}).
@@ -1,38 +1,39 @@
1
- [
2
- {
3
- "created_at": "2017-03-22T03:01:18Z",
4
- "started_at": "2017-03-22T03:01:18Z",
5
- "ended_at": "2017-03-22T03:01:19Z",
6
- "updated_at": "2017-03-22T03:01:19Z",
7
- "progress": 100,
8
- "id": 30,
9
- "workflow_state": "imported",
10
- "data": {
11
- "import_type": "instructure_csv",
12
- "supplied_batches": [
13
- "course"
14
- ],
15
- "counts": {
16
- "accounts": 0,
17
- "terms": 0,
18
- "abstract_courses": 0,
19
- "courses": 1,
20
- "sections": 0,
21
- "xlists": 0,
22
- "users": 0,
23
- "user_observers": 0,
24
- "enrollments": 0,
25
- "groups": 0,
26
- "group_memberships": 0,
27
- "grade_publishing_results": 0
28
- }
29
- },
30
- "batch_mode": null,
31
- "batch_mode_term_id": null,
32
- "override_sis_stickiness": null,
33
- "add_sis_stickiness": null,
34
- "clear_sis_stickiness": null,
35
- "diffing_data_set_identifier": null,
36
- "diffed_against_import_id": null
1
+ {
2
+ "sis_imports":
3
+ [{"created_at": "2017-03-22T03:01:18Z",
4
+ "started_at": "2017-03-22T03:01:18Z",
5
+ "ended_at": "2017-03-22T03:01:19Z",
6
+ "updated_at": "2017-03-22T03:01:19Z",
7
+ "progress": 100,
8
+ "id": 30,
9
+ "workflow_state": "imported",
10
+ "data": {
11
+ "import_type": "instructure_csv",
12
+ "supplied_batches": [
13
+ "course"
14
+ ],
15
+ "counts": {
16
+ "accounts": 0,
17
+ "terms": 0,
18
+ "abstract_courses": 0,
19
+ "courses": 1,
20
+ "sections": 0,
21
+ "xlists": 0,
22
+ "users": 0,
23
+ "user_observers": 0,
24
+ "enrollments": 0,
25
+ "groups": 0,
26
+ "group_memberships": 0,
27
+ "grade_publishing_results": 0
37
28
  }
38
- ]
29
+ },
30
+ "batch_mode": null,
31
+ "batch_mode_term_id": null,
32
+ "override_sis_stickiness": null,
33
+ "add_sis_stickiness": null,
34
+ "clear_sis_stickiness": null,
35
+ "diffing_data_set_identifier": null,
36
+ "diffed_against_import_id": null
37
+ }
38
+ ]
39
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bearcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.13
4
+ version: 1.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  requirements: []
319
319
  rubyforge_project:
320
- rubygems_version: 2.4.8
320
+ rubygems_version: 2.4.5
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Canvas API