Class: Io::Flow::V0::Models::AvailableFilterStructured

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

Instance Attribute Summary collapse

Attributes inherited from AvailableFilter

#discriminator

Instance Method Summary collapse

Methods inherited from AvailableFilter

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ AvailableFilterStructured

Returns a new instance of AvailableFilterStructured.



23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23768

def initialize(incoming={})
  super(:discriminator => AvailableFilter::Types::AVAILABLE_FILTER_STRUCTURED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:field, :operators, :format], 'AvailableFilterStructured')
  @field = HttpClient::Preconditions.assert_class('field', opts.delete(:field), String)
  @operators = HttpClient::Preconditions.assert_class('operators', opts.delete(:operators), Array).map { |v| HttpClient::Preconditions.assert_class('operators', v, String) }
  @format = (x = opts.delete(:format); x.is_a?(::Io::Flow::V0::Models::AvailableFilterFormat) ? x : ::Io::Flow::V0::Models::AvailableFilterFormat.apply(x))
  @valid_values = (x = opts.delete(:valid_values); x.nil? ? nil : HttpClient::Preconditions.assert_class('valid_values', x, Array).map { |v| HttpClient::Preconditions.assert_class('valid_values', v, String) })
  @placeholder = (x = opts.delete(:placeholder); x.nil? ? nil : HttpClient::Preconditions.assert_class('placeholder', x, String))
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



23766
23767
23768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23766

def field
  @field
end

#formatObject (readonly)

Returns the value of attribute format.



23766
23767
23768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23766

def format
  @format
end

#operatorsObject (readonly)

Returns the value of attribute operators.



23766
23767
23768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23766

def operators
  @operators
end

#placeholderObject (readonly)

Returns the value of attribute placeholder.



23766
23767
23768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23766

def placeholder
  @placeholder
end

#valid_valuesObject (readonly)

Returns the value of attribute valid_values.



23766
23767
23768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23766

def valid_values
  @valid_values
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23783
23784
23785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23783

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

#subtype_to_hashObject



23787
23788
23789
23790
23791
23792
23793
23794
23795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23787

def subtype_to_hash
  {
    :field => field,
    :operators => operators,
    :format => format.value,
    :valid_values => valid_values.nil? ? nil : valid_values,
    :placeholder => placeholder
  }
end

#to_jsonObject



23779
23780
23781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23779

def to_json
  JSON.dump(to_hash)
end