class ReliefWebAPI::PostParams
Attributes
Public Class Methods
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
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
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
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
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
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
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
@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
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
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
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
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
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