class SolrMakr::SolrAPI::RequestParams
Wrapper around parameters passed to solr api requests.
Solr requests are not really RESTful, and instead take the action name in a parameter on the query string.
Attributes
action[R]
@!attribute [r] action The name of the solr action, which is automatically applied to the {#query query string parameters} when the request is made. @return [String]
params[R]
@!attribute [r] params @api private @return [ActiveSupport::HashWithIndifferentAccess]
query[R]
@!attribute [r] query @return [ActiveSupport::HashWithIndifferentAccess]
Public Class Methods
new(action:)
click to toggle source
@param [String] action (see action
)
# File lib/solr_makr/solr_api/request_params.rb, line 9 def initialize(action:) @action = action @query = {}.with_indifferent_access @params = {}.with_indifferent_access end
Public Instance Methods
body(request_body)
click to toggle source
Set the body for the request.
@param [String, to_s] @return [void]
# File lib/solr_makr/solr_api/request_params.rb, line 36 def body(request_body) @params[:body] = request_body end
to_h(options = nil)
click to toggle source
# File lib/solr_makr/solr_api/request_params.rb, line 40 def to_h(options = nil) query[:action] = @action @params.to_h.merge(query: query) end