=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'date' 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 # Rating Name 1 attr_accessor :rating_name1 # Rating Name 10 attr_accessor :rating_name10 # Rating Name 2 attr_accessor :rating_name2 # Rating Name 3 attr_accessor :rating_name3 # Rating Name 4 attr_accessor :rating_name4 # Rating Name 5 attr_accessor :rating_name5 # Rating Name 6 attr_accessor :rating_name6 # Rating Name 7 attr_accessor :rating_name7 # Rating Name 8 attr_accessor :rating_name8 # Rating Name 9 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 # Review attr_accessor :review attr_accessor :review_oid # Nickname attr_accessor :reviewed_nickname # Reviewer Email attr_accessor :reviewer_email # Location attr_accessor :reviewer_location # Status of the review attr_accessor :status # Store Feedback attr_accessor :store_feedback # Date/time of review submission attr_accessor :submitted_dts # Title attr_accessor :title class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @allowable_values = allowable_values.map do |value| case datatype.to_s when /Integer/i value.to_i when /Float/i value.to_f else value end end end def valid?(value) !value || allowable_values.include?(value) end end # 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 # Attribute type mapping. def self.swagger_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 # Initializes the object # @param [Hash] attributes Model attributes in the form of hash 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?(:'customer_profile_oid') self.customer_profile_oid = attributes[:'customer_profile_oid'] end if attributes.has_key?(:'featured') self.featured = attributes[:'featured'] end if attributes.has_key?(:'helperful_no_votes') self.helperful_no_votes = attributes[:'helperful_no_votes'] end if attributes.has_key?(:'helpful_yes_votes') self.helpful_yes_votes = attributes[:'helpful_yes_votes'] end if attributes.has_key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.has_key?(:'overall') self.overall = attributes[:'overall'] end if attributes.has_key?(:'rating_name1') self.rating_name1 = attributes[:'rating_name1'] end if attributes.has_key?(:'rating_name10') self.rating_name10 = attributes[:'rating_name10'] end if attributes.has_key?(:'rating_name2') self.rating_name2 = attributes[:'rating_name2'] end if attributes.has_key?(:'rating_name3') self.rating_name3 = attributes[:'rating_name3'] end if attributes.has_key?(:'rating_name4') self.rating_name4 = attributes[:'rating_name4'] end if attributes.has_key?(:'rating_name5') self.rating_name5 = attributes[:'rating_name5'] end if attributes.has_key?(:'rating_name6') self.rating_name6 = attributes[:'rating_name6'] end if attributes.has_key?(:'rating_name7') self.rating_name7 = attributes[:'rating_name7'] end if attributes.has_key?(:'rating_name8') self.rating_name8 = attributes[:'rating_name8'] end if attributes.has_key?(:'rating_name9') self.rating_name9 = attributes[:'rating_name9'] end if attributes.has_key?(:'rating_score1') self.rating_score1 = attributes[:'rating_score1'] end if attributes.has_key?(:'rating_score10') self.rating_score10 = attributes[:'rating_score10'] end if attributes.has_key?(:'rating_score2') self.rating_score2 = attributes[:'rating_score2'] end if attributes.has_key?(:'rating_score3') self.rating_score3 = attributes[:'rating_score3'] end if attributes.has_key?(:'rating_score4') self.rating_score4 = attributes[:'rating_score4'] end if attributes.has_key?(:'rating_score5') self.rating_score5 = attributes[:'rating_score5'] end if attributes.has_key?(:'rating_score6') self.rating_score6 = attributes[:'rating_score6'] end if attributes.has_key?(:'rating_score7') self.rating_score7 = attributes[:'rating_score7'] end if attributes.has_key?(:'rating_score8') self.rating_score8 = attributes[:'rating_score8'] end if attributes.has_key?(:'rating_score9') self.rating_score9 = attributes[:'rating_score9'] end if attributes.has_key?(:'recommend_store_to_friend') self.recommend_store_to_friend = attributes[:'recommend_store_to_friend'] end if attributes.has_key?(:'recommend_to_friend') self.recommend_to_friend = attributes[:'recommend_to_friend'] end if attributes.has_key?(:'review') self.review = attributes[:'review'] end if attributes.has_key?(:'review_oid') self.review_oid = attributes[:'review_oid'] end if attributes.has_key?(:'reviewed_nickname') self.reviewed_nickname = attributes[:'reviewed_nickname'] end if attributes.has_key?(:'reviewer_email') self.reviewer_email = attributes[:'reviewer_email'] end if attributes.has_key?(:'reviewer_location') self.reviewer_location = attributes[:'reviewer_location'] end if attributes.has_key?(:'status') self.status = attributes[:'status'] end if attributes.has_key?(:'store_feedback') self.store_feedback = attributes[:'store_feedback'] end if attributes.has_key?(:'submitted_dts') self.submitted_dts = attributes[:'submitted_dts'] end if attributes.has_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 if !@rating_name1.nil? && @rating_name1.to_s.length > 100 invalid_properties.push('invalid value for "rating_name1", the character length must be smaller than or equal to 100.') end if !@rating_name10.nil? && @rating_name10.to_s.length > 100 invalid_properties.push('invalid value for "rating_name10", the character length must be smaller than or equal to 100.') end if !@rating_name2.nil? && @rating_name2.to_s.length > 100 invalid_properties.push('invalid value for "rating_name2", the character length must be smaller than or equal to 100.') end if !@rating_name3.nil? && @rating_name3.to_s.length > 100 invalid_properties.push('invalid value for "rating_name3", the character length must be smaller than or equal to 100.') end if !@rating_name4.nil? && @rating_name4.to_s.length > 100 invalid_properties.push('invalid value for "rating_name4", the character length must be smaller than or equal to 100.') end if !@rating_name5.nil? && @rating_name5.to_s.length > 100 invalid_properties.push('invalid value for "rating_name5", the character length must be smaller than or equal to 100.') end if !@rating_name6.nil? && @rating_name6.to_s.length > 100 invalid_properties.push('invalid value for "rating_name6", the character length must be smaller than or equal to 100.') end if !@rating_name7.nil? && @rating_name7.to_s.length > 100 invalid_properties.push('invalid value for "rating_name7", the character length must be smaller than or equal to 100.') end if !@rating_name8.nil? && @rating_name8.to_s.length > 100 invalid_properties.push('invalid value for "rating_name8", the character length must be smaller than or equal to 100.') end if !@rating_name9.nil? && @rating_name9.to_s.length > 100 invalid_properties.push('invalid value for "rating_name9", the character length must be smaller than or equal to 100.') end if !@review.nil? && @review.to_s.length > 10000 invalid_properties.push('invalid value for "review", the character length must be smaller than or equal to 10000.') end if !@reviewed_nickname.nil? && @reviewed_nickname.to_s.length > 25 invalid_properties.push('invalid value for "reviewed_nickname", the character length must be smaller than or equal to 25.') end if !@reviewer_email.nil? && @reviewer_email.to_s.length > 100 invalid_properties.push('invalid value for "reviewer_email", the character length must be smaller than or equal to 100.') end if !@reviewer_location.nil? && @reviewer_location.to_s.length > 25 invalid_properties.push('invalid value for "reviewer_location", the character length must be smaller than or equal to 25.') end if !@store_feedback.nil? && @store_feedback.to_s.length > 10000 invalid_properties.push('invalid value for "store_feedback", the character length must be smaller than or equal to 10000.') end if !@title.nil? && @title.to_s.length > 250 invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 250.') 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 !@rating_name1.nil? && @rating_name1.to_s.length > 100 return false if !@rating_name10.nil? && @rating_name10.to_s.length > 100 return false if !@rating_name2.nil? && @rating_name2.to_s.length > 100 return false if !@rating_name3.nil? && @rating_name3.to_s.length > 100 return false if !@rating_name4.nil? && @rating_name4.to_s.length > 100 return false if !@rating_name5.nil? && @rating_name5.to_s.length > 100 return false if !@rating_name6.nil? && @rating_name6.to_s.length > 100 return false if !@rating_name7.nil? && @rating_name7.to_s.length > 100 return false if !@rating_name8.nil? && @rating_name8.to_s.length > 100 return false if !@rating_name9.nil? && @rating_name9.to_s.length > 100 return false if !@review.nil? && @review.to_s.length > 10000 return false if !@reviewed_nickname.nil? && @reviewed_nickname.to_s.length > 25 return false if !@reviewer_email.nil? && @reviewer_email.to_s.length > 100 return false if !@reviewer_location.nil? && @reviewer_location.to_s.length > 25 status_validator = EnumAttributeValidator.new('String', ['approved', 'unapproved', 'rejected', 'multimedia processing']) return false unless status_validator.valid?(@status) return false if !@store_feedback.nil? && @store_feedback.to_s.length > 10000 return false if !@title.nil? && @title.to_s.length > 250 true end # Custom attribute writer method with validation # @param [Object] rating_name1 Value to be assigned def rating_name1=(rating_name1) if !rating_name1.nil? && rating_name1.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name1", the character length must be smaller than or equal to 100.' end @rating_name1 = rating_name1 end # Custom attribute writer method with validation # @param [Object] rating_name10 Value to be assigned def rating_name10=(rating_name10) if !rating_name10.nil? && rating_name10.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name10", the character length must be smaller than or equal to 100.' end @rating_name10 = rating_name10 end # Custom attribute writer method with validation # @param [Object] rating_name2 Value to be assigned def rating_name2=(rating_name2) if !rating_name2.nil? && rating_name2.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name2", the character length must be smaller than or equal to 100.' end @rating_name2 = rating_name2 end # Custom attribute writer method with validation # @param [Object] rating_name3 Value to be assigned def rating_name3=(rating_name3) if !rating_name3.nil? && rating_name3.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name3", the character length must be smaller than or equal to 100.' end @rating_name3 = rating_name3 end # Custom attribute writer method with validation # @param [Object] rating_name4 Value to be assigned def rating_name4=(rating_name4) if !rating_name4.nil? && rating_name4.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name4", the character length must be smaller than or equal to 100.' end @rating_name4 = rating_name4 end # Custom attribute writer method with validation # @param [Object] rating_name5 Value to be assigned def rating_name5=(rating_name5) if !rating_name5.nil? && rating_name5.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name5", the character length must be smaller than or equal to 100.' end @rating_name5 = rating_name5 end # Custom attribute writer method with validation # @param [Object] rating_name6 Value to be assigned def rating_name6=(rating_name6) if !rating_name6.nil? && rating_name6.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name6", the character length must be smaller than or equal to 100.' end @rating_name6 = rating_name6 end # Custom attribute writer method with validation # @param [Object] rating_name7 Value to be assigned def rating_name7=(rating_name7) if !rating_name7.nil? && rating_name7.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name7", the character length must be smaller than or equal to 100.' end @rating_name7 = rating_name7 end # Custom attribute writer method with validation # @param [Object] rating_name8 Value to be assigned def rating_name8=(rating_name8) if !rating_name8.nil? && rating_name8.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name8", the character length must be smaller than or equal to 100.' end @rating_name8 = rating_name8 end # Custom attribute writer method with validation # @param [Object] rating_name9 Value to be assigned def rating_name9=(rating_name9) if !rating_name9.nil? && rating_name9.to_s.length > 100 fail ArgumentError, 'invalid value for "rating_name9", the character length must be smaller than or equal to 100.' end @rating_name9 = rating_name9 end # Custom attribute writer method with validation # @param [Object] review Value to be assigned def review=(review) if !review.nil? && review.to_s.length > 10000 fail ArgumentError, 'invalid value for "review", the character length must be smaller than or equal to 10000.' end @review = review end # Custom attribute writer method with validation # @param [Object] reviewed_nickname Value to be assigned def reviewed_nickname=(reviewed_nickname) if !reviewed_nickname.nil? && reviewed_nickname.to_s.length > 25 fail ArgumentError, 'invalid value for "reviewed_nickname", the character length must be smaller than or equal to 25.' end @reviewed_nickname = reviewed_nickname end # Custom attribute writer method with validation # @param [Object] reviewer_email Value to be assigned def reviewer_email=(reviewer_email) if !reviewer_email.nil? && reviewer_email.to_s.length > 100 fail ArgumentError, 'invalid value for "reviewer_email", the character length must be smaller than or equal to 100.' end @reviewer_email = reviewer_email end # Custom attribute writer method with validation # @param [Object] reviewer_location Value to be assigned def reviewer_location=(reviewer_location) if !reviewer_location.nil? && reviewer_location.to_s.length > 25 fail ArgumentError, 'invalid value for "reviewer_location", the character length must be smaller than or equal to 25.' end @reviewer_location = reviewer_location end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ['approved', 'unapproved', 'rejected', 'multimedia processing']) unless validator.valid?(status) fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' end @status = status end # Custom attribute writer method with validation # @param [Object] store_feedback Value to be assigned def store_feedback=(store_feedback) if !store_feedback.nil? && store_feedback.to_s.length > 10000 fail ArgumentError, 'invalid value for "store_feedback", the character length must be smaller than or equal to 10000.' end @store_feedback = store_feedback end # Custom attribute writer method with validation # @param [Object] title Value to be assigned def title=(title) if !title.nil? && title.to_s.length > 250 fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 250.' end @title = title 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 [Fixnum] 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 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 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 # 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 :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<(?.+)>\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 temp_model = UltracartClient.const_get(type).new temp_model.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) next if value.nil? 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