class Io::Flow::V0::Models::QueryBuilder

The query builder model is used to build a query using structured filters. The end result is a single ‘q’ string - e.g. ‘category:jewelry and brand:Flow’

Attributes

available[R]
filters[R]
q[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61160
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:q, :filters, :available], 'QueryBuilder')
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @filters = HttpClient::Preconditions.assert_class('filters', opts.delete(:filters), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::QueryFilter) ? x : ::Io::Flow::V0::Models::QueryFilter.from_json(x)) }
  @available = HttpClient::Preconditions.assert_class('available', opts.delete(:available), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AvailableFilter) ? x : ::Io::Flow::V0::Models::AvailableFilter.from_json(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61172
def copy(incoming={})
  QueryBuilder.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61176
def to_hash
  {
    :q => q,
    :filters => filters.map { |o| o.to_hash },
    :available => available.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 61168
def to_json
  JSON.dump(to_hash)
end