Class: CanvasFactory::Assignment

Inherits:
Object
  • Object
show all
Defined in:
lib/japanda/canvas_factory/assignment.rb

Overview

assignment class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(course_id, opts = {}, merge = true) ⇒ Assignment

Returns a new instance of Assignment.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/japanda/canvas_factory/assignment.rb', line 7

def initialize(course_id, opts = {}, merge = true)
  @course_id = course_id
  @request = {
    assignment: {
      name: "Assignment-#{Time.now.to_i}",
      grading_type: %w(pass_fail percent letter_grade gpa_scale points).sample,
      submission_types: ['online_text_entry'],
      points_possible: 10,
      due_at: (DateTime.now + 1).iso8601,
      published: true
    }
  }
  @request = Mergie.deep_merge(@request, opts, merge)
  create_assignment
  self
end

Instance Attribute Details

#course_idObject (readonly)

Returns the value of attribute course_id.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def course_id
  @course_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def created_at
  @created_at
end

#due_atObject (readonly)

Returns the value of attribute due_at.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def due_at
  @due_at
end

#grading_typeObject (readonly)

Returns the value of attribute grading_type.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def grading_type
  @grading_type
end

#html_urlObject (readonly)

Returns the value of attribute html_url.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def html_url
  @html_url
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def name
  @name
end

#publishedObject (readonly)

Returns the value of attribute published.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def published
  @published
end

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/japanda/canvas_factory/assignment.rb', line 4

def response
  @response
end