Class: Bearcat::Client::ClientModule::BearcatRequest

Inherits:
Struct
  • Object
show all
Defined in:
lib/bearcat/client_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



87
88
89
# File 'lib/bearcat/client_module.rb', line 87

def arguments
  @arguments
end

#parametersObject

Returns the value of attribute parameters

Returns:

  • (Object)

    the current value of parameters



87
88
89
# File 'lib/bearcat/client_module.rb', line 87

def parameters
  @parameters
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



87
88
89
# File 'lib/bearcat/client_module.rb', line 87

def url
  @url
end

Instance Method Details

#interpoated_urlObject



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/bearcat/client_module.rb', line 88

def interpoated_url
  url.gsub(ARG_REGEX) do |_|
    m = Regexp.last_match
    val = arguments[m[1]]
    val = val.canvas_id if val.respond_to?(:canvas_id)
    val = val.id if val.respond_to?(:id)
    val = val['id'].presence || val[:id].presence || val if val.is_a?(Hash)
    val = val.to_s if val.present?
    val = URI.encode_www_form_component(val) if val.is_a?(String)
    val
  end
end