Module: CanvasApi

Included in:
Render
Defined in:
lib/canvas_api.rb,
lib/canvas_api/render.rb,
lib/canvas_api/builder.rb,
lib/canvas_api/helpers.rb,
lib/canvas_api/go_helpers.rb,
lib/canvas_api/js_helpers.rb,
lib/canvas_api/ruby_helpers.rb,
lib/canvas_api/js_graphql_helpers.rb,
lib/canvas_api/rb_graphql_helpers.rb

Defined Under Namespace

Modules: GoHelpers, GraphQLHelpers, JsHelpers, RubyHelpers Classes: Builder, Render

Instance Method Summary collapse

Instance Method Details

#nested_arg(str) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/canvas_api/helpers.rb', line 2

def nested_arg(str)
  # update_list_of_blackout_dates has a parameter named 'blackout_dates:'
  # This results in a parameter in the resolver named 'blackout_dates::'
  # which causes a syntax error.
  if str[str.length() - 1] == ":"
    str = str.chop
  end

  # TODO/HACK we are replacing values from the string here to get things to work for now.
  # However, removing these symbols means that the methods that use the arguments
  # generated herein will have bugs and be unusable.
  str.gsub("[", "_").
    gsub("]", "").
    gsub("*", "star").
    gsub("<", "_").
    gsub(">", "_").
    gsub("`", "").
    gsub("https://canvas.instructure.com/lti/", "lti_").
    gsub("https://www.instructure.com/", "").
    gsub("https://purl.imsglobal.org/spec/lti/claim/", "lti_claim_").
    gsub(".", "")
end