class ReliefWebAPI::PostParams

Attributes

facets_field_post[RW]
facets_filter_post[RW]
facets_interval_post[RW]
facets_limit_post[RW]
facets_name_post[RW]
facets_sort_post[RW]
fields_exclude[RW]
fields_include[RW]
filter_conditions_post[RW]
filter_field_post[RW]
filter_negate_post[RW]
filter_operator_post[RW]
filter_value_post[RW]
limit_post[RW]
offset_post[RW]
preset_post[RW]
profile[RW]
query_fields_post[RW]
query_operator_post[RW]
query_value[RW]
sort_post[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/reliefweb-api/models/post_params.rb, line 60
def self.attribute_map
  {
    :'query_value' => :'query[value]',
    :'query_operator_post' => :'query[operator]-post',
    :'query_fields_post' => :'query[fields][]-post',
    :'filter_field_post' => :'filter[field]-post',
    :'filter_value_post' => :'filter[value][]-post',
    :'filter_operator_post' => :'filter[operator]-post',
    :'filter_negate_post' => :'filter[negate]-post',
    :'filter_conditions_post' => :'filter[conditions][]-post',
    :'facets_field_post' => :'facets[field]-post',
    :'facets_name_post' => :'facets[name]-post',
    :'facets_limit_post' => :'facets[limit]-post',
    :'facets_sort_post' => :'facets[sort]-post',
    :'facets_filter_post' => :'facets[filter][]-post',
    :'facets_interval_post' => :'facets[interval]-post',
    :'fields_include' => :'fields[include][]',
    :'fields_exclude' => :'fields[exclude][]',
    :'sort_post' => :'sort[]-post',
    :'limit_post' => :'limit-post',
    :'offset_post' => :'offset-post',
    :'profile' => :'profile',
    :'preset_post' => :'preset-post'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/reliefweb-api/models/post_params.rb, line 115
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'query[value]')
    self.query_value = attributes[:'query[value]']
  end

  if attributes.has_key?(:'query[operator]-post')
    self.query_operator_post = attributes[:'query[operator]-post']
  end

  if attributes.has_key?(:'query[fields][]-post')
    self.query_fields_post = attributes[:'query[fields][]-post']
  end

  if attributes.has_key?(:'filter[field]-post')
    self.filter_field_post = attributes[:'filter[field]-post']
  end

  if attributes.has_key?(:'filter[value][]-post')
    self.filter_value_post = attributes[:'filter[value][]-post']
  end

  if attributes.has_key?(:'filter[operator]-post')
    self.filter_operator_post = attributes[:'filter[operator]-post']
  end

  if attributes.has_key?(:'filter[negate]-post')
    self.filter_negate_post = attributes[:'filter[negate]-post']
  end

  if attributes.has_key?(:'filter[conditions][]-post')
    self.filter_conditions_post = attributes[:'filter[conditions][]-post']
  end

  if attributes.has_key?(:'facets[field]-post')
    self.facets_field_post = attributes[:'facets[field]-post']
  end

  if attributes.has_key?(:'facets[name]-post')
    self.facets_name_post = attributes[:'facets[name]-post']
  end

  if attributes.has_key?(:'facets[limit]-post')
    self.facets_limit_post = attributes[:'facets[limit]-post']
  end

  if attributes.has_key?(:'facets[sort]-post')
    self.facets_sort_post = attributes[:'facets[sort]-post']
  end

  if attributes.has_key?(:'facets[filter][]-post')
    self.facets_filter_post = attributes[:'facets[filter][]-post']
  end

  if attributes.has_key?(:'facets[interval]-post')
    self.facets_interval_post = attributes[:'facets[interval]-post']
  end

  if attributes.has_key?(:'fields[include][]')
    self.fields_include = attributes[:'fields[include][]']
  end

  if attributes.has_key?(:'fields[exclude][]')
    self.fields_exclude = attributes[:'fields[exclude][]']
  end

  if attributes.has_key?(:'sort[]-post')
    self.sort_post = attributes[:'sort[]-post']
  end

  if attributes.has_key?(:'limit-post')
    self.limit_post = attributes[:'limit-post']
  end

  if attributes.has_key?(:'offset-post')
    self.offset_post = attributes[:'offset-post']
  end

  if attributes.has_key?(:'profile')
    self.profile = attributes[:'profile']
  end

  if attributes.has_key?(:'preset-post')
    self.preset_post = attributes[:'preset-post']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/reliefweb-api/models/post_params.rb, line 87
def self.swagger_types
  {
    :'query_value' => :'QueryValuePost',
    :'query_operator_post' => :'QueryOperatorPost',
    :'query_fields_post' => :'QueryFieldsPost',
    :'filter_field_post' => :'FilterFieldPost',
    :'filter_value_post' => :'FilterValuePost',
    :'filter_operator_post' => :'FilterOperatorPost',
    :'filter_negate_post' => :'FilterNegatePost',
    :'filter_conditions_post' => :'FilterConditionsPost',
    :'facets_field_post' => :'FacetsFieldPost',
    :'facets_name_post' => :'FacetsNamePost',
    :'facets_limit_post' => :'FacetsLimitPost',
    :'facets_sort_post' => :'FacetsSortPost',
    :'facets_filter_post' => :'FacetsFilterPost',
    :'facets_interval_post' => :'FacetsIntervalPost',
    :'fields_include' => :'FieldsIncludePost',
    :'fields_exclude' => :'FieldsExcludePost',
    :'sort_post' => :'SortPost',
    :'limit_post' => :'LimitPost',
    :'offset_post' => :'OffsetPost',
    :'profile' => :'ProfilePost',
    :'preset_post' => :'PresetPost'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/reliefweb-api/models/post_params.rb, line 221
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      query_value == o.query_value &&
      query_operator_post == o.query_operator_post &&
      query_fields_post == o.query_fields_post &&
      filter_field_post == o.filter_field_post &&
      filter_value_post == o.filter_value_post &&
      filter_operator_post == o.filter_operator_post &&
      filter_negate_post == o.filter_negate_post &&
      filter_conditions_post == o.filter_conditions_post &&
      facets_field_post == o.facets_field_post &&
      facets_name_post == o.facets_name_post &&
      facets_limit_post == o.facets_limit_post &&
      facets_sort_post == o.facets_sort_post &&
      facets_filter_post == o.facets_filter_post &&
      facets_interval_post == o.facets_interval_post &&
      fields_include == o.fields_include &&
      fields_exclude == o.fields_exclude &&
      sort_post == o.sort_post &&
      limit_post == o.limit_post &&
      offset_post == o.offset_post &&
      profile == o.profile &&
      preset_post == o.preset_post
end
_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/reliefweb-api/models/post_params.rb, line 283
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = ReliefWebAPI.const_get(type).new
    temp_model.build_from_hash(value)
  end
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/reliefweb-api/models/post_params.rb, line 349
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
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/reliefweb-api/models/post_params.rb, line 262
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(o) click to toggle source

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

# File lib/reliefweb-api/models/post_params.rb, line 249
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/reliefweb-api/models/post_params.rb, line 255
def hash
  [query_value, query_operator_post, query_fields_post, filter_field_post, filter_value_post, filter_operator_post, filter_negate_post, filter_conditions_post, facets_field_post, facets_name_post, facets_limit_post, facets_sort_post, facets_filter_post, facets_interval_post, fields_include, fields_exclude, sort_post, limit_post, offset_post, profile, preset_post].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/reliefweb-api/models/post_params.rb, line 208
def list_invalid_properties
  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/reliefweb-api/models/post_params.rb, line 329
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/reliefweb-api/models/post_params.rb, line 335
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    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/reliefweb-api/models/post_params.rb, line 323
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/reliefweb-api/models/post_params.rb, line 215
def valid?
  true
end