bobross 0.1.6 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/.vscode/settings.json +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +30 -31
- data/Rakefile +2 -2
- data/bin/console +4 -4
- data/bobross.gemspec +21 -24
- data/lib/bobross.rb +18 -14
- data/lib/bobross/version.rb +1 -1
- data/lib/models/canvas_account.rb +58 -0
- data/lib/models/canvas_assignment.rb +56 -0
- data/lib/models/canvas_assignment_grade.rb +9 -0
- data/lib/models/canvas_assignment_group.rb +9 -0
- data/lib/models/{assignment_submission.rb → canvas_assignment_submission.rb} +1 -1
- data/lib/models/canvas_course.rb +72 -0
- data/lib/models/canvas_group_in_account.rb +9 -0
- data/lib/models/canvas_group_in_course.rb +9 -0
- data/lib/models/canvas_object.rb +25 -0
- data/lib/models/canvas_section.rb +48 -0
- data/lib/models/canvas_user.rb +60 -0
- metadata +46 -27
- data/lib/models/account.rb +0 -29
- data/lib/models/assignment.rb +0 -24
- data/lib/models/assignment_grade.rb +0 -9
- data/lib/models/assignment_group.rb +0 -9
- data/lib/models/course.rb +0 -44
- data/lib/models/group_in_account.rb +0 -9
- data/lib/models/group_in_course.rb +0 -9
- data/lib/models/section.rb +0 -23
- data/lib/models/user.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dfc9b8d00273c1d4816504bd7db83f2c4c4fc724dd48b584ccd2e3efb26e966
|
4
|
+
data.tar.gz: 807ebbcb86ee7ca86270a5127c9696d3ec86cd190a041337a5aef1efd304183d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aec090be04a0eadfc294c9a27463fce834b9a285b8e3d08d3cc0554aee77a19316925a76deeb92454b4237ff61f9ae44cfdb18303177bd6d8a4390e37981909a
|
7
|
+
data.tar.gz: 6af9c06a97e9b907afe3e0e6b48d48e3ad92df25ac3d9b0da9032622165c6169d18dca7d22c4f124f6a2214383162ca7cadb51e1de597ed0e4298f024e41d8ef
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,68 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bobross (0.1.
|
4
|
+
bobross (0.1.13)
|
5
|
+
bearcat (~> 1.4.1)
|
6
|
+
bundler (~> 2.1.4)
|
7
|
+
forgery (~> 0.7.0)
|
8
|
+
rake (~> 13.0.1)
|
5
9
|
|
6
10
|
GEM
|
7
11
|
remote: https://rubygems.org/
|
8
12
|
specs:
|
9
|
-
activesupport (
|
13
|
+
activesupport (6.0.3.2)
|
10
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
15
|
i18n (>= 0.7, < 2)
|
12
16
|
minitest (~> 5.1)
|
13
17
|
tzinfo (~> 1.1)
|
14
|
-
|
18
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
19
|
+
bearcat (1.4.1)
|
15
20
|
activesupport
|
16
21
|
footrest (>= 0.2.2)
|
17
22
|
paul_walker (~> 0.1.1)
|
18
|
-
concurrent-ruby (1.1.
|
19
|
-
diff-lcs (1.
|
20
|
-
|
21
|
-
activesupport (>= 3.0.0)
|
22
|
-
faraday (0.15.4)
|
23
|
+
concurrent-ruby (1.1.6)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
faraday (0.17.3)
|
23
26
|
multipart-post (>= 1.2, < 3)
|
24
27
|
footrest (0.5.3)
|
25
28
|
activesupport (>= 3.0.0)
|
26
29
|
faraday (>= 0.9.0, < 1)
|
27
30
|
link_header (>= 0.0.7)
|
28
31
|
forgery (0.7.0)
|
29
|
-
i18n (1.
|
32
|
+
i18n (1.8.4)
|
30
33
|
concurrent-ruby (~> 1.0)
|
31
34
|
link_header (0.0.8)
|
32
|
-
minitest (5.
|
35
|
+
minitest (5.14.1)
|
33
36
|
multipart-post (2.1.1)
|
34
37
|
paul_walker (0.1.2)
|
35
38
|
redis (>= 4.0)
|
36
|
-
rake (
|
37
|
-
redis (4.1
|
38
|
-
rspec (3.
|
39
|
-
rspec-core (~> 3.
|
40
|
-
rspec-expectations (~> 3.
|
41
|
-
rspec-mocks (~> 3.
|
42
|
-
rspec-core (3.
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-expectations (3.
|
39
|
+
rake (13.0.1)
|
40
|
+
redis (4.2.1)
|
41
|
+
rspec (3.9.0)
|
42
|
+
rspec-core (~> 3.9.0)
|
43
|
+
rspec-expectations (~> 3.9.0)
|
44
|
+
rspec-mocks (~> 3.9.0)
|
45
|
+
rspec-core (3.9.2)
|
46
|
+
rspec-support (~> 3.9.3)
|
47
|
+
rspec-expectations (3.9.2)
|
45
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-mocks (3.9.1)
|
48
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-support (3.
|
52
|
+
rspec-support (~> 3.9.0)
|
53
|
+
rspec-support (3.9.3)
|
51
54
|
thread_safe (0.3.6)
|
52
|
-
tzinfo (1.2.
|
55
|
+
tzinfo (1.2.7)
|
53
56
|
thread_safe (~> 0.1)
|
57
|
+
zeitwerk (2.4.0)
|
54
58
|
|
55
59
|
PLATFORMS
|
56
60
|
ruby
|
57
61
|
|
58
62
|
DEPENDENCIES
|
59
|
-
bearcat (~> 1.3.30)
|
60
63
|
bobross!
|
61
|
-
|
62
|
-
factory_bot (~> 4.11.1)
|
63
|
-
forgery (~> 0.7.0)
|
64
|
-
rake (~> 10.0)
|
65
|
-
rspec (~> 3.0)
|
64
|
+
rspec (~> 3.9)
|
66
65
|
|
67
66
|
BUNDLED WITH
|
68
|
-
2.
|
67
|
+
2.1.4
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'bobross'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/bobross.gemspec
CHANGED
@@ -1,43 +1,40 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require 'bobross/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'bobross'
|
8
7
|
spec.version = Bobross::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ['Jacob Slack', 'Trevor Byington']
|
9
|
+
spec.email = ['jacobs@instructure.com', 'tbyington@instructure.com', 'tabyington@gmail.com']
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
11
|
+
spec.summary = 'Generates data to put in your canvas instance.'
|
12
|
+
spec.description = 'Generates data to put in your canvas instance. Data can be exported as CSV for uploading or sent directly via api call'
|
13
|
+
spec.homepage = 'https://rubygems.org/gems/bobross'
|
14
|
+
spec.license = 'MIT'
|
16
15
|
|
17
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
18
|
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata[
|
21
|
-
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata["source_code_uri"] = "https://github.com/instructurecustomdevqa/bobross"
|
24
|
-
#pec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/instructurecustomdevqa/bobross'
|
25
22
|
else
|
26
|
-
raise
|
27
|
-
"public gem pushes."
|
23
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
28
24
|
end
|
29
25
|
|
30
26
|
# Specify which files should be added to the gem when it is released.
|
31
27
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
-
spec.files
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
29
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
30
|
end
|
35
|
-
spec.bindir =
|
31
|
+
spec.bindir = 'exe'
|
36
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
-
spec.require_paths = [
|
33
|
+
spec.require_paths = ['lib']
|
38
34
|
|
39
|
-
spec.
|
40
|
-
spec.
|
41
|
-
spec.
|
42
|
-
spec.
|
35
|
+
spec.add_dependency 'bearcat', '~> 1.4.1'
|
36
|
+
spec.add_dependency 'bundler', '~> 2.1.4'
|
37
|
+
spec.add_dependency 'forgery', '~> 0.7.0'
|
38
|
+
spec.add_dependency 'rake', '~> 13.0.1'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
43
40
|
end
|
data/lib/bobross.rb
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
1
|
+
require 'bobross/version'
|
2
|
+
require 'forgery'
|
3
|
+
require 'models/canvas_object'
|
4
|
+
require 'models/canvas_account'
|
5
|
+
require 'models/canvas_assignment_grade'
|
6
|
+
require 'models/canvas_assignment_group'
|
7
|
+
require 'models/canvas_assignment_submission'
|
8
|
+
require 'models/canvas_assignment'
|
9
|
+
require 'models/canvas_course'
|
10
|
+
require 'models/canvas_group_in_account'
|
11
|
+
require 'models/canvas_group_in_course'
|
12
|
+
require 'models/canvas_section'
|
13
|
+
require 'models/canvas_user'
|
14
|
+
require 'active_support/time'
|
15
|
+
require 'csv'
|
16
|
+
require 'net/http'
|
17
|
+
require 'uri'
|
14
18
|
|
15
19
|
module Bobross
|
16
20
|
class Error < StandardError; end
|
17
21
|
|
18
|
-
puts %q{
|
22
|
+
puts %q{
|
19
23
|
&&& && & &&
|
20
24
|
&& &\/&\|& ()|/ @, &&
|
21
25
|
&\/(/&/&||/& /_/)_&/_&
|
data/lib/bobross/version.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
class CanvasAccount < CanvasObject
|
2
|
+
|
3
|
+
attr_reader :name, :uid, :parent_uid, :root_uid, :time_zone, :sis_id, :workflow
|
4
|
+
|
5
|
+
def to_s
|
6
|
+
string = "#{name}, #{uid}, #{parent_uid}, #{root_uid}, #{time_zone}, #{sis_id}, #{workflow}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_csv
|
10
|
+
row = [uid, parent_uid, name, 'active', nil]
|
11
|
+
end
|
12
|
+
|
13
|
+
# future relase: Make fields reuired by canvas required here
|
14
|
+
def initialize(opts = {})
|
15
|
+
@name = opts[:name] if opts[:name]
|
16
|
+
@uid = opts[:uid] if opts[:uid]
|
17
|
+
@parent_id = opts[:parent] if opts[:parent]
|
18
|
+
@root_id = opts[:root] if opts[:root]
|
19
|
+
@time_zone = opts[:time_zone] if opts[:time_zone]
|
20
|
+
@sis_id = opts[:sis] if opts[:sis]
|
21
|
+
@workflow = opts[:workflow] if opts[:workflow]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.random (parent_id = 1 , root_id = 1)
|
25
|
+
a = Forgery('name').company_name
|
26
|
+
CanvasAccount.new(
|
27
|
+
{
|
28
|
+
name: a,
|
29
|
+
uid: "#{a}-#{rand(10_000)}",
|
30
|
+
parent: parent_id,
|
31
|
+
root: root_id,
|
32
|
+
time_zone: Forgery('time').zone,
|
33
|
+
sis_id: (10_000+rand(10_000_000)),
|
34
|
+
workflow: 'active'
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.gen_file(opts = {})
|
40
|
+
opts[:rows] ? rows = opts[:rows] : rows = 0
|
41
|
+
opts[:parent] ? parent = opts[:parent] : parent = 1
|
42
|
+
opts[:root] ? root = opts[:root] : root = 1
|
43
|
+
accounts = []
|
44
|
+
if(opts[:rows])
|
45
|
+
rows.times do |x|
|
46
|
+
accounts.push(CanvasAccount.random(parent, root))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
header = %w[account_id parent_account_id name status integration_id]
|
50
|
+
CSV.open('./accounts.csv', 'wb', write_headers: true, headers: header) do |csv|
|
51
|
+
accounts.each do |acc|
|
52
|
+
csv << acc.to_csv
|
53
|
+
end
|
54
|
+
end
|
55
|
+
return accounts
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class CanvasAssignment < CanvasObject
|
2
|
+
attr_reader :name, :description, :course_uid, :assignment_group
|
3
|
+
attr_accessor :due_at, :lock_at, :host_info
|
4
|
+
|
5
|
+
def to_s
|
6
|
+
string = "#{name}, #{description}, #{due_at}, #{lock_at}, #{course_uid}, #{assignment_group}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_csv
|
10
|
+
row = [name, description, due_at, lock_at, course_uid, assignment_group]
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(opts = {})
|
14
|
+
@name = opts[:name] if opts[:name]
|
15
|
+
@description = opts[:description] if opts[:description]
|
16
|
+
@due_at = opts[:due_at] if opts[:due_at]
|
17
|
+
@lock_at = opts[:lock_at] if opts[:lock_at]
|
18
|
+
@course_uid = opts[:course_uid] if opts[:course_uid]
|
19
|
+
@assignment_group = opts[:assignment_group] if opts[:assignment_group]
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.random (course = 1, group = 1)
|
23
|
+
d = Forgery('date').date
|
24
|
+
CanvasAssignment.new(
|
25
|
+
{
|
26
|
+
name: "What #{Forgery('name').job_title} #{Forgery('name').full_name} said about #{Forgery('name').industry}",
|
27
|
+
description: "#{Forgery('lorem_ipsum').paragraphs}",
|
28
|
+
due_at: d,
|
29
|
+
lock_at: d+10.days,
|
30
|
+
course_uid: course,
|
31
|
+
assignment_group: group
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.gen_file(opts = {})
|
37
|
+
course, group = 1
|
38
|
+
opts[:rows] ? rows = opts[:rows] : rows = 0
|
39
|
+
course = opts[:course] if opts[:course]
|
40
|
+
group = opts[:group] if opts[:group]
|
41
|
+
assignments = []
|
42
|
+
if(opts[:rows])
|
43
|
+
rows.times do |x|
|
44
|
+
assignments.push(CanvasAssignment.random(course, group))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
header = %w[name description due_at lock_at course_id assignment_group]
|
48
|
+
CSV.open('./assignments.csv', 'wb', write_headers: true, headers: header) do |csv|
|
49
|
+
assignments.each do |acc|
|
50
|
+
csv << acc.to_csv
|
51
|
+
end
|
52
|
+
end
|
53
|
+
return assignments
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class CanvasCourse < CanvasObject
|
2
|
+
attr_reader :name, :uid, :sis_id, :description, :account_id, :term_id, :start_date, :end_date
|
3
|
+
@@local_dictionaries = $LOAD_PATH.grep(/bobross.*lib/).first
|
4
|
+
|
5
|
+
def initialize(opts = {})
|
6
|
+
@name = opts[:name] if opts[:name]
|
7
|
+
@uid = opts[:uid] if opts[:uid]
|
8
|
+
@sis_id = "#{opts[:sis]}" if opts[:sis]
|
9
|
+
@description = opts[:desc] if opts[:desc]
|
10
|
+
@account_id = opts[:account] if opts[:account]
|
11
|
+
@term_id = opts[:term] if opts[:term]
|
12
|
+
@start_date = opts[:start] if opts[:start]
|
13
|
+
@end_date = opts[:end] if opts[:end]
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
s = "#{name}, #{uid}, #{sis_id}, #{description}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_csv
|
21
|
+
row = [sis_id, uid, name, account_id, term_id, 'active', nil, start_date, end_date, 'online', nil]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.set_prefix prefix
|
25
|
+
@@prefix = prefix
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.random
|
29
|
+
CanvasCourse.new(
|
30
|
+
{
|
31
|
+
name: CanvasCourse.course_name,
|
32
|
+
uid: CanvasCourse.course_code,
|
33
|
+
sis: (12_000+rand(1_000_000)).to_s,
|
34
|
+
desc: CanvasCourse.description
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.course_code
|
40
|
+
Forgery.load_from!(@@local_dictionaries)
|
41
|
+
dictionaries[:course_codes][@@row]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.course_name
|
45
|
+
Forgery.load_from!(@@local_dictionaries)
|
46
|
+
name_count = Forgery.dictionaries[:course_names].count
|
47
|
+
@@row = rand(name_count)
|
48
|
+
dictionaries[:course_names][@@row]
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.description
|
52
|
+
Forgery(:lorem_ipsum).words(2+rand(30))
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.gen_file(opts = {})
|
56
|
+
opts[:rows] ? rows = opts[:rows] : rows = 0
|
57
|
+
courses = []
|
58
|
+
if(opts[:rows])
|
59
|
+
rows.times do |x|
|
60
|
+
courses.push(CanvasCourse.random)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
header = %w[course_id short_name long_name account_id term_id status integration_id start_date end_date course_format blueprint_course_id]
|
64
|
+
CSV.open('./courses.csv', 'wb', write_headers: true, headers: header) do |csv|
|
65
|
+
courses.each do |acc|
|
66
|
+
csv << acc.to_csv
|
67
|
+
end
|
68
|
+
end
|
69
|
+
return courses
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CanvasObject < Forgery
|
2
|
+
|
3
|
+
def self.push_csv_to_canvas(opts={})
|
4
|
+
if(opts.nil? || opts[:host].nil? || opts[:token].nil?)
|
5
|
+
raise 'Please provide options hash with both :host and :token'
|
6
|
+
end
|
7
|
+
if(!File.file?(opts[:file]))
|
8
|
+
raise 'Please gen_file before trying to push to canvas'
|
9
|
+
end
|
10
|
+
uri = URI.parse("https://#{opts[:host]}/api/v1/accounts/self/sis_imports.json?import_type=instructure_csv")
|
11
|
+
request = Net::HTTP::Post.new(uri)
|
12
|
+
request.content_type = 'text/csv'
|
13
|
+
request['Authorization'] = "Bearer #{opts[:token]}"
|
14
|
+
request.body = ''
|
15
|
+
request.body << File.read(opts[:file])
|
16
|
+
|
17
|
+
req_options = {
|
18
|
+
use_ssl: uri.scheme == 'https',
|
19
|
+
}
|
20
|
+
|
21
|
+
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
22
|
+
http.request(request)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class CanvasSection < CanvasObject
|
2
|
+
attr_reader :name, :sis_id, :start_date, :end_date
|
3
|
+
attr_accessor :course_uid, :course_sis_id
|
4
|
+
|
5
|
+
def to_csv
|
6
|
+
row = [sis_id, course_sis_id, name, 'active', nil, start_date, end_date]
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(opts = {})
|
10
|
+
@name = opts[:name] if opts[:name]
|
11
|
+
@sis_id = opts[:sis_id] if opts[:sis_id]
|
12
|
+
@course_id = opts[:course] if opts[:course]
|
13
|
+
@start_date = opts[:start_at] if opts[:start_at]
|
14
|
+
@end_date = opts[:end_at] if opts[:end_at]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.random(course=1)
|
18
|
+
d = Forgery('date').date
|
19
|
+
CanvasSection.new(
|
20
|
+
{
|
21
|
+
name: "#{Forgery('address').country} #{Forgery('basic').color}",
|
22
|
+
sis_id: (21000+rand(1000000)),
|
23
|
+
course: course,
|
24
|
+
start_date: d,
|
25
|
+
end_date: d+90.days
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.gen_file(opts = {})
|
31
|
+
opts[:rows] ? rows = opts[:rows] : rows = 0
|
32
|
+
sections = []
|
33
|
+
if(opts[:rows])
|
34
|
+
rows.times do |x|
|
35
|
+
sections.push(CanvasSection.random)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
header = %w[section_id course_id name status integration_id start_date end_date]
|
40
|
+
CSV.open('./sections.csv', 'wb', write_headers: true, headers: header) do |csv|
|
41
|
+
sections.each do |acc|
|
42
|
+
csv << acc.to_csv
|
43
|
+
end
|
44
|
+
end
|
45
|
+
return sections
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class CanvasUser < CanvasObject
|
2
|
+
attr_reader :name, :sis_id, :login_id, :email, :time_zone
|
3
|
+
|
4
|
+
def to_s
|
5
|
+
string = "#{name}, #{sis_id}, #{login_id}, #{email}, #{time_zone}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_csv
|
9
|
+
names = name.split(' ')
|
10
|
+
row = [sis_id, nil, login_id, nil, nil, nil, names.first, names.last, name, "#{names.last}, #{names.first}", "#{names.first[0].downcase}#{names.last.downcase}", email, 'active']
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize (opts = {})
|
14
|
+
@name = opts[:name] if opts[:name]
|
15
|
+
@sis_id = opts[:sis] if opts[:sis]
|
16
|
+
@login_id = opts[:login] if opts[:login]
|
17
|
+
@email = opts[:email] if opts[:email]
|
18
|
+
@time_zone = opts[:time_zone] if opts[:time_zone]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.random (opts = {})
|
22
|
+
fn = Forgery('name').first_name
|
23
|
+
ln = Forgery('name').last_name
|
24
|
+
domain = 'instructure.com'
|
25
|
+
if opts
|
26
|
+
opts[:email_prefix] ? epre = "#{opts[:email_prefix]}+" : epre = ''
|
27
|
+
opts[:sis_prefix] ? sispre = "#{opts[:sis_prefix]}_" : sispre = ''
|
28
|
+
opts[:domain] ? domain = opts[:domain] : domain = 'instructure.com'
|
29
|
+
end
|
30
|
+
e = "#{epre}#{fn}.#{ln}@#{domain}"
|
31
|
+
CanvasUser.new(
|
32
|
+
{
|
33
|
+
name: "#{fn} #{ln}",
|
34
|
+
sis: "#{sispre}#{(3_000+rand(1_000_000))}",
|
35
|
+
login: e,
|
36
|
+
email: e,
|
37
|
+
time_zone: Forgery('time').zone
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.gen_file(opts = {})
|
43
|
+
opts[:rows] ? rows = opts[:rows] : rows = 0
|
44
|
+
opts[:settings] ? settings = opts[:settings] : settings = nil
|
45
|
+
users = []
|
46
|
+
if(opts[:rows])
|
47
|
+
rows.times do |x|
|
48
|
+
users.push(CanvasUser.random(settings))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
header = %w[user_id integration_id login_id password ssha_password authentication_provider_id first_name last_name full_name sortable_name short_name email status]
|
52
|
+
CSV.open('./users.csv', 'wb', write_headers: true, headers: header) do |csv|
|
53
|
+
users.each do |acc|
|
54
|
+
csv << acc.to_csv
|
55
|
+
end
|
56
|
+
end
|
57
|
+
return users
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bobross
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Slack
|
@@ -9,77 +9,95 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bearcat
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.4.1
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.4.1
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: bundler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
17
31
|
requirements:
|
18
32
|
- - "~>"
|
19
33
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
type: :
|
34
|
+
version: 2.1.4
|
35
|
+
type: :runtime
|
22
36
|
prerelease: false
|
23
37
|
version_requirements: !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
39
|
- - "~>"
|
26
40
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
41
|
+
version: 2.1.4
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
43
|
+
name: forgery
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
46
|
- - "~>"
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
35
|
-
type: :
|
48
|
+
version: 0.7.0
|
49
|
+
type: :runtime
|
36
50
|
prerelease: false
|
37
51
|
version_requirements: !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - "~>"
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
55
|
+
version: 0.7.0
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
57
|
+
name: rake
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - "~>"
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
-
type: :
|
62
|
+
version: 13.0.1
|
63
|
+
type: :runtime
|
50
64
|
prerelease: false
|
51
65
|
version_requirements: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
67
|
- - "~>"
|
54
68
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
69
|
+
version: 13.0.1
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
71
|
+
name: rspec
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
76
|
+
version: '3.9'
|
63
77
|
type: :development
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
83
|
+
version: '3.9'
|
70
84
|
description: Generates data to put in your canvas instance. Data can be exported as
|
71
85
|
CSV for uploading or sent directly via api call
|
72
86
|
email:
|
73
87
|
- jacobs@instructure.com
|
74
88
|
- tbyington@instructure.com
|
89
|
+
- tabyington@gmail.com
|
75
90
|
executables: []
|
76
91
|
extensions: []
|
77
92
|
extra_rdoc_files: []
|
78
93
|
files:
|
94
|
+
- ".DS_Store"
|
79
95
|
- ".gitignore"
|
80
96
|
- ".rbenv-gemsets"
|
81
97
|
- ".rspec"
|
98
|
+
- ".ruby-version"
|
82
99
|
- ".travis.yml"
|
100
|
+
- ".vscode/settings.json"
|
83
101
|
- Gemfile
|
84
102
|
- Gemfile.lock
|
85
103
|
- LICENSE.txt
|
@@ -92,16 +110,17 @@ files:
|
|
92
110
|
- lib/bobross/version.rb
|
93
111
|
- lib/dictionaries/course_codes
|
94
112
|
- lib/dictionaries/course_names
|
95
|
-
- lib/models/
|
96
|
-
- lib/models/
|
97
|
-
- lib/models/
|
98
|
-
- lib/models/
|
99
|
-
- lib/models/
|
100
|
-
- lib/models/
|
101
|
-
- lib/models/
|
102
|
-
- lib/models/
|
103
|
-
- lib/models/
|
104
|
-
- lib/models/
|
113
|
+
- lib/models/canvas_account.rb
|
114
|
+
- lib/models/canvas_assignment.rb
|
115
|
+
- lib/models/canvas_assignment_grade.rb
|
116
|
+
- lib/models/canvas_assignment_group.rb
|
117
|
+
- lib/models/canvas_assignment_submission.rb
|
118
|
+
- lib/models/canvas_course.rb
|
119
|
+
- lib/models/canvas_group_in_account.rb
|
120
|
+
- lib/models/canvas_group_in_course.rb
|
121
|
+
- lib/models/canvas_object.rb
|
122
|
+
- lib/models/canvas_section.rb
|
123
|
+
- lib/models/canvas_user.rb
|
105
124
|
homepage: https://rubygems.org/gems/bobross
|
106
125
|
licenses:
|
107
126
|
- MIT
|
@@ -124,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
143
|
- !ruby/object:Gem::Version
|
125
144
|
version: '0'
|
126
145
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
146
|
+
rubygems_version: 3.1.2
|
128
147
|
signing_key:
|
129
148
|
specification_version: 4
|
130
149
|
summary: Generates data to put in your canvas instance.
|
data/lib/models/account.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
class Account < Forgery
|
2
|
-
attr_reader :name, :uid, :parent_id, :root_id, :time_zone, :sis_id, :workflow
|
3
|
-
|
4
|
-
def to_s
|
5
|
-
string = "#{@name}, #{@uid}, #{@parent_id}, #{@root_id}, #{@time_zone}, #{@sis_id}, #{@workflow}"
|
6
|
-
end
|
7
|
-
|
8
|
-
def initialize(name, uid, parent, root, time_zone, sis, workflow)
|
9
|
-
@name = name
|
10
|
-
@uid = uid
|
11
|
-
@parent_id = parent
|
12
|
-
@root_id = root
|
13
|
-
@time_zone = time_zone
|
14
|
-
@sis_id = sis
|
15
|
-
@workflow = workflow
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.random (parent_id = 1 , root_id = 1)
|
19
|
-
a = Forgery('name').company_name
|
20
|
-
Account.new(
|
21
|
-
a,
|
22
|
-
"#{a}-#{rand(10000)}",
|
23
|
-
parent_id,
|
24
|
-
root_id,
|
25
|
-
Forgery('time').zone,
|
26
|
-
(10000+rand(10000000)),
|
27
|
-
'active')
|
28
|
-
end
|
29
|
-
end
|
data/lib/models/assignment.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
class Assignment < Forgery
|
2
|
-
attr_reader :name, :description, :due_at, :lock_at, :course_id, :assignment_group
|
3
|
-
attr_writer :due_at, :lock_at
|
4
|
-
|
5
|
-
def initialize(name, description, due_at, lock_at, course, group)
|
6
|
-
@name = name
|
7
|
-
@description = description
|
8
|
-
@due_at = due_at
|
9
|
-
@lock_at = lock_at
|
10
|
-
@course_id = course_id
|
11
|
-
@assignment_group = assignment_group
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.random (course = 1, group = 1)
|
15
|
-
d = Forgery('date').date
|
16
|
-
Assignment.new(
|
17
|
-
"What #{Forgery('name').job_title} #{Forgery('name').full_name} said about #{Forgery('name').industry}",
|
18
|
-
"#{Forgery('lorem_ipsum').paragraphs}",
|
19
|
-
d,
|
20
|
-
d+10.days,
|
21
|
-
course,
|
22
|
-
group )
|
23
|
-
end
|
24
|
-
end
|
data/lib/models/course.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
class Course < Forgery
|
2
|
-
attr_reader :name, :uid, :sis_id, :description
|
3
|
-
@@local_dictionaries = File.absolute_path("lib")
|
4
|
-
|
5
|
-
def initialize(name, uid, sis, desc)
|
6
|
-
@name = name
|
7
|
-
@uid = uid
|
8
|
-
@sis_id = sis
|
9
|
-
@description = desc
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_s
|
13
|
-
s = "#{@name}, #{@uid}, #{@sis_id}, #{@description}"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.set_prefix prefix
|
17
|
-
@@prefix = prefix
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.random
|
21
|
-
Course.new(
|
22
|
-
Course.course_name,
|
23
|
-
Course.course_code,
|
24
|
-
(12000+rand(1000000)).to_s,
|
25
|
-
Course.description
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.course_code
|
30
|
-
Forgery.load_from!(@@local_dictionaries)
|
31
|
-
dictionaries[:course_codes][@@row]
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.course_name
|
35
|
-
Forgery.load_from!(@@local_dictionaries)
|
36
|
-
name_count = Forgery.dictionaries[:course_names].count
|
37
|
-
@@row = rand(name_count)
|
38
|
-
dictionaries[:course_names][@@row]
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.description
|
42
|
-
Forgery(:lorem_ipsum).words(2+rand(30))
|
43
|
-
end
|
44
|
-
end
|
data/lib/models/section.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
class Section < Forgery
|
2
|
-
attr_reader :name, :sis_id, :course_id, :course_sis_id, :start_at, :end_at
|
3
|
-
attr_writer :course, :course_sis_id
|
4
|
-
|
5
|
-
def initialize(name, sis_id, course, start_at, end_at)
|
6
|
-
@name = name
|
7
|
-
@sis_id = sis_id
|
8
|
-
@course_id = course
|
9
|
-
@start_at = start_at
|
10
|
-
@end_at = end_at
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.random(course=1)
|
14
|
-
d = Forgery('date').date
|
15
|
-
Section.new(
|
16
|
-
"#{Forgery('address').country} #{Forgery('basic').color}",
|
17
|
-
(21000+rand(1000000)),
|
18
|
-
course,
|
19
|
-
d,
|
20
|
-
d+90.days
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
data/lib/models/user.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
class User < Forgery
|
2
|
-
attr_reader :name, :sis_id, :login_id, :email, :time_zone
|
3
|
-
|
4
|
-
def initialize (name, sis, login, email, time_zone)
|
5
|
-
@name = name
|
6
|
-
@sis_id = sis
|
7
|
-
@login_id = login
|
8
|
-
@email = email
|
9
|
-
@time_zone = time_zone
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.random
|
13
|
-
fn = Forgery('name').first_name
|
14
|
-
ln = Forgery('name').last_name
|
15
|
-
e = "tbyington+#{fn}.#{ln}@instructure.com"
|
16
|
-
User.new(
|
17
|
-
"#{fn} #{ln}",
|
18
|
-
(3000+rand(1000000)),
|
19
|
-
e,
|
20
|
-
e,
|
21
|
-
Forgery('time').zone
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|