class VoucherifySdk::FiltersCondition

Attributes

_in[RW]
after[RW]
before[RW]
contains[RW]
count[RW]
count_less[RW]
count_more[RW]
ends_with[RW]
has_value[RW]
is[RW]
is_days_ago[RW]
is_days_in_future[RW]
is_not[RW]
is_unknown[RW]
less_than[RW]
less_than_ago[RW]
less_than_equal[RW]
less_than_future[RW]
more_than[RW]
more_than_ago[RW]
more_than_equal[RW]
more_than_future[RW]
not_contain[RW]
not_in[RW]
starts_with[RW]

Public Class Methods

_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/VoucherifySdk/models/filters_condition.rb, line 361
def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = VoucherifySdk.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end
acceptable_attributes() click to toggle source

Returns all the JSON keys this model knows about

# File lib/VoucherifySdk/models/filters_condition.rb, line 100
def self.acceptable_attributes
  attribute_map.values
end
attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/VoucherifySdk/models/filters_condition.rb, line 69
def self.attribute_map
  {
    :'_in' => :'$in',
    :'not_in' => :'$not_in',
    :'is' => :'$is',
    :'is_days_ago' => :'$is_days_ago',
    :'is_days_in_future' => :'$is_days_in_future',
    :'is_not' => :'$is_not',
    :'has_value' => :'$has_value',
    :'is_unknown' => :'$is_unknown',
    :'contains' => :'$contains',
    :'not_contain' => :'$not_contain',
    :'starts_with' => :'$starts_with',
    :'ends_with' => :'$ends_with',
    :'more_than' => :'$more_than',
    :'less_than' => :'$less_than',
    :'more_than_ago' => :'$more_than_ago',
    :'less_than_ago' => :'$less_than_ago',
    :'more_than_future' => :'$more_than_future',
    :'less_than_future' => :'$less_than_future',
    :'more_than_equal' => :'$more_than_equal',
    :'less_than_equal' => :'$less_than_equal',
    :'after' => :'$after',
    :'before' => :'$before',
    :'count' => :'$count',
    :'count_less' => :'$count_less',
    :'count_more' => :'$count_more'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/VoucherifySdk/models/filters_condition.rb, line 337
def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/VoucherifySdk/models/filters_condition.rb, line 168
def initialize(attributes = {})
  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    h[k.to_sym] = v
  }

  if attributes.key?(:'_in')
    self._in = attributes[:'_in']
  end

  if attributes.key?(:'not_in')
    self.not_in = attributes[:'not_in']
  end

  if attributes.key?(:'is')
    self.is = attributes[:'is']
  end

  if attributes.key?(:'is_days_ago')
    self.is_days_ago = attributes[:'is_days_ago']
  end

  if attributes.key?(:'is_days_in_future')
    self.is_days_in_future = attributes[:'is_days_in_future']
  end

  if attributes.key?(:'is_not')
    self.is_not = attributes[:'is_not']
  end

  if attributes.key?(:'has_value')
    self.has_value = attributes[:'has_value']
  end

  if attributes.key?(:'is_unknown')
    self.is_unknown = attributes[:'is_unknown']
  end

  if attributes.key?(:'contains')
    self.contains = attributes[:'contains']
  end

  if attributes.key?(:'not_contain')
    self.not_contain = attributes[:'not_contain']
  end

  if attributes.key?(:'starts_with')
    self.starts_with = attributes[:'starts_with']
  end

  if attributes.key?(:'ends_with')
    self.ends_with = attributes[:'ends_with']
  end

  if attributes.key?(:'more_than')
    self.more_than = attributes[:'more_than']
  end

  if attributes.key?(:'less_than')
    self.less_than = attributes[:'less_than']
  end

  if attributes.key?(:'more_than_ago')
    self.more_than_ago = attributes[:'more_than_ago']
  end

  if attributes.key?(:'less_than_ago')
    self.less_than_ago = attributes[:'less_than_ago']
  end

  if attributes.key?(:'more_than_future')
    self.more_than_future = attributes[:'more_than_future']
  end

  if attributes.key?(:'less_than_future')
    self.less_than_future = attributes[:'less_than_future']
  end

  if attributes.key?(:'more_than_equal')
    self.more_than_equal = attributes[:'more_than_equal']
  end

  if attributes.key?(:'less_than_equal')
    self.less_than_equal = attributes[:'less_than_equal']
  end

  if attributes.key?(:'after')
    self.after = attributes[:'after']
  end

  if attributes.key?(:'before')
    self.before = attributes[:'before']
  end

  if attributes.key?(:'count')
    self.count = attributes[:'count']
  end

  if attributes.key?(:'count_less')
    self.count_less = attributes[:'count_less']
  end

  if attributes.key?(:'count_more')
    self.count_more = attributes[:'count_more']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/VoucherifySdk/models/filters_condition.rb, line 136
def self.openapi_nullable
  Set.new([
    :'_in',
    :'not_in',
    :'is',
    :'is_days_ago',
    :'is_days_in_future',
    :'is_not',
    :'has_value',
    :'is_unknown',
    :'contains',
    :'not_contain',
    :'starts_with',
    :'ends_with',
    :'more_than',
    :'less_than',
    :'more_than_ago',
    :'less_than_ago',
    :'more_than_future',
    :'less_than_future',
    :'more_than_equal',
    :'less_than_equal',
    :'after',
    :'before',
    :'count',
    :'count_less',
    :'count_more'
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/VoucherifySdk/models/filters_condition.rb, line 105
def self.openapi_types
  {
    :'_in' => :'Object',
    :'not_in' => :'Object',
    :'is' => :'Object',
    :'is_days_ago' => :'Object',
    :'is_days_in_future' => :'Object',
    :'is_not' => :'Object',
    :'has_value' => :'Object',
    :'is_unknown' => :'Object',
    :'contains' => :'Object',
    :'not_contain' => :'Object',
    :'starts_with' => :'Object',
    :'ends_with' => :'Object',
    :'more_than' => :'Object',
    :'less_than' => :'Object',
    :'more_than_ago' => :'Object',
    :'less_than_ago' => :'Object',
    :'more_than_future' => :'Object',
    :'less_than_future' => :'Object',
    :'more_than_equal' => :'Object',
    :'less_than_equal' => :'Object',
    :'after' => :'Object',
    :'before' => :'Object',
    :'count' => :'Object',
    :'count_less' => :'Object',
    :'count_more' => :'Object'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/VoucherifySdk/models/filters_condition.rb, line 292
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _in == o._in &&
      not_in == o.not_in &&
      is == o.is &&
      is_days_ago == o.is_days_ago &&
      is_days_in_future == o.is_days_in_future &&
      is_not == o.is_not &&
      has_value == o.has_value &&
      is_unknown == o.is_unknown &&
      contains == o.contains &&
      not_contain == o.not_contain &&
      starts_with == o.starts_with &&
      ends_with == o.ends_with &&
      more_than == o.more_than &&
      less_than == o.less_than &&
      more_than_ago == o.more_than_ago &&
      less_than_ago == o.less_than_ago &&
      more_than_future == o.more_than_future &&
      less_than_future == o.less_than_future &&
      more_than_equal == o.more_than_equal &&
      less_than_equal == o.less_than_equal &&
      after == o.after &&
      before == o.before &&
      count == o.count &&
      count_less == o.count_less &&
      count_more == o.count_more
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/VoucherifySdk/models/filters_condition.rb, line 432
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
eql?(o) click to toggle source

@see the ‘==` method @param [Object] Object to be compared

# File lib/VoucherifySdk/models/filters_condition.rb, line 324
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/VoucherifySdk/models/filters_condition.rb, line 330
def hash
  [_in, not_in, is, is_days_ago, is_days_in_future, is_not, has_value, is_unknown, contains, not_contain, starts_with, ends_with, more_than, less_than, more_than_ago, less_than_ago, more_than_future, less_than_future, more_than_equal, less_than_equal, after, before, count, count_less, count_more].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/VoucherifySdk/models/filters_condition.rb, line 277
def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/VoucherifySdk/models/filters_condition.rb, line 408
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/VoucherifySdk/models/filters_condition.rb, line 414
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/VoucherifySdk/models/filters_condition.rb, line 402
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/VoucherifySdk/models/filters_condition.rb, line 285
def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end