Class: Io::Flow::V0::Models::QueryFilterStructured

Inherits:
QueryFilter
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from QueryFilter

#discriminator

Instance Method Summary collapse

Methods inherited from QueryFilter

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ QueryFilterStructured

Returns a new instance of QueryFilterStructured.



44661
44662
44663
44664
44665
44666
44667
44668
44669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44661

def initialize(incoming={})
  super(:discriminator => QueryFilter::Types::QUERY_FILTER_STRUCTURED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:q, :field, :operator, :values], 'QueryFilterStructured')
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @field = HttpClient::Preconditions.assert_class('field', opts.delete(:field), String)
  @operator = HttpClient::Preconditions.assert_class('operator', opts.delete(:operator), String)
  @values = HttpClient::Preconditions.assert_class('values', opts.delete(:values), Array).map { |v| HttpClient::Preconditions.assert_class('values', v, String) }
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



44659
44660
44661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44659

def field
  @field
end

#operatorObject (readonly)

Returns the value of attribute operator.



44659
44660
44661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44659

def operator
  @operator
end

#qObject (readonly)

Returns the value of attribute q.



44659
44660
44661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44659

def q
  @q
end

#valuesObject (readonly)

Returns the value of attribute values.



44659
44660
44661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44659

def values
  @values
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44675
44676
44677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44675

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

#subtype_to_hashObject



44679
44680
44681
44682
44683
44684
44685
44686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44679

def subtype_to_hash
  {
    :q => q,
    :field => field,
    :operator => operator,
    :values => values
  }
end

#to_jsonObject



44671
44672
44673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44671

def to_json
  JSON.dump(to_hash)
end