=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 The version of the OpenAPI document: 2.0.0 Contact: support@ultracart.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.1-SNAPSHOT =end require 'date' require 'time' module UltracartClient class ItemReview # Customer profile object identifier attr_accessor :customer_profile_oid attr_accessor :featured attr_accessor :helperful_no_votes attr_accessor :helpful_yes_votes attr_accessor :order_id attr_accessor :overall attr_accessor :rating_name1 attr_accessor :rating_name10 attr_accessor :rating_name2 attr_accessor :rating_name3 attr_accessor :rating_name4 attr_accessor :rating_name5 attr_accessor :rating_name6 attr_accessor :rating_name7 attr_accessor :rating_name8 attr_accessor :rating_name9 attr_accessor :rating_score1 attr_accessor :rating_score10 attr_accessor :rating_score2 attr_accessor :rating_score3 attr_accessor :rating_score4 attr_accessor :rating_score5 attr_accessor :rating_score6 attr_accessor :rating_score7 attr_accessor :rating_score8 attr_accessor :rating_score9 attr_accessor :recommend_store_to_friend attr_accessor :recommend_to_friend attr_accessor :review attr_accessor :review_oid attr_accessor :reviewed_nickname attr_accessor :reviewer_email attr_accessor :reviewer_location attr_accessor :status attr_accessor :store_feedback # Date/time of review submission attr_accessor :submitted_dts attr_accessor :title # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'customer_profile_oid' => :'customer_profile_oid', :'featured' => :'featured', :'helperful_no_votes' => :'helperful_no_votes', :'helpful_yes_votes' => :'helpful_yes_votes', :'order_id' => :'order_id', :'overall' => :'overall', :'rating_name1' => :'rating_name1', :'rating_name10' => :'rating_name10', :'rating_name2' => :'rating_name2', :'rating_name3' => :'rating_name3', :'rating_name4' => :'rating_name4', :'rating_name5' => :'rating_name5', :'rating_name6' => :'rating_name6', :'rating_name7' => :'rating_name7', :'rating_name8' => :'rating_name8', :'rating_name9' => :'rating_name9', :'rating_score1' => :'rating_score1', :'rating_score10' => :'rating_score10', :'rating_score2' => :'rating_score2', :'rating_score3' => :'rating_score3', :'rating_score4' => :'rating_score4', :'rating_score5' => :'rating_score5', :'rating_score6' => :'rating_score6', :'rating_score7' => :'rating_score7', :'rating_score8' => :'rating_score8', :'rating_score9' => :'rating_score9', :'recommend_store_to_friend' => :'recommend_store_to_friend', :'recommend_to_friend' => :'recommend_to_friend', :'review' => :'review', :'review_oid' => :'review_oid', :'reviewed_nickname' => :'reviewed_nickname', :'reviewer_email' => :'reviewer_email', :'reviewer_location' => :'reviewer_location', :'status' => :'status', :'store_feedback' => :'store_feedback', :'submitted_dts' => :'submitted_dts', :'title' => :'title' } 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 { :'customer_profile_oid' => :'Integer', :'featured' => :'Boolean', :'helperful_no_votes' => :'Integer', :'helpful_yes_votes' => :'Integer', :'order_id' => :'String', :'overall' => :'Float', :'rating_name1' => :'String', :'rating_name10' => :'String', :'rating_name2' => :'String', :'rating_name3' => :'String', :'rating_name4' => :'String', :'rating_name5' => :'String', :'rating_name6' => :'String', :'rating_name7' => :'String', :'rating_name8' => :'String', :'rating_name9' => :'String', :'rating_score1' => :'Float', :'rating_score10' => :'Float', :'rating_score2' => :'Float', :'rating_score3' => :'Float', :'rating_score4' => :'Float', :'rating_score5' => :'Float', :'rating_score6' => :'Float', :'rating_score7' => :'Float', :'rating_score8' => :'Float', :'rating_score9' => :'Float', :'recommend_store_to_friend' => :'Integer', :'recommend_to_friend' => :'Boolean', :'review' => :'String', :'review_oid' => :'Integer', :'reviewed_nickname' => :'String', :'reviewer_email' => :'String', :'reviewer_location' => :'String', :'status' => :'String', :'store_feedback' => :'String', :'submitted_dts' => :'String', :'title' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) 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 `UltracartClient::ItemReview` 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 `UltracartClient::ItemReview`. 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?(:'customer_profile_oid') self.customer_profile_oid = attributes[:'customer_profile_oid'] end if attributes.key?(:'featured') self.featured = attributes[:'featured'] end if attributes.key?(:'helperful_no_votes') self.helperful_no_votes = attributes[:'helperful_no_votes'] end if attributes.key?(:'helpful_yes_votes') self.helpful_yes_votes = attributes[:'helpful_yes_votes'] end if attributes.key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.key?(:'overall') self.overall = attributes[:'overall'] end if attributes.key?(:'rating_name1') self.rating_name1 = attributes[:'rating_name1'] end if attributes.key?(:'rating_name10') self.rating_name10 = attributes[:'rating_name10'] end if attributes.key?(:'rating_name2') self.rating_name2 = attributes[:'rating_name2'] end if attributes.key?(:'rating_name3') self.rating_name3 = attributes[:'rating_name3'] end if attributes.key?(:'rating_name4') self.rating_name4 = attributes[:'rating_name4'] end if attributes.key?(:'rating_name5') self.rating_name5 = attributes[:'rating_name5'] end if attributes.key?(:'rating_name6') self.rating_name6 = attributes[:'rating_name6'] end if attributes.key?(:'rating_name7') self.rating_name7 = attributes[:'rating_name7'] end if attributes.key?(:'rating_name8') self.rating_name8 = attributes[:'rating_name8'] end if attributes.key?(:'rating_name9') self.rating_name9 = attributes[:'rating_name9'] end if attributes.key?(:'rating_score1') self.rating_score1 = attributes[:'rating_score1'] end if attributes.key?(:'rating_score10') self.rating_score10 = attributes[:'rating_score10'] end if attributes.key?(:'rating_score2') self.rating_score2 = attributes[:'rating_score2'] end if attributes.key?(:'rating_score3') self.rating_score3 = attributes[:'rating_score3'] end if attributes.key?(:'rating_score4') self.rating_score4 = attributes[:'rating_score4'] end if attributes.key?(:'rating_score5') self.rating_score5 = attributes[:'rating_score5'] end if attributes.key?(:'rating_score6') self.rating_score6 = attributes[:'rating_score6'] end if attributes.key?(:'rating_score7') self.rating_score7 = attributes[:'rating_score7'] end if attributes.key?(:'rating_score8') self.rating_score8 = attributes[:'rating_score8'] end if attributes.key?(:'rating_score9') self.rating_score9 = attributes[:'rating_score9'] end if attributes.key?(:'recommend_store_to_friend') self.recommend_store_to_friend = attributes[:'recommend_store_to_friend'] end if attributes.key?(:'recommend_to_friend') self.recommend_to_friend = attributes[:'recommend_to_friend'] end if attributes.key?(:'review') self.review = attributes[:'review'] end if attributes.key?(:'review_oid') self.review_oid = attributes[:'review_oid'] end if attributes.key?(:'reviewed_nickname') self.reviewed_nickname = attributes[:'reviewed_nickname'] end if attributes.key?(:'reviewer_email') self.reviewer_email = attributes[:'reviewer_email'] end if attributes.key?(:'reviewer_location') self.reviewer_location = attributes[:'reviewer_location'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'store_feedback') self.store_feedback = attributes[:'store_feedback'] end if attributes.key?(:'submitted_dts') self.submitted_dts = attributes[:'submitted_dts'] end if attributes.key?(:'title') self.title = attributes[:'title'] 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 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? 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 && customer_profile_oid == o.customer_profile_oid && featured == o.featured && helperful_no_votes == o.helperful_no_votes && helpful_yes_votes == o.helpful_yes_votes && order_id == o.order_id && overall == o.overall && rating_name1 == o.rating_name1 && rating_name10 == o.rating_name10 && rating_name2 == o.rating_name2 && rating_name3 == o.rating_name3 && rating_name4 == o.rating_name4 && rating_name5 == o.rating_name5 && rating_name6 == o.rating_name6 && rating_name7 == o.rating_name7 && rating_name8 == o.rating_name8 && rating_name9 == o.rating_name9 && rating_score1 == o.rating_score1 && rating_score10 == o.rating_score10 && rating_score2 == o.rating_score2 && rating_score3 == o.rating_score3 && rating_score4 == o.rating_score4 && rating_score5 == o.rating_score5 && rating_score6 == o.rating_score6 && rating_score7 == o.rating_score7 && rating_score8 == o.rating_score8 && rating_score9 == o.rating_score9 && recommend_store_to_friend == o.recommend_store_to_friend && recommend_to_friend == o.recommend_to_friend && review == o.review && review_oid == o.review_oid && reviewed_nickname == o.reviewed_nickname && reviewer_email == o.reviewer_email && reviewer_location == o.reviewer_location && status == o.status && store_feedback == o.store_feedback && submitted_dts == o.submitted_dts && title == o.title 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 [customer_profile_oid, featured, helperful_no_votes, helpful_yes_votes, order_id, overall, rating_name1, rating_name10, rating_name2, rating_name3, rating_name4, rating_name5, rating_name6, rating_name7, rating_name8, rating_name9, rating_score1, rating_score10, rating_score2, rating_score3, rating_score4, rating_score5, rating_score6, rating_score7, rating_score8, rating_score9, recommend_store_to_friend, recommend_to_friend, review, review_oid, reviewed_nickname, reviewer_email, reviewer_location, status, store_feedback, submitted_dts, title].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) attributes = attributes.transform_keys(&:to_sym) 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 = UltracartClient.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