class ApiSigv2::SpecSupport::PathBuilder
Constants
- PRIMARY_KEYS
Attributes
action_name[R]
controller[R]
params[R]
Public Class Methods
new(controller, action_name, params = {})
click to toggle source
# File lib/api_sigv2/spec_support/path_builder.rb, line 10 def initialize(controller, action_name, params = {}) @controller = controller @action_name = action_name @params = params end
Public Instance Methods
path()
click to toggle source
# File lib/api_sigv2/spec_support/path_builder.rb, line 16 def path if params[:path].present? hash = params.delete(:path) url_options.merge!(hash) params.merge!(hash) end controller.url_for(url_options) end
Private Instance Methods
key_options()
click to toggle source
# File lib/api_sigv2/spec_support/path_builder.rb, line 36 def key_options key = (params.keys.map(&:to_sym) & PRIMARY_KEYS).first { key => params[key] } if params[key].present? end
url_options()
click to toggle source
# File lib/api_sigv2/spec_support/path_builder.rb, line 28 def url_options @url_options ||= { action: action_name, controller: controller.controller_path, only_path: true }.merge(key_options || {}) end