Module: RoadmapSections

Includes:
BaseClient
Included in:
Spartacus
Defined in:
lib/client/roadmap_sections.rb

Instance Method Summary collapse

Methods included from BaseClient

#auth_header, #convert_keys, #convert_response, #handle_timeouts, #success?, #whitelist_params

Instance Method Details

#create_checkpoint(id, options = {}) ⇒ Checkpoint

Create a checkpoint

Examples:

Create a checkpoint

Spartacus#create_checkpoint(1, {name: 'Real Cool Checkpoint'})

Parameters:

  • id (Integer)

    A roadmap section id.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name (String)

    Checkpoint name.

  • :summary (String)

    Checkpoint summary.

  • :body (String)

    Checkpoint body.

  • :assignment (String)

    Checkpoint assignment.

  • :points (Integer)

    Checkpoint point.

  • :body_and_assignment (String)

    Checkpoint body and Assignment

Returns:

  • (Checkpoint)

    The created checkpoint



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/client/roadmap_sections.rb', line 18

def create_checkpoint(id, options={})
  whitelist = ['name', 'summary', 'body', 'assignment','body_and_assignment', 'points']

  options = convert_keys(options)
  checkpoint_params = whitelist_params(options, whitelist)
  url = "#{@api_base_path}/roadmap_sections/#{id}/create_checkpoint"

  handle_timeouts do
    response = self.class.post(url,
                               headers: auth_header,
                               body: { checkpoint: checkpoint_params })
    convert_response(response, "checkpoint")
  end
end