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.



56499
56500
56501
56502
56503
56504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56499

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.



56497
56498
56499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56497

def filters
  @filters
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56510
56511
56512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56510

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

#subtype_to_hashObject



56514
56515
56516
56517
56518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56514

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

#to_jsonObject



56506
56507
56508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56506

def to_json
  JSON.dump(to_hash)
end