japanda 0.1.1 → 0.1.6

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
- SHA1:
3
- metadata.gz: abbd951e967108454451a2dead9d17e93c1c2ba7
4
- data.tar.gz: a2c8ee97e2f6ac89b5374365008609639600026f
2
+ SHA256:
3
+ metadata.gz: a8acb3a2a4f8a67997e25b5514be451f76dc2b6efaeb820b81d58384c773ef34
4
+ data.tar.gz: 82a46cfe03d449b9c308ce7606524a20c5e98712dea1d9bb67fb3e53786e8bd6
5
5
  SHA512:
6
- metadata.gz: 7dcce860b5fede22513b30ff8fb051b249a797d8b0bb2e2b03ac53c0350d34abc7aa11f700ab7ade14414f568e07bbe13a1300e8d0b904af508cbba9b5536e5d
7
- data.tar.gz: 6318804d2b3153d09bd9077d910be80e11e9b96644d498e3dd18e0aaf07b2d650e923ef5044c4b04e9f0e94ebb3d230f4f0325c0e604b285fedfeed2d789edcb
6
+ metadata.gz: 00e3b3e50ce617851288635346953a729df02fc76f5026b9eabbbdccf7710d0c667d15b25733070437eced81b8f36bff63aaf80708368331be3525bfd72aa7e2
7
+ data.tar.gz: 84e487cf7c6f2da50af89266551992ba869b5d119a63848eafcebbc3d63b671dd469e570d4be8a960129fbd2af819d321b2c0e97422233cff05002dfa58ceb4b
@@ -0,0 +1,4 @@
1
+ # canvas
2
+ CANVAS_API_HOST=<your canvas host>
3
+ CANVAS_API_TOKEN=<your canvas token>
4
+ CANVAS_ACCOUNT_ID=<your canvas account id>
data/.gitignore CHANGED
@@ -1,10 +1,10 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
- /.env/
8
+ .env
10
9
  /tmp/
10
+ *.iml
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
+ --format RspecJunitFormatter
2
+ --out junit/rspec.xml
1
3
  --format documentation
2
4
  --color
@@ -0,0 +1 @@
1
+ 2.5.0
@@ -0,0 +1,9 @@
1
+ FROM instructure/ruby:2.5
2
+
3
+ ENV APP_HOME /usr/src/app
4
+
5
+ COPY --chown=docker:docker . $APP_HOME
6
+
7
+ RUN bundle install --quiet --jobs 8
8
+
9
+
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ japanda (0.1.6)
5
+ rest-client (>= 2.1.0)
6
+ rspec_junit_formatter (~> 0.4.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ byebug (11.1.3)
12
+ diff-lcs (1.4.4)
13
+ domain_name (0.5.20190701)
14
+ unf (>= 0.0.5, < 1.0.0)
15
+ dotenv (2.0.2)
16
+ hashie (4.0.0)
17
+ http-accept (1.7.0)
18
+ http-cookie (1.0.3)
19
+ domain_name (~> 0.5)
20
+ mime-types (3.3.1)
21
+ mime-types-data (~> 3.2015)
22
+ mime-types-data (3.2020.1104)
23
+ netrc (0.11.0)
24
+ rake (10.4.2)
25
+ rest-client (2.1.0)
26
+ http-accept (>= 1.7.0, < 2.0)
27
+ http-cookie (>= 1.0.2, < 2.0)
28
+ mime-types (>= 1.16, < 4.0)
29
+ netrc (~> 0.8)
30
+ rspec (3.5.0)
31
+ rspec-core (~> 3.5.0)
32
+ rspec-expectations (~> 3.5.0)
33
+ rspec-mocks (~> 3.5.0)
34
+ rspec-core (3.5.4)
35
+ rspec-support (~> 3.5.0)
36
+ rspec-expectations (3.5.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.5.0)
39
+ rspec-mocks (3.5.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.5.0)
42
+ rspec-support (3.5.0)
43
+ rspec_junit_formatter (0.4.1)
44
+ rspec-core (>= 2, < 4, != 2.12.0)
45
+ unf (0.1.4)
46
+ unf_ext
47
+ unf_ext (0.0.7.7)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ bundler (~> 1.5)
54
+ byebug
55
+ dotenv
56
+ hashie (~> 4.0.0)
57
+ japanda!
58
+ rake
59
+ rspec (~> 3.5.0)
60
+
61
+ BUNDLED WITH
62
+ 1.17.3
@@ -0,0 +1,64 @@
1
+ #! /usr/bin/env groovy
2
+
3
+ String rspec_results = ''
4
+ String container_id = ''
5
+
6
+ pipeline {
7
+ agent { label 'docker' }
8
+
9
+ environment {
10
+ COMPOSE_PROJECT_NAME = 'japanda_build'
11
+ COMPOSE_FILE = 'docker-compose.yml'
12
+ }
13
+
14
+ options {
15
+ ansiColor("xterm")
16
+ }
17
+
18
+ stages {
19
+ stage('Build') {
20
+ steps {
21
+ echo 'Building the containers'
22
+ sh "docker-compose build --pull"
23
+
24
+ echo 'Starting containers'
25
+ sh "docker-compose up -d"
26
+ sh 'docker-compose run --no-deps -d testrunner tail -f /dev/null'
27
+
28
+ script {
29
+ sh "docker ps"
30
+ container_id = sh(script: "docker ps -qf 'name=testrunner'",
31
+ returnStdout: true
32
+ ).trim()
33
+ }
34
+ }
35
+
36
+ }
37
+
38
+ stage('Run Rspec Tests') {
39
+ steps {
40
+ sh "docker exec $container_id bundle exec rspec spec/ >> rspec_results"
41
+ }
42
+ }
43
+ }
44
+
45
+ post {
46
+ always {
47
+ script {
48
+ rspec_results = sh(script: 'cat rspec_results',
49
+ returnStdout: true
50
+ ).trim()
51
+
52
+ sh "docker cp $container_id:/usr/src/app/junit ."
53
+ junit allowEmptyResults: true, testResults: 'junit/rspec.xml'
54
+ }
55
+ echo rspec_results
56
+ }
57
+
58
+ cleanup {
59
+ sh 'if [ -d "junit" ]; then rm -r "junit"; fi'
60
+ sh 'if [ -f "rspec_results" ]; then rm -rf "rspec_results"; fi'
61
+ sh "docker-compose down --remove-orphans --rmi=all --volumes"
62
+ }
63
+ }
64
+ }
data/README.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # Japanda
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/japanda`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Japanda provides an object-oriented and a functional wrapper around Instructure Canvas Api's
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Disclaimer: For testing purposes only.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
- ```ruby
12
- gem 'japanda'
13
- ```
11
+ gem 'japanda'
14
12
 
15
13
  And then execute:
16
14
 
@@ -21,28 +19,70 @@ Or install it yourself as:
21
19
  $ gem install japanda
22
20
 
23
21
  ## Usage
24
- Set a few enviroment variables:
25
-
26
- ```ruby
27
- export CANVAS_API_HOST=
28
- export CANVAS_API_TOKEN=
29
- export CANVAS_ACCOUNT_ID=
30
- export GALLERY_API_HOST=
31
- export GALLERY_API_TOKEN=
32
- ```
22
+
23
+ Set a few enviroment variables( or use .env.example file)
24
+
25
+ export CANVAS_API_HOST=
26
+ export CANVAS_API_TOKEN=
27
+ export CANVAS_ACCOUNT_ID=
28
+
29
+ To create a new course
30
+
31
+ CanvasFactory::Course.new
32
+
33
+ To create a new course by providing a custom hash(merge)
34
+
35
+ opts = { course:{ name: 'coursename1', course_code: "code-change#{SecureRandom.hex}" } }
36
+ course = CanvasFactory::Course.new(opts)
37
+
38
+ To create a new course by providing a custom hash(no merge)
39
+
40
+ opts = {
41
+ account_id: '10',
42
+ course: {
43
+ name: "code-name#{SecureRandom.hex}",
44
+ course_code: "course_code#{SecureRandom.hex}"
45
+ },
46
+ offer: true
47
+ }
48
+ course = CanvasFactory::Course.new(opts, false)
33
49
 
34
50
  ## Development
35
51
 
36
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec` to run the tests.
53
+ To install this gem onto your local machine, run `bundle exec rake install`.
54
+
55
+ ### Run in docker
56
+
57
+ Make sure your .env variable contains
58
+ ```
59
+ CANVAS_API_HOST=<canvas_host>
60
+ CANVAS_API_TOKEN=<canvas_api_token>
61
+ CANVAS_ACCOUNT_ID=<canvas_account_id>
62
+ ```
63
+
64
+ Building the testrunner
65
+ ```
66
+ docker-compose build
67
+ ```
68
+
69
+ Running the tests:
70
+ ```
71
+ docker-compose run testrunner bundle exec rspec spec/
72
+ ```
73
+
74
+ ## Release a new version
75
+
76
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
77
 
38
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
78
 
40
79
  ## Contributing
41
80
 
42
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/japanda. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
81
+ Bug reports and pull requests are welcome on GitHub at https://github.com/babababili/japanda. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
43
82
 
44
83
 
45
84
  ## License
46
85
 
47
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
86
+ For testing purposes only.
48
87
 
88
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,11 @@
1
+ version: '2.0'
2
+
3
+ services:
4
+ testrunner:
5
+ build:
6
+ context: .
7
+ dockerfile: Dockerfile
8
+ environment:
9
+ CANVAS_API_HOST: ${CANVAS_API_HOST}
10
+ CANVAS_API_TOKEN: ${CANVAS_API_TOKEN}
11
+ CANVAS_ACCOUNT_ID: ${CANVAS_ACCOUNT_ID}
@@ -4,36 +4,36 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'japanda/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "japanda"
7
+ spec.name = 'japanda'
8
8
  spec.version = Japanda::VERSION
9
- spec.authors = ["Santosh Natarajan"]
10
- spec.email = ["snatarajan@instructure.com"]
9
+ spec.authors = ['Santosh Natarajan', 'Robert Lamb']
10
+ spec.email = ['snatarajan@instructure.com', 'rlamb@instructure.com']
11
11
 
12
- spec.summary = %q{Library to create custom course, catalog.}
13
- spec.description = %q{Library to create custom course, catalog.}
14
- spec.homepage = "https://github.com/babababili/japanda"
15
- spec.license = "MIT"
12
+ spec.summary = %q{Library to create custom course.}
13
+ spec.description = %q{Library to create custom course. wip.}
14
+ # spec.homepage = 'https://github.com/babababili/japanda'
15
+ # spec.license = 'MIT'
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
18
  # delete this section to allow pushing this gem to any host.
19
19
  # if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ # spec.metadata['allowed_push_host'] = 'TODO: Set to 'http://mygemserver.com''
21
21
  # else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ # raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
23
23
  # end
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
26
+ spec.bindir = 'exe'
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.10.5"
31
- spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency "rspec"
33
- # spec.add_development_dependency "rest-client"
34
- # spec.add_development_dependency "deep_merge"
35
- spec.add_dependency "deep_merge"
36
- spec.add_dependency "rest-client"
37
- spec.add_dependency "dotenv"
30
+ spec.add_development_dependency 'bundler', '~>1.5'
31
+ spec.add_development_dependency 'byebug'
32
+ spec.add_development_dependency 'dotenv'
33
+ spec.add_development_dependency 'hashie', '~>4.0.0'
34
+ spec.add_development_dependency 'rake'
35
+ spec.add_development_dependency 'rspec', '~> 3.5.0'
36
+ spec.add_dependency 'rest-client', '>= 2.1.0'
37
+ spec.add_dependency 'rspec_junit_formatter', '~>0.4.1'
38
38
 
39
39
  end
@@ -1,5 +1,8 @@
1
1
  require 'japanda/version'
2
2
  require 'securerandom'
3
+ require 'rest-client'
4
+ require 'json'
5
+ require 'byebug'
3
6
 
4
7
  module Japanda
5
8
  end
@@ -1,4 +1,5 @@
1
1
  require 'dotenv'
2
+
2
3
  module CanvasFactory
3
4
  Dotenv.load
4
5
  CANVAS_API_V1 ||= "#{ENV['CANVAS_API_HOST']}/api/v1"
@@ -7,4 +8,17 @@ module CanvasFactory
7
8
  content_type: 'application/json'
8
9
  }
9
10
  CANVAS_ACCOUNT_ID ||= ENV['CANVAS_ACCOUNT_ID']
11
+
12
+ # JSON.generate see: https://github.com/rest-client/rest-client/issues/635/
13
+ def self.perform_post(end_point, body)
14
+ JSON.parse(RestClient.post end_point, JSON.generate(body), CANVAS_AUTH_HEADER)
15
+ end
16
+
17
+ def self.perform_put(end_point, body)
18
+ JSON.parse(RestClient.put end_point, JSON.generate(body), CANVAS_AUTH_HEADER)
19
+ end
20
+
21
+ def self.perform_delete(end_point)
22
+ JSON.parse(RestClient.delete end_point, CANVAS_AUTH_HEADER)
23
+ end
10
24
  end
@@ -1,19 +1,14 @@
1
- # assignment class
2
1
  module CanvasFactory
2
+ # assignment class
3
3
  class Assignment
4
- attr_reader :assignments
4
+ attr_reader :id, :name, :course_id, :html_url, :grading_type, :published, :due_at,
5
+ :created_at, :request, :response
5
6
 
6
- def add_assignments(opts)
7
- @assignments = []
8
- opts[:module][:assignment][:size].times do |i|
9
- @assignments << add_assignment(opts, i)
10
- end
11
- end
12
-
13
- def add_assignment(opts, i)
14
- body = {
7
+ def initialize(course_id, opts = {}, merge = true)
8
+ @course_id = course_id
9
+ @request = {
15
10
  assignment: {
16
- name: "Assignment-#{i}-#{Time.now.to_i}",
11
+ name: "Assignment-#{Time.now.to_i}",
17
12
  grading_type: %w(pass_fail percent letter_grade gpa_scale points).sample,
18
13
  submission_types: ['online_text_entry'],
19
14
  points_possible: 10,
@@ -21,11 +16,23 @@ module CanvasFactory
21
16
  published: true
22
17
  }
23
18
  }
24
- body.deep_merge!(opts[:assignment_options]) unless opts[:assignment_options].nil?
19
+ @request = Mergie.deep_merge(@request, opts, merge)
20
+ create_assignment
21
+ self
22
+ end
23
+
24
+ private
25
25
 
26
- assign_end_point = "#{CANVAS_API_V1}/courses/#{opts[:course_id]}/assignments"
27
- response = RestClient.post assign_end_point, body, CANVAS_AUTH_HEADER
28
- JSON.parse(response)
26
+ def create_assignment
27
+ assign_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}/assignments"
28
+ @response = CanvasFactory.perform_post(assign_end_point, @request)
29
+ @id = response['id']
30
+ @name = response['name']
31
+ @html_url = response['html_url']
32
+ @grading_type = response['grading_type']
33
+ @published = response['published']
34
+ @created_at = response['created_at']
35
+ @due_at = response['due_at']
29
36
  end
30
37
  end
31
38
  end
@@ -1,18 +1,83 @@
1
- # canvas course class
2
1
  module CanvasFactory
2
+ # canvas course class
3
3
  class Course
4
- attr_reader :course_response, :course_id, :course_config, :course_code, :course_name
4
+ attr_reader :course_response, :course_id, :course_code, :course_name, :course_request,
5
+ :sections, :modules, :assignments, :quizzes
5
6
 
6
- def initialize(course_config = nil)
7
- @course_config = course_config
8
- @course_config = CanvasFactory::CourseConfig.new if course_config.nil?
7
+ def initialize(opts = {}, merge = true)
8
+ @sections = []
9
+ @modules = []
10
+ @assignments = []
11
+ @quizzes = []
12
+ course_name_code = "auto#{SecureRandom.hex}"
13
+ @course_request = {
14
+ account_id: CANVAS_ACCOUNT_ID,
15
+ course: {
16
+ name: course_name_code,
17
+ course_code: course_name_code,
18
+ start_at: Time.now,
19
+ end_at: Time.now + (30 * 24 * 60 * 60),
20
+ license: 'public_domain',
21
+ is_public: true,
22
+ is_public_to_auth_users: false,
23
+ public_syllabus: false,
24
+ public_description: 'api created course',
25
+ allow_student_wiki_edits: true,
26
+ allow_wiki_comments: true,
27
+ allow_student_forum_attachments: true,
28
+ open_enrollment: true,
29
+ self_enrollment: false,
30
+ restrict_enrollments_to_course_dates: false,
31
+ term_id: nil,
32
+ # sis_course_id: '', # field is included only when user has permission to view SIS information
33
+ # integration_id: '', # field is included only when user has permission to view SIS information
34
+ hide_final_grades: true,
35
+ apply_assignment_group_weights: false,
36
+ syllabus_body: 'api syllabus',
37
+ grading_standard_id: nil,
38
+ course_format: 'online'
39
+ },
40
+ offer: true,
41
+ enroll_me: false,
42
+ enable_sis_reactivation: false
43
+ }
44
+ @course_request = Mergie.deep_merge(@course_request, opts, merge)
45
+ create_course
9
46
  end
10
47
 
11
- def create
12
- @course_config.set_course_request
13
- course_end_point = "#{CANVAS_API_V1}/accounts/#{@course_config.account_id}/courses"
14
- response = RestClient.post course_end_point, @course_config.course_request, CANVAS_AUTH_HEADER
15
- @course_response = JSON.parse(response)
48
+ def add_section(opts = {}, merge = true)
49
+ section = CanvasFactory::Section.new(@course_id, opts, merge)
50
+ @sections << section
51
+ end
52
+
53
+ def add_module(opts = {}, merge = true)
54
+ mod = CanvasFactory::Module.new(@course_id, opts, merge)
55
+ @modules << mod
56
+ mod
57
+ end
58
+
59
+ def add_assignment(opts = {}, merge = true)
60
+ assignment = CanvasFactory::Assignment.new(@course_id, opts, merge)
61
+ @assignments << assignment
62
+ assignment
63
+ end
64
+
65
+ def add_quiz(opts = {}, merge = true)
66
+ quiz = CanvasFactory::Quiz.new(@course_id, opts, merge)
67
+ @quizzes << quiz
68
+ quiz
69
+ end
70
+
71
+ def delete_course
72
+ delete_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}?event=delete"
73
+ CanvasFactory.perform_delete(delete_end_point)
74
+ end
75
+
76
+ private
77
+
78
+ def create_course
79
+ course_end_point = "#{CANVAS_API_V1}/accounts/#{@course_request[:account_id]}/courses"
80
+ @course_response = CanvasFactory.perform_post(course_end_point, @course_request)
16
81
  @course_id = @course_response['id']
17
82
  @course_name = @course_response['name']
18
83
  @course_code = @course_response['course_code']
@@ -0,0 +1,10 @@
1
+ require 'hashie/extensions/deep_merge'
2
+ module CanvasFactory
3
+ class Mergie < Hash
4
+ include Hashie::Extensions::DeepMerge
5
+
6
+ def self.deep_merge(default_hash, given_hash, should_merge)
7
+ should_merge ? Mergie[default_hash].deep_merge(Mergie[given_hash]).to_h: given_hash
8
+ end
9
+ end
10
+ end
@@ -1,46 +1,51 @@
1
- # canvas module class
2
1
  module CanvasFactory
2
+ # canvas module class
3
3
  class Module
4
- attr_reader :modules
4
+ attr_reader :course_id, :name, :module_id, :published, :request, :response,
5
+ :module_items, :publish_response, :publish_request
5
6
 
6
- def create_modules(opts)
7
- @modules = []
8
- opts[:module][:size].times do
9
- @modules << create_module_add_item_publish(opts)
10
- end
11
- @modules
12
- end
13
-
14
- def create_module_add_item_publish(opts)
15
- body = {
7
+ def initialize(course_id, opts = {}, merge = true)
8
+ @module_items = []
9
+ @course_id = course_id
10
+ @request = {
16
11
  module: {
17
- name: "Course-Module-#{Time.now.to_i}",
12
+ name: "module-#{Time.now.to_i}",
18
13
  unlock_at: DateTime.now.iso8601,
19
14
  require_sequential_progress: true
20
15
  }
21
16
  }
22
- body.deep_merge!(opts[:module_options]) unless opts[:module_options].nil?
23
-
24
- m_item_end_point = "#{CANVAS_API_V1}/courses/#{opts[:course_id]}/modules"
25
- response = RestClient.post m_item_end_point, body, CANVAS_AUTH_HEADER
26
- m = JSON.parse(response)
27
-
28
- mi = CanvasFactory::ModuleItem.new
29
- mi.add_module_items(m['id'], opts)
17
+ @request = Mergie.deep_merge(@request, opts, merge)
18
+ create_module
19
+ self
20
+ end
30
21
 
31
- update_module opts[:course_id], m['id']
32
- { module: m, module_items: mi.module_items }
22
+ def add_module_item(content, opts = {}, merge = true) # content can be assignment or quiz ...
23
+ module_item = CanvasFactory::ModuleItem.new(@course_id, @module_id, content, opts, merge)
24
+ @module_items << module_item
25
+ module_item
33
26
  end
34
27
 
35
- def update_module(course_id, module_id)
36
- body = {
28
+ def publish(opts = {}, merge = true)
29
+ @publish_request = {
37
30
  module: {
38
31
  published: true
39
32
  }
40
33
  }
41
- m_p_end_point = "#{CANVAS_API_V1}/courses/#{course_id}/modules/#{module_id}"
42
- response = RestClient.put m_p_end_point, body, CANVAS_AUTH_HEADER
43
- JSON.parse(response)
34
+ @publish_request = Mergie.deep_merge(@publish_request, opts, merge)
35
+ publish_ep = "#{CANVAS_API_V1}/courses/#{@course_id}/modules/#{@module_id}"
36
+ @publish_response = CanvasFactory.perform_put(publish_ep, @publish_request)
37
+ @published = @publish_response['published']
38
+ end
39
+
40
+ private
41
+
42
+ def create_module
43
+ m_item_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}/modules"
44
+ @response = CanvasFactory.perform_post(m_item_end_point, @request)
45
+ @course_id = course_id
46
+ @module_id = response['id']
47
+ @name = response['name']
48
+ @published = response['published']
44
49
  end
45
50
  end
46
51
  end
@@ -1,31 +1,37 @@
1
- # canvas module_item class
2
1
  module CanvasFactory
2
+ # module item class
3
3
  class ModuleItem
4
- attr_reader :module_items
4
+ attr_reader :item_id, :name, :course_id, :html_url, :title, :published, :type,
5
+ :created_at, :request, :response, :module_id
5
6
 
6
- def add_module_items(module_id, opts)
7
- @module_items = []
8
- aa = CanvasFactory::Assignment.new
9
- aa.add_assignments(opts)
10
- aa.assignments.each do |a|
11
- @module_items << add_module_item(module_id, 'Assignment', a['id'], opts)
12
- end
13
- end
14
-
15
- def add_module_item(m_id, module_item_type, item_content_id, opts)
16
- body = {
7
+ def initialize(course_id, module_id, content, opts = {}, merge = true)
8
+ @course_id = course_id
9
+ @module_id = module_id
10
+ @request = {
17
11
  module_item: {
18
- title: "mod-#{module_item_type}-#{item_content_id}",
19
- type: module_item_type,
20
- content_id: item_content_id,
12
+ title: "module-item#{SecureRandom.hex}",
13
+ type: content.class.name.split('::').last || '',
14
+ content_id: content.id,
21
15
  completion_requirement: {
22
16
  type: 'must_view'
23
17
  }
24
18
  }
25
19
  }
26
- m_i = "#{CANVAS_API_V1}/courses/#{opts[:course_id]}/modules/#{m_id}/items"
27
- response = RestClient.post m_i, body, CANVAS_AUTH_HEADER
28
- JSON.parse(response)
20
+ @request = Mergie.deep_merge(@request, opts, merge)
21
+ create_item
22
+ self
23
+ end
24
+
25
+ private
26
+
27
+ def create_item
28
+ item_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}/modules/#{@module_id}/items"
29
+ @response = CanvasFactory.perform_post(item_end_point, @request)
30
+ @published = response['published']
31
+ @item_id = response['id']
32
+ @type = response['type']
33
+ @title = response['title']
34
+ @html_url = response['html_url']
29
35
  end
30
36
  end
31
37
  end
@@ -0,0 +1,52 @@
1
+ module CanvasFactory
2
+ # Quiz class
3
+ class Quiz
4
+ attr_reader :id, :course_id, :html_url, :published, :due_at, :title,
5
+ :request, :response
6
+
7
+ def initialize(course_id, opts = {}, merge = true)
8
+ @course_id = course_id
9
+ @request = {
10
+ quiz: {
11
+ title: "quiz-#{Time.now.to_i}",
12
+ description: 'api created quiz',
13
+ quiz_type: %w(practice_quiz assignment graded_survey survey).sample,
14
+ assignment_group_id: nil,
15
+ time_limit: nil,
16
+ shuffle_answers: true,
17
+ hide_results: %w(always until_after_last_attempt).sample,
18
+ show_correct_answers: true,
19
+ show_correct_answers_last_attempt: true,
20
+ hide_correct_answers_at: true,
21
+ allowed_attempts: 1,
22
+ scoring_policy: %w(keep_highest keep_latest).sample,
23
+ one_question_at_a_time: false,
24
+ cant_go_back: false,
25
+ access_code: nil,
26
+ ip_filter: nil,
27
+ due_at: (DateTime.now + 10).iso8601,
28
+ lock_at: (DateTime.now + 10).iso8601,
29
+ unlock_at: (DateTime.now).iso8601,
30
+ published: true,
31
+ one_time_results: false
32
+ }
33
+ }
34
+ @request = Mergie.deep_merge(@request, opts, merge)
35
+ create_quiz
36
+ self
37
+ end
38
+
39
+ private
40
+
41
+ def create_quiz
42
+ quiz_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}/quizzes"
43
+ @response = CanvasFactory.perform_post(quiz_end_point, @request)
44
+ @id = response['id']
45
+ @title = response['title']
46
+ @html_url = response['html_url']
47
+ @published = response['published']
48
+ @due_at = response['due_at']
49
+ end
50
+ end
51
+ end
52
+
@@ -1,22 +1,36 @@
1
- # canvas section class
2
1
  module CanvasFactory
2
+ # canvas section class
3
3
  class Section
4
- attr_reader :sections
4
+ attr_reader :course_id, :id, :end_at, :start_at, :name, :sis_section_id, :sis_course_id,
5
+ :integration_id, :sis_import_id, :nonxlist_course_id, :request, :response
5
6
 
6
- def create_multiple_sections(opts)
7
- @sections = []
8
- opts[:section][:size].times do |i|
9
- body = {
10
- course_section: {
11
- name: "section-#{i}-#{Time.now.to_i}"
12
- }
7
+ def initialize(course_id, opts = {}, merge = true)
8
+ @course_id = course_id
9
+ @request = {
10
+ course_section: {
11
+ name: "section-#{Time.now.to_i}",
12
+ start_at: Time.now,
13
+ end_at: Time.now + (30 * 24 * 60 * 60),
14
+ restrict_enrollments_to_section_dates: false,
15
+ # enable_sis_reactivation: false,
16
+ # sis_section_id: nil
13
17
  }
18
+ }
19
+ @request = Mergie.deep_merge(@request, opts, merge)
20
+ create_section
21
+ self
22
+ end
23
+
24
+ private
14
25
 
15
- body.deep_merge!(opts[:section_options]) unless opts[:section_options].nil?
16
- section_end_point = "#{CANVAS_API_V1}/courses/#{opts[:course_id]}/sections"
17
- response = RestClient.post section_end_point, body, CANVAS_AUTH_HEADER
18
- @sections << JSON.parse(response)
19
- end
26
+ def create_section
27
+ section_end_point = "#{CANVAS_API_V1}/courses/#{@course_id}/sections"
28
+ @response = CanvasFactory.perform_post(section_end_point, @request)
29
+ @course_id = response['course_id']
30
+ @id = response['id']
31
+ @name = response['name']
32
+ @end_at = response['end_at']
33
+ @start_at = response['start_at']
20
34
  end
21
35
  end
22
36
  end
@@ -1,31 +1,67 @@
1
- # canvas user class
2
1
  module CanvasFactory
2
+ # canvas user class
3
3
  class User
4
- attr_reader :user_response, :user_response_id, :user_response_email_id, :user_short_name, :user_password
4
+ attr_reader :learner_request, :user_response, :id, :admin_request,
5
+ :email_id, :short_name, :password
5
6
 
6
- def initialize(user_config = nil)
7
- @user_config = user_config
8
- @user_config = CanvasFactory::UserConfig.new if user_config.nil?
7
+ def initialize(opts = {}, merge = true)
8
+ unique_email = "#{@email_prefix}#{SecureRandom.hex}@example.com"
9
+ @learner_request = {
10
+ user: {
11
+ name: unique_email,
12
+ short_name: 'auto user',
13
+ terms_of_use: '1',
14
+ send_confirmation: true
15
+ },
16
+ pseudonym: {
17
+ unique_id: unique_email,
18
+ password: 'Testing01'
19
+ },
20
+ force_validations: true
21
+ }
22
+ @learner_request = Mergie.deep_merge(@learner_request, opts, merge)
23
+ create_learner_user
24
+ end
25
+
26
+ def delete_user
27
+ user_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/users/#{@id}"
28
+ @user_response = CanvasFactory.perform_delete(user_end_point)
9
29
  end
10
30
 
31
+ private
32
+
11
33
  def create_learner_user
12
- @user_config.set_up_user_hash
13
- body = @user_config.config_user_hash
14
34
  user_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/users"
15
- response = RestClient.post user_end_point, body, CANVAS_AUTH_HEADER
16
- @user_response = JSON.parse(response)
17
- @user_response_id = @user_response['id']
18
- @user_response_email_id = @user_response['login_id']
19
- @user_short_name = @user_config.short_name
20
- @user_password = @user_config.password
35
+ @user_response = CanvasFactory.perform_post(user_end_point, @learner_request)
36
+ @id = @user_response['id']
37
+ @email_id = @user_response['login_id']
38
+ @short_name = @user_response['short_name']
39
+ @password = @learner_request[:pseudonym][:password]
40
+ @user_response
21
41
  end
42
+ end
22
43
 
23
- def create_admin_user
24
- create_learner_user
25
- @user_config.set_up_admin_hash(@user_response['id'].to_i)
26
- body = @user_config.config_admin_hash
27
- a_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/admins"
28
- RestClient.post a_end_point, body, CANVAS_AUTH_HEADER
44
+ # canvas admin user class
45
+ class AdminUser < User
46
+ def initialize(opts = {}, merge = true)
47
+ super(opts, merge)
48
+ make_admin_user
49
+ end
50
+
51
+ private
52
+
53
+ def make_admin_user
54
+ @admin_request = {
55
+ user_id: @id,
56
+ role_id: 'AccountAdmin',
57
+ send_confirmation: true
58
+ }
59
+ admin_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/admins"
60
+ @admin_response = CanvasFactory.perform_post(admin_end_point, @admin_request)
61
+ @id = @admin_response['user']['id']
62
+ @email_id = @admin_response['user']['login_id']
63
+ @short_name = @admin_response['user']['short_name']
64
+ @admin_response
29
65
  end
30
66
  end
31
67
  end
@@ -1,3 +1,3 @@
1
1
  module Japanda
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japanda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Santosh Natarajan
8
- autorequire:
8
+ - Robert Lamb
9
+ autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
12
+ date: 2021-01-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -16,30 +17,30 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: 1.10.5
20
+ version: '1.5'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: 1.10.5
27
+ version: '1.5'
27
28
  - !ruby/object:Gem::Dependency
28
- name: rake
29
+ name: byebug
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - "~>"
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
- version: '10.0'
34
+ version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - "~>"
39
+ - - ">="
39
40
  - !ruby/object:Gem::Version
40
- version: '10.0'
41
+ version: '0'
41
42
  - !ruby/object:Gem::Dependency
42
- name: rspec
43
+ name: dotenv
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - ">="
@@ -53,83 +54,114 @@ dependencies:
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  - !ruby/object:Gem::Dependency
56
- name: deep_merge
57
+ name: hashie
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 4.0.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 4.0.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
57
72
  requirement: !ruby/object:Gem::Requirement
58
73
  requirements:
59
74
  - - ">="
60
75
  - !ruby/object:Gem::Version
61
76
  version: '0'
62
- type: :runtime
77
+ type: :development
63
78
  prerelease: false
64
79
  version_requirements: !ruby/object:Gem::Requirement
65
80
  requirements:
66
81
  - - ">="
67
82
  - !ruby/object:Gem::Version
68
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 3.5.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 3.5.0
69
98
  - !ruby/object:Gem::Dependency
70
99
  name: rest-client
71
100
  requirement: !ruby/object:Gem::Requirement
72
101
  requirements:
73
102
  - - ">="
74
103
  - !ruby/object:Gem::Version
75
- version: '0'
104
+ version: 2.1.0
76
105
  type: :runtime
77
106
  prerelease: false
78
107
  version_requirements: !ruby/object:Gem::Requirement
79
108
  requirements:
80
109
  - - ">="
81
110
  - !ruby/object:Gem::Version
82
- version: '0'
111
+ version: 2.1.0
83
112
  - !ruby/object:Gem::Dependency
84
- name: dotenv
113
+ name: rspec_junit_formatter
85
114
  requirement: !ruby/object:Gem::Requirement
86
115
  requirements:
87
- - - ">="
116
+ - - "~>"
88
117
  - !ruby/object:Gem::Version
89
- version: '0'
118
+ version: 0.4.1
90
119
  type: :runtime
91
120
  prerelease: false
92
121
  version_requirements: !ruby/object:Gem::Requirement
93
122
  requirements:
94
- - - ">="
123
+ - - "~>"
95
124
  - !ruby/object:Gem::Version
96
- version: '0'
97
- description: Library to create custom course, catalog.
125
+ version: 0.4.1
126
+ description: Library to create custom course. wip.
98
127
  email:
99
128
  - snatarajan@instructure.com
129
+ - rlamb@instructure.com
100
130
  executables: []
101
131
  extensions: []
102
132
  extra_rdoc_files: []
103
133
  files:
134
+ - ".env.example"
104
135
  - ".gitignore"
105
136
  - ".rspec"
137
+ - ".ruby-version"
106
138
  - ".travis.yml"
107
139
  - CODE_OF_CONDUCT.md
140
+ - Dockerfile
108
141
  - Gemfile
109
- - LICENSE.txt
142
+ - Gemfile.lock
143
+ - Jenkinsfile
110
144
  - README.md
111
145
  - Rakefile
112
146
  - bin/console
113
147
  - bin/setup
148
+ - docker-compose.yml
114
149
  - japanda.gemspec
115
150
  - lib/japanda.rb
116
151
  - lib/japanda/canvas_factory.rb
117
152
  - lib/japanda/canvas_factory/assignment.rb
118
153
  - lib/japanda/canvas_factory/course.rb
119
- - lib/japanda/canvas_factory/course_config.rb
154
+ - lib/japanda/canvas_factory/mergie.rb
120
155
  - lib/japanda/canvas_factory/module.rb
121
156
  - lib/japanda/canvas_factory/module_item.rb
157
+ - lib/japanda/canvas_factory/quiz.rb
122
158
  - lib/japanda/canvas_factory/section.rb
123
159
  - lib/japanda/canvas_factory/user.rb
124
- - lib/japanda/canvas_factory/user_config.rb
125
- - lib/japanda/catalog_factory.rb
126
- - lib/japanda/catalog_factory/course_program.rb
127
160
  - lib/japanda/version.rb
128
- homepage: https://github.com/babababili/japanda
129
- licenses:
130
- - MIT
161
+ homepage:
162
+ licenses: []
131
163
  metadata: {}
132
- post_install_message:
164
+ post_install_message:
133
165
  rdoc_options: []
134
166
  require_paths:
135
167
  - lib
@@ -144,9 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
176
  - !ruby/object:Gem::Version
145
177
  version: '0'
146
178
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.4.5
149
- signing_key:
179
+ rubygems_version: 3.0.8
180
+ signing_key:
150
181
  specification_version: 4
151
- summary: Library to create custom course, catalog.
182
+ summary: Library to create custom course.
152
183
  test_files: []
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Santosh Natarajan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,28 +0,0 @@
1
- module CanvasFactory
2
- class CourseConfig
3
- attr_accessor :course_request, :account_id, :name, :course_code, :start_at, :end_at, :offer
4
-
5
- def initialize(opts = {})
6
- course_name_code = "auto#{SecureRandom.hex}"
7
- @account_id = opts[:account_id] || CANVAS_ACCOUNT_ID
8
- @name = opts[:name] || course_name_code
9
- @course_code = opts[:course_code] || course_name_code
10
- @start_at = opts[:start_at] || Time.now
11
- @end_at = opts[:end_at] || Time.now + (30 * 24 * 60 * 60)
12
- @offer = opts[:offer] || true
13
- end
14
-
15
- def set_course_request
16
- @course_request = {
17
- account_id: @account_id,
18
- course: {
19
- name: @name,
20
- course_code: @course_code,
21
- start_at: @start_at,
22
- end_at: @end_at
23
- },
24
- offer: @offer
25
- }
26
- end
27
- end
28
- end
@@ -1,41 +0,0 @@
1
- module CanvasFactory
2
- class UserConfig
3
- attr_reader :config_user_hash, :config_admin_hash
4
- attr_accessor :email_prefix, :password, :short_name, :terms_of_use, :send_confirmation, :force_validations, :role_id, :email_id
5
-
6
- def initialize(opts = {})
7
- @email_prefix = opts[:email_prefix] || 'catauto'
8
- @password = opts[:password] || 'Testing01'
9
- @short_name = opts[:short_name] || 'cat auto'
10
- @terms_of_use = opts[:terms_of_use] || '1'
11
- @send_confirmation = opts[:send_confirmation] || true
12
- @force_validations = opts[:force_validations] || true
13
- @role_id = opts[:role_id] || 'AccountAdmin'
14
- @email_id = opts[:email_id] || "#{@email_prefix}#{SecureRandom.hex}@example.com"
15
- end
16
-
17
- def set_up_user_hash
18
- @config_user_hash = {
19
- user: {
20
- name: @email_id,
21
- short_name: @short_name,
22
- terms_of_use: @terms_of_use,
23
- send_confirmation: @send_confirmation
24
- },
25
- pseudonym: {
26
- unique_id: @email_id,
27
- password: @password
28
- },
29
- force_validations: @force_validations
30
- }
31
- end
32
-
33
- def set_up_admin_hash(id)
34
- @config_admin_hash = {
35
- user_id: id,
36
- role_id: @role_id,
37
- send_confirmation: @send_confirmation
38
- }
39
- end
40
- end
41
- end
@@ -1,6 +0,0 @@
1
- require 'dotenv'
2
- module CatalogFactory
3
- Dotenv.load
4
- GALLERY_API_TOKEN ||= ENV['GALLERY_API_TOKEN']
5
- GALLERY_API_HOST = ENV['GALLERY_API_HOST']
6
- end
@@ -1,61 +0,0 @@
1
- # add course and program to catalog
2
- module CatalogFactory
3
- class CourseProgram
4
- attr_reader :catalog_response, :course, :certificate_response
5
-
6
- def initialize
7
- @auth_token_content = {
8
- Authorization: "Token token=#{GALLERY_API_TOKEN}",
9
- content_type: 'application/json'
10
- }
11
- end
12
-
13
- def add_course_to_catalog(canvas_options = {}, catalog_options = {})
14
- @course = CanvasFactory::Course.new(canvas_options)
15
- add_to_catalog(@course, catalog_options)
16
- end
17
-
18
- def add_to_catalog(canvas_course, opts = {})
19
- @course = canvas_course
20
- course_response = @course.course_response
21
- body = {
22
- course: {
23
- title: course_response['name'],
24
- description: 'created by api for testing',
25
- path: course_response['name'],
26
- canvas_course_id: course_response['id'],
27
- teaser: 'created by api for testing',
28
- enrollment_open: true,
29
- visibility: 'listed',
30
- enrollment_cap: 12,
31
- enrollment_fee: 0.99,
32
- days_to_complete: 45
33
- }
34
- }
35
- body.deep_merge!(opts[:catalog_options]) unless opts[:catalog_options].nil?
36
-
37
- course_end_point = "#{GALLERY_API_HOST}/api/v1/courses"
38
- response = RestClient.post course_end_point, body, @auth_token_content
39
- @catalog_response = JSON.parse(response)['course']
40
- add_certificate @catalog_response['id'], opts
41
- end
42
-
43
- def add_certificate(catalog_id, opts = {})
44
- body = {
45
- certificate: {
46
- listing_id: catalog_id,
47
- name: 'test api certificate',
48
- template: 'Description test api certificate',
49
- pdf_settings: {
50
- orientation: %w(Landscape Portrait).sample
51
- }
52
- }
53
- }
54
- body.deep_merge!(opts[:certificate_options]) unless opts[:certificate_options].nil?
55
-
56
- new_course_end_point = "#{GALLERY_API_HOST}/api/v1/certificates"
57
- response = RestClient.post new_course_end_point, body, @auth_token_content
58
- @certificate_response = JSON.parse(response)
59
- end
60
- end
61
- end