=begin #Pinterest REST API #Pinterest's REST API The version of the OpenAPI document: 5.3.0 Contact: blah@cliffano.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.4.0 =end require 'date' require 'time' module PinterestSdkClient class CatalogsProductGroupFilterKeys attr_accessor :min_price attr_accessor :max_price attr_accessor :currency attr_accessor :item_id attr_accessor :availability attr_accessor :brand attr_accessor :condition attr_accessor :custom_label_0 attr_accessor :custom_label_1 attr_accessor :custom_label_2 attr_accessor :custom_label_3 attr_accessor :custom_label_4 attr_accessor :item_group_id attr_accessor :gender attr_accessor :product_type_4 attr_accessor :product_type_3 attr_accessor :product_type_2 attr_accessor :product_type_1 attr_accessor :product_type_0 attr_accessor :google_product_category_6 attr_accessor :google_product_category_5 attr_accessor :google_product_category_4 attr_accessor :google_product_category_3 attr_accessor :google_product_category_2 attr_accessor :google_product_category_1 attr_accessor :google_product_category_0 # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'min_price' => :'MIN_PRICE', :'max_price' => :'MAX_PRICE', :'currency' => :'CURRENCY', :'item_id' => :'ITEM_ID', :'availability' => :'AVAILABILITY', :'brand' => :'BRAND', :'condition' => :'CONDITION', :'custom_label_0' => :'CUSTOM_LABEL_0', :'custom_label_1' => :'CUSTOM_LABEL_1', :'custom_label_2' => :'CUSTOM_LABEL_2', :'custom_label_3' => :'CUSTOM_LABEL_3', :'custom_label_4' => :'CUSTOM_LABEL_4', :'item_group_id' => :'ITEM_GROUP_ID', :'gender' => :'GENDER', :'product_type_4' => :'PRODUCT_TYPE_4', :'product_type_3' => :'PRODUCT_TYPE_3', :'product_type_2' => :'PRODUCT_TYPE_2', :'product_type_1' => :'PRODUCT_TYPE_1', :'product_type_0' => :'PRODUCT_TYPE_0', :'google_product_category_6' => :'GOOGLE_PRODUCT_CATEGORY_6', :'google_product_category_5' => :'GOOGLE_PRODUCT_CATEGORY_5', :'google_product_category_4' => :'GOOGLE_PRODUCT_CATEGORY_4', :'google_product_category_3' => :'GOOGLE_PRODUCT_CATEGORY_3', :'google_product_category_2' => :'GOOGLE_PRODUCT_CATEGORY_2', :'google_product_category_1' => :'GOOGLE_PRODUCT_CATEGORY_1', :'google_product_category_0' => :'GOOGLE_PRODUCT_CATEGORY_0' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'min_price' => :'CatalogsProductGroupPricingCriteria', :'max_price' => :'CatalogsProductGroupPricingCriteria', :'currency' => :'CatalogsProductGroupCurrencyCriteria', :'item_id' => :'CatalogsProductGroupCurrencyCriteria', :'availability' => :'CatalogsProductGroupMultipleStringCriteria', :'brand' => :'CatalogsProductGroupMultipleStringCriteria', :'condition' => :'CatalogsProductGroupMultipleStringCriteria', :'custom_label_0' => :'CatalogsProductGroupMultipleStringCriteria', :'custom_label_1' => :'CatalogsProductGroupMultipleStringCriteria', :'custom_label_2' => :'CatalogsProductGroupMultipleStringCriteria', :'custom_label_3' => :'CatalogsProductGroupMultipleStringCriteria', :'custom_label_4' => :'CatalogsProductGroupMultipleStringCriteria', :'item_group_id' => :'CatalogsProductGroupMultipleStringCriteria', :'gender' => :'CatalogsProductGroupMultipleStringCriteria', :'product_type_4' => :'CatalogsProductGroupMultipleStringListCriteria', :'product_type_3' => :'CatalogsProductGroupMultipleStringListCriteria', :'product_type_2' => :'CatalogsProductGroupMultipleStringListCriteria', :'product_type_1' => :'CatalogsProductGroupMultipleStringListCriteria', :'product_type_0' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_6' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_5' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_4' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_3' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_2' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_1' => :'CatalogsProductGroupMultipleStringListCriteria', :'google_product_category_0' => :'CatalogsProductGroupMultipleStringListCriteria' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # List of class defined in anyOf (OpenAPI v3) def self.openapi_any_of [ :'AvailabilityFilter', :'BrandFilter', :'ConditionFilter', :'CurrencyFilter', :'CustomLabel0Filter', :'CustomLabel1Filter', :'CustomLabel2Filter', :'CustomLabel3Filter', :'CustomLabel4Filter', :'GenderFilter', :'GoogleProductCategory0Filter', :'GoogleProductCategory1Filter', :'GoogleProductCategory2Filter', :'GoogleProductCategory3Filter', :'GoogleProductCategory4Filter', :'GoogleProductCategory5Filter', :'GoogleProductCategory6Filter', :'ItemGroupIdFilter', :'ItemIdFilter', :'MaxPriceFilter', :'MinPriceFilter', :'ProductType0Filter', :'ProductType1Filter', :'ProductType2Filter', :'ProductType3Filter', :'ProductType4Filter' ] end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::CatalogsProductGroupFilterKeys` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::CatalogsProductGroupFilterKeys`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'min_price') self.min_price = attributes[:'min_price'] end if attributes.key?(:'max_price') self.max_price = attributes[:'max_price'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'item_id') self.item_id = attributes[:'item_id'] end if attributes.key?(:'availability') self.availability = attributes[:'availability'] end if attributes.key?(:'brand') self.brand = attributes[:'brand'] end if attributes.key?(:'condition') self.condition = attributes[:'condition'] end if attributes.key?(:'custom_label_0') self.custom_label_0 = attributes[:'custom_label_0'] end if attributes.key?(:'custom_label_1') self.custom_label_1 = attributes[:'custom_label_1'] end if attributes.key?(:'custom_label_2') self.custom_label_2 = attributes[:'custom_label_2'] end if attributes.key?(:'custom_label_3') self.custom_label_3 = attributes[:'custom_label_3'] end if attributes.key?(:'custom_label_4') self.custom_label_4 = attributes[:'custom_label_4'] end if attributes.key?(:'item_group_id') self.item_group_id = attributes[:'item_group_id'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'product_type_4') self.product_type_4 = attributes[:'product_type_4'] end if attributes.key?(:'product_type_3') self.product_type_3 = attributes[:'product_type_3'] end if attributes.key?(:'product_type_2') self.product_type_2 = attributes[:'product_type_2'] end if attributes.key?(:'product_type_1') self.product_type_1 = attributes[:'product_type_1'] end if attributes.key?(:'product_type_0') self.product_type_0 = attributes[:'product_type_0'] end if attributes.key?(:'google_product_category_6') self.google_product_category_6 = attributes[:'google_product_category_6'] end if attributes.key?(:'google_product_category_5') self.google_product_category_5 = attributes[:'google_product_category_5'] end if attributes.key?(:'google_product_category_4') self.google_product_category_4 = attributes[:'google_product_category_4'] end if attributes.key?(:'google_product_category_3') self.google_product_category_3 = attributes[:'google_product_category_3'] end if attributes.key?(:'google_product_category_2') self.google_product_category_2 = attributes[:'google_product_category_2'] end if attributes.key?(:'google_product_category_1') self.google_product_category_1 = attributes[:'google_product_category_1'] end if attributes.key?(:'google_product_category_0') self.google_product_category_0 = attributes[:'google_product_category_0'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if @min_price.nil? invalid_properties.push('invalid value for "min_price", min_price cannot be nil.') end if @max_price.nil? invalid_properties.push('invalid value for "max_price", max_price cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @item_id.nil? invalid_properties.push('invalid value for "item_id", item_id cannot be nil.') end if @availability.nil? invalid_properties.push('invalid value for "availability", availability cannot be nil.') end if @brand.nil? invalid_properties.push('invalid value for "brand", brand cannot be nil.') end if @condition.nil? invalid_properties.push('invalid value for "condition", condition cannot be nil.') end if @custom_label_0.nil? invalid_properties.push('invalid value for "custom_label_0", custom_label_0 cannot be nil.') end if @custom_label_1.nil? invalid_properties.push('invalid value for "custom_label_1", custom_label_1 cannot be nil.') end if @custom_label_2.nil? invalid_properties.push('invalid value for "custom_label_2", custom_label_2 cannot be nil.') end if @custom_label_3.nil? invalid_properties.push('invalid value for "custom_label_3", custom_label_3 cannot be nil.') end if @custom_label_4.nil? invalid_properties.push('invalid value for "custom_label_4", custom_label_4 cannot be nil.') end if @item_group_id.nil? invalid_properties.push('invalid value for "item_group_id", item_group_id cannot be nil.') end if @gender.nil? invalid_properties.push('invalid value for "gender", gender cannot be nil.') end if @product_type_4.nil? invalid_properties.push('invalid value for "product_type_4", product_type_4 cannot be nil.') end if @product_type_3.nil? invalid_properties.push('invalid value for "product_type_3", product_type_3 cannot be nil.') end if @product_type_2.nil? invalid_properties.push('invalid value for "product_type_2", product_type_2 cannot be nil.') end if @product_type_1.nil? invalid_properties.push('invalid value for "product_type_1", product_type_1 cannot be nil.') end if @product_type_0.nil? invalid_properties.push('invalid value for "product_type_0", product_type_0 cannot be nil.') end if @google_product_category_6.nil? invalid_properties.push('invalid value for "google_product_category_6", google_product_category_6 cannot be nil.') end if @google_product_category_5.nil? invalid_properties.push('invalid value for "google_product_category_5", google_product_category_5 cannot be nil.') end if @google_product_category_4.nil? invalid_properties.push('invalid value for "google_product_category_4", google_product_category_4 cannot be nil.') end if @google_product_category_3.nil? invalid_properties.push('invalid value for "google_product_category_3", google_product_category_3 cannot be nil.') end if @google_product_category_2.nil? invalid_properties.push('invalid value for "google_product_category_2", google_product_category_2 cannot be nil.') end if @google_product_category_1.nil? invalid_properties.push('invalid value for "google_product_category_1", google_product_category_1 cannot be nil.') end if @google_product_category_0.nil? invalid_properties.push('invalid value for "google_product_category_0", google_product_category_0 cannot be nil.') end invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return false if @min_price.nil? return false if @max_price.nil? return false if @currency.nil? return false if @item_id.nil? return false if @availability.nil? return false if @brand.nil? return false if @condition.nil? return false if @custom_label_0.nil? return false if @custom_label_1.nil? return false if @custom_label_2.nil? return false if @custom_label_3.nil? return false if @custom_label_4.nil? return false if @item_group_id.nil? return false if @gender.nil? return false if @product_type_4.nil? return false if @product_type_3.nil? return false if @product_type_2.nil? return false if @product_type_1.nil? return false if @product_type_0.nil? return false if @google_product_category_6.nil? return false if @google_product_category_5.nil? return false if @google_product_category_4.nil? return false if @google_product_category_3.nil? return false if @google_product_category_2.nil? return false if @google_product_category_1.nil? return false if @google_product_category_0.nil? _any_of_found = false self.class.openapi_any_of.each do |_class| _any_of = PinterestSdkClient.const_get(_class).build_from_hash(self.to_hash) if _any_of.valid? _any_of_found = true end end if !_any_of_found return false end true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && min_price == o.min_price && max_price == o.max_price && currency == o.currency && item_id == o.item_id && availability == o.availability && brand == o.brand && condition == o.condition && custom_label_0 == o.custom_label_0 && custom_label_1 == o.custom_label_1 && custom_label_2 == o.custom_label_2 && custom_label_3 == o.custom_label_3 && custom_label_4 == o.custom_label_4 && item_group_id == o.item_group_id && gender == o.gender && product_type_4 == o.product_type_4 && product_type_3 == o.product_type_3 && product_type_2 == o.product_type_2 && product_type_1 == o.product_type_1 && product_type_0 == o.product_type_0 && google_product_category_6 == o.google_product_category_6 && google_product_category_5 == o.google_product_category_5 && google_product_category_4 == o.google_product_category_4 && google_product_category_3 == o.google_product_category_3 && google_product_category_2 == o.google_product_category_2 && google_product_category_1 == o.google_product_category_1 && google_product_category_0 == o.google_product_category_0 end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [min_price, max_price, currency, item_id, availability, brand, condition, custom_label_0, custom_label_1, custom_label_2, custom_label_3, custom_label_4, item_group_id, gender, product_type_4, product_type_3, product_type_2, product_type_1, product_type_0, google_product_category_6, google_product_category_5, google_product_category_4, google_product_category_3, google_product_category_2, google_product_category_1, google_product_category_0].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[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 end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _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<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\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 = PinterestSdkClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash 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 # 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 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 end end