bearcat 1.2.7 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/client/content_migrations.rb +14 -0
- data/lib/bearcat/client/pages.rb +12 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/content_migrations_spec.rb +20 -0
- metadata +21 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZGE4MjliYTZjOWZkNGRlNGZkYWMxZDgzZjkxYzcyNjczOTU2MzI4MA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 906cad6cbd9beac6affbfeee6406a569017fa344
|
4
|
+
data.tar.gz: 7a2b5c2b486d47c3b64a7373c2a754e94149952b
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YTc4NmYwODhjYTcwYjRlMGFiYTcyMTM1MGJmNTM2MDY5NGFmOTdhZGNmMGRk
|
11
|
-
ZjAzZTgyODY1ZTU5OWQzMjZhOGNiZDUzNGNiYzQzNDkxZjVmODg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzcwNWM0NmYyMWVmMzhkMGFmMzI3NzkzMjZmYmFmNzA1N2ViOTI1YTRhZDQ3
|
14
|
-
MDcwYjZhZjcwNmYwMjg0Nzg1NmJlYjA3NzkzMjc1MTM5MjNlYzMyZjNmOTc0
|
15
|
-
MGFkYWVkNmExYTg3MTFhNmVhMWMwN2FlNjMyZTE5NjQ0NzQyODk=
|
6
|
+
metadata.gz: 630d46c5c5d62ae5521f493f5a30711c24a364dcfe6750491ce987a4fd12bdc6b6d069df22d19881b45c7ba037f198be68cee66cc8942e34c1c62ad468e32837
|
7
|
+
data.tar.gz: 1f62d2c82c1fbd673e4954d1e1470fe33cb9f29f8a490b7f8e71606fae19d1b705850e6854d29a24c498351b808c5d2849aaa0a5ee219e594cfbd5d4ff51c7e4
|
data/lib/bearcat/client.rb
CHANGED
@@ -31,6 +31,7 @@ module Bearcat
|
|
31
31
|
require 'bearcat/client/folders'
|
32
32
|
require 'bearcat/client/analytics'
|
33
33
|
require 'bearcat/client/module_items'
|
34
|
+
require 'bearcat/client/content_migrations'
|
34
35
|
|
35
36
|
include Assignments
|
36
37
|
include Accounts
|
@@ -61,6 +62,7 @@ module Bearcat
|
|
61
62
|
include Files
|
62
63
|
include Folders
|
63
64
|
include ModuleItems
|
65
|
+
include ContentMigrations
|
64
66
|
|
65
67
|
|
66
68
|
# Override Footrest request for ApiArray support
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module ContentMigrations
|
4
|
+
|
5
|
+
def upload_content_package(api_path, file_path, params = {})
|
6
|
+
response = post(api_path, params)
|
7
|
+
pre_attachment = response['pre_attachment']
|
8
|
+
confirmation_url = post_file(pre_attachment['upload_url'], pre_attachment['upload_params'], file_path)
|
9
|
+
confirm_file_upload(confirmation_url)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/bearcat/client/pages.rb
CHANGED
@@ -6,6 +6,18 @@ module Bearcat
|
|
6
6
|
get("/api/v1/courses/#{course}/pages", params)
|
7
7
|
end
|
8
8
|
|
9
|
+
def list_group_pages(group, params={})
|
10
|
+
get("/api/v1/groups/#{group}/pages", params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def show_course_page(course, url, params={})
|
14
|
+
get("/api/v1/courses/#{course}/pages/#{url}", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def show_group_page(group, url, params={})
|
18
|
+
get("/api/v1/groups/#{group}/pages/#{url}", params)
|
19
|
+
end
|
20
|
+
|
9
21
|
end
|
10
22
|
end
|
11
23
|
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::ContentMigrations do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'uploads a file' do
|
9
|
+
stub_post(@client, "my/upload/path").
|
10
|
+
with(:body => {"name" => "cc.imscc", "size" => "2034"}).
|
11
|
+
to_return(json_response('content_migrations', 'upload_success.json'))
|
12
|
+
|
13
|
+
stub_request(:post, "https://upload-url.invalid/").
|
14
|
+
to_return(status: 302, headers: {'Location' => 'https://confirm-upload.invalid/confirm?param=true'})
|
15
|
+
|
16
|
+
response = @client.upload_content_package('my/upload/path', fixture('cc.imscc'))
|
17
|
+
expect(response['id']).to eq 293
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
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: 2016-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: footrest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.2.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.2.2
|
97
97
|
description: Ruby interface for interacting with the canvas API
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/bearcat/client/calendar_events.rb
|
115
115
|
- lib/bearcat/client/canvas_files.rb
|
116
116
|
- lib/bearcat/client/conferences.rb
|
117
|
+
- lib/bearcat/client/content_migrations.rb
|
117
118
|
- lib/bearcat/client/conversations.rb
|
118
119
|
- lib/bearcat/client/courses.rb
|
119
120
|
- lib/bearcat/client/discussions.rb
|
@@ -144,6 +145,7 @@ files:
|
|
144
145
|
- spec/bearcat/client/calendar_events_spec.rb
|
145
146
|
- spec/bearcat/client/canvas_files_spec.rb
|
146
147
|
- spec/bearcat/client/conferences_spec.rb
|
148
|
+
- spec/bearcat/client/content_migrations_spec.rb
|
147
149
|
- spec/bearcat/client/conversations_spec.rb
|
148
150
|
- spec/bearcat/client/courses_spec.rb
|
149
151
|
- spec/bearcat/client/discussions_spec.rb
|
@@ -267,17 +269,17 @@ require_paths:
|
|
267
269
|
- lib
|
268
270
|
required_ruby_version: !ruby/object:Gem::Requirement
|
269
271
|
requirements:
|
270
|
-
- -
|
272
|
+
- - ">="
|
271
273
|
- !ruby/object:Gem::Version
|
272
274
|
version: '0'
|
273
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
276
|
requirements:
|
275
|
-
- -
|
277
|
+
- - ">="
|
276
278
|
- !ruby/object:Gem::Version
|
277
279
|
version: '0'
|
278
280
|
requirements: []
|
279
281
|
rubyforge_project:
|
280
|
-
rubygems_version: 2.4.
|
282
|
+
rubygems_version: 2.4.3
|
281
283
|
signing_key:
|
282
284
|
specification_version: 4
|
283
285
|
summary: Canvas API
|
@@ -289,6 +291,7 @@ test_files:
|
|
289
291
|
- spec/bearcat/client/calendar_events_spec.rb
|
290
292
|
- spec/bearcat/client/canvas_files_spec.rb
|
291
293
|
- spec/bearcat/client/conferences_spec.rb
|
294
|
+
- spec/bearcat/client/content_migrations_spec.rb
|
292
295
|
- spec/bearcat/client/conversations_spec.rb
|
293
296
|
- spec/bearcat/client/courses_spec.rb
|
294
297
|
- spec/bearcat/client/discussions_spec.rb
|
@@ -403,3 +406,4 @@ test_files:
|
|
403
406
|
- spec/fixtures/user_page_views.json
|
404
407
|
- spec/fixtures/user_profile.json
|
405
408
|
- spec/helper.rb
|
409
|
+
has_rdoc:
|