bobross 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: 3588f5d7043a236752b70709f37b8989346ca29fbfedac927fd6a13c0295ba9c
4
- data.tar.gz: 02fcde7d1672d5f79323994d6b299b13cb9feba7241ba8319aeccdb674ed0cd3
3
+ metadata.gz: eb2cf3e5dc55a35ea9dca2f0775e1a07cbfff3bf9a32dd2383e506edbf05ef4f
4
+ data.tar.gz: b0d57f67791edbe9265797a15b1d3fce18830449aa3c0843ae1a37316e6fdb23
5
5
  SHA512:
6
- metadata.gz: b82a793cd349de4a2fc24463e2446c52996bf03b2be4e4f6fb2cf0cad84ae922933898e9b48188fb12ee50bc6b536f7128eddb35632fdab2b6903c5c39eac090
7
- data.tar.gz: f8eab3ed1480245bfe5f8c6490b4ccd8ef1fbfdf491fa290404b8d1a3ab8d1204e4a9577d8b8b0c9e37141822dbd4fad26a94e41c1c70818020374ec380b2cee
6
+ metadata.gz: a6f944ab6c635285ccc812f7a6d38dea1249433eda7c6459423d71d531f6aed1f7267f3292a9719940311b1e1c25711b041eacc00f81219b2ea013c94e3f2b92
7
+ data.tar.gz: cc7e7d9e0b20b986d9941131f9ca5e68a0733d5e5b7425ab6f14d870bb1649ad9035f2c6f6095f1c99e18214387247ae5f0f2bf941ecb2343ecab197ef97eb38
Binary file
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  bobross*gem
13
+ *.csv
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bobross (0.1.0)
4
+ bobross (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,15 +17,12 @@ GEM
17
17
  paul_walker (~> 0.1.1)
18
18
  concurrent-ruby (1.1.5)
19
19
  diff-lcs (1.3)
20
- factory_bot (4.11.1)
21
- activesupport (>= 3.0.0)
22
20
  faraday (0.15.4)
23
21
  multipart-post (>= 1.2, < 3)
24
22
  footrest (0.5.3)
25
23
  activesupport (>= 3.0.0)
26
24
  faraday (>= 0.9.0, < 1)
27
25
  link_header (>= 0.0.7)
28
- forgery (0.7.0)
29
26
  i18n (1.6.0)
30
27
  concurrent-ruby (~> 1.0)
31
28
  link_header (0.0.8)
@@ -59,8 +56,6 @@ DEPENDENCIES
59
56
  bearcat (~> 1.3.30)
60
57
  bobross!
61
58
  bundler (~> 2.0)
62
- factory_bot (~> 4.11.1)
63
- forgery (~> 0.7.0)
64
59
  rake (~> 10.0)
65
60
  rspec (~> 3.0)
66
61
 
@@ -11,6 +11,7 @@ require "models/group_in_course"
11
11
  require "models/section"
12
12
  require "models/user"
13
13
  require "active_support/time"
14
+ require "csv"
14
15
 
15
16
  module Bobross
16
17
  class Error < StandardError; end
@@ -1,3 +1,3 @@
1
1
  module Bobross
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -1,10 +1,14 @@
1
1
  class Account < Forgery
2
- attr_reader :name, :uid, :parent_id, :root_id, :time_zone, :sis_id, :workflow
2
+ attr_reader :name, :uid, :parent_uid, :root_uid, :time_zone, :sis_id, :workflow
3
3
 
4
4
  def to_s
5
- string = "#{@name}, #{@uid}, #{@parent_id}, #{@root_id}, #{@time_zone}, #{@sis_id}, #{@workflow}"
5
+ string = "#{name}, #{uid}, #{parent_uid}, #{root_uid}, #{time_zone}, #{sis_id}, #{workflow}"
6
6
  end
7
7
 
8
+ def to_csv
9
+ row = [name, uid, parent_uid, root_uid, time_zone, sis_id, workflow]
10
+ end
11
+ #future relase: Make fields reuired by canvas required here
8
12
  def initialize(opts = {})
9
13
  @name = opts[:name] if opts[:name]
10
14
  @uid = opts[:uid] if opts[:uid]
@@ -29,4 +33,24 @@ class Account < Forgery
29
33
  }
30
34
  )
31
35
  end
36
+
37
+ def self.gen_file(opts = {})
38
+ parent, root = 1
39
+ rows = 0
40
+ parent = opts[:parent] if opts[:parent]
41
+ root = opts[:root] if opts[:root]
42
+ rows = opts[:rows] if opts[:rows]
43
+ accounts = []
44
+ if(opts[:rows])
45
+ rows.times do |x|
46
+ accounts.push(Account.random(parent, root))
47
+ end
48
+ end
49
+ header = ["name", "uid", "parent_id", "root_id", "time_zone", "sis_id", "workflow"]
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
+ end
32
56
  end
@@ -1,6 +1,14 @@
1
1
  class Assignment < Forgery
2
- attr_reader :name, :description, :due_at, :lock_at, :course_id, :assignment_group
3
- attr_writer :due_at, :lock_at
2
+ attr_reader :name, :description, :course_uid, :assignment_group
3
+ attr_accessor :due_at, :lock_at
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
4
12
 
5
13
  def initialize(opts = {})
6
14
  @name = opts[:name] if opts[:name]
@@ -24,4 +32,25 @@ class Assignment < Forgery
24
32
  }
25
33
  )
26
34
  end
35
+
36
+ def self.gen_file(opts = {})
37
+ course, group = 1
38
+ rows = 0
39
+ course = opts[:course] if opts[:course]
40
+ group = opts[:group] if opts[:group]
41
+ rows = opts[:rows] if opts[:rows]
42
+ assignments = []
43
+ if(opts[:rows])
44
+ rows.times do |x|
45
+ assignments.push(Assignment.random(course, group))
46
+ end
47
+ end
48
+ header = ["name", "description", "due_at", "lock_at", "course_id", "assignment_group"]
49
+ CSV.open("./assignments.csv", "wb", write_headers: true, headers: header) do |csv|
50
+ assignments.each do |acc|
51
+ csv << acc.to_csv
52
+ end
53
+ end
54
+ end
55
+
27
56
  end
@@ -10,7 +10,11 @@ class Course < Forgery
10
10
  end
11
11
 
12
12
  def to_s
13
- s = "#{@name}, #{@uid}, #{@sis_id}, #{@description}"
13
+ s = "#{name}, #{uid}, #{sis_id}, #{description}"
14
+ end
15
+
16
+ def to_csv
17
+ row = [name, uid, sis_id, description]
14
18
  end
15
19
 
16
20
  def self.set_prefix prefix
@@ -43,4 +47,21 @@ class Course < Forgery
43
47
  def self.description
44
48
  Forgery(:lorem_ipsum).words(2+rand(30))
45
49
  end
50
+
51
+ def self.gen_file(opts = {})
52
+ rows = 0
53
+ rows = opts[:rows] if opts[:rows]
54
+ courses = []
55
+ if(opts[:rows])
56
+ rows.times do |x|
57
+ courses.push(Course.random)
58
+ end
59
+ end
60
+ header = ["name", "uid", "sis_id", "description"]
61
+ CSV.open("./courses.csv", "wb", write_headers: true, headers: header) do |csv|
62
+ courses.each do |acc|
63
+ csv << acc.to_csv
64
+ end
65
+ end
66
+ end
46
67
  end
@@ -1,6 +1,6 @@
1
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
2
+ attr_reader :name, :sis_id, :start_at, :end_at
3
+ attr_accessor :course_uid, :course_sis_id
4
4
 
5
5
  def initialize(opts = {})
6
6
  @name = opts[:name] if opts[:name]
@@ -1,6 +1,14 @@
1
1
  class User < Forgery
2
2
  attr_reader :name, :sis_id, :login_id, :email, :time_zone
3
3
 
4
+ def to_s
5
+ string = "#{name}, #{sis_id}, #{login_id}, #{email}, #{time_zone}"
6
+ end
7
+
8
+ def to_csv
9
+ row = [name, sis_id, login_id, email, time_zone]
10
+ end
11
+
4
12
  def initialize (opts = {})
5
13
  @name = opts[:name] if opts[:name]
6
14
  @sis_id = opts[:sis] if opts[:sis]
@@ -23,4 +31,21 @@ class User < Forgery
23
31
  }
24
32
  )
25
33
  end
34
+
35
+ def self.gen_file(opts = {})
36
+ rows = 0
37
+ rows = opts[:rows] if opts[:rows]
38
+ users = []
39
+ if(opts[:rows])
40
+ rows.times do |x|
41
+ users.push(User.random)
42
+ end
43
+ end
44
+ header = ["name", "sis_id", "login_id", "email", "time_zone"]
45
+ CSV.open("./users.csv", "wb", write_headers: true, headers: header) do |csv|
46
+ users.each do |acc|
47
+ csv << acc.to_csv
48
+ end
49
+ end
50
+ end
26
51
  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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Slack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-06-28 00:00:00.000000000 Z
12
+ date: 2019-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -77,6 +77,7 @@ executables: []
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
+ - ".DS_Store"
80
81
  - ".gitignore"
81
82
  - ".rbenv-gemsets"
82
83
  - ".rspec"