Class: Io::Flow::V0::Models::QueryBuilderFilterForm

Inherits:
QueryBuilderForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from QueryBuilderForm

#discriminator

Instance Method Summary collapse

Methods inherited from QueryBuilderForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ QueryBuilderFilterForm

Returns a new instance of QueryBuilderFilterForm.



61190
61191
61192
61193
61194
61195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61190

def initialize(incoming={})
  super(:discriminator => QueryBuilderForm::Types::QUERY_BUILDER_FILTER_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:filters], 'QueryBuilderFilterForm')
  @filters = HttpClient::Preconditions.assert_class('filters', opts.delete(:filters), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::QueryFilterForm) ? x : ::Io::Flow::V0::Models::QueryFilterForm.from_json(x)) }
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters.



61188
61189
61190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61188

def filters
  @filters
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



61201
61202
61203
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61201

def copy(incoming={})
  QueryBuilderFilterForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



61205
61206
61207
61208
61209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61205

def subtype_to_hash
  {
    :filters => filters.map { |o| o.to_hash }
  }
end

#to_jsonObject



61197
61198
61199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61197

def to_json
  JSON.dump(to_hash)
end