class ActiveResource::Base

Private Class Methods

filters(options) click to toggle source
# File lib/fixably/active_resource/base.rb, line 33
def filters(options)
  options.each_with_object([]) do |(key, value), array|
    next if non_query_parameters.include?(key)

    array <<
      if key.equal?(:filter)
        value
      else
        camel_key = key.to_s.camelize(:lower)
        "#{camel_key}:#{value}"
      end
  end
end
instantiate_record(record, prefix_options = {}) click to toggle source

Fixably uses camel case keys but it's more Ruby-like to use underscores

# File lib/fixably/active_resource/base.rb, line 11
def instantiate_record(record, prefix_options = {})
  underscored_record = record.deep_transform_keys(&:underscore)
  original_instantiate_record(underscored_record, prefix_options)
end
Also aliased as: original_instantiate_record
non_query_parameters(= %i[expand limit offset page]) click to toggle source
# File lib/fixably/active_resource/base.rb, line 47
  def non_query_parameters = %i[expand limit offset page]
end
original_instantiate_record(record, prefix_options = {})
Alias for: instantiate_record
original_query_string(options)
Alias for: query_string
query_string(options) click to toggle source

Fixably expects all searches to be sent under a singular query parameter q=search1,search2,attribute:search3

# File lib/fixably/active_resource/base.rb, line 20
def query_string(options)
  opts = {}

  non_query_parameters.each do
    opts[_1] = options.fetch(_1) if options[_1]
  end

  f = filters(options)
  opts[:q] = f.join(",") unless f.count.zero?

  original_query_string(opts)
end
Also aliased as: original_query_string