Class: Io::Flow::V0::Models::QueryFilterStructuredForm

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

Instance Attribute Summary collapse

Attributes inherited from QueryFilterForm

#discriminator

Instance Method Summary collapse

Methods inherited from QueryFilterForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ QueryFilterStructuredForm

Returns a new instance of QueryFilterStructuredForm.



45466
45467
45468
45469
45470
45471
45472
45473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45466

def initialize(incoming={})
  super(:discriminator => QueryFilterForm::Types::QUERY_FILTER_STRUCTURED_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:field, :operator, :values], 'QueryFilterStructuredForm')
  @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.



45464
45465
45466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45464

def field
  @field
end

#operatorObject (readonly)

Returns the value of attribute operator.



45464
45465
45466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45464

def operator
  @operator
end

#valuesObject (readonly)

Returns the value of attribute values.



45464
45465
45466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45464

def values
  @values
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45479
45480
45481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45479

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

#subtype_to_hashObject



45483
45484
45485
45486
45487
45488
45489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45483

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

#to_jsonObject



45475
45476
45477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45475

def to_json
  JSON.dump(to_hash)
end