lib/ultracart_api/models/item.rb in ultracart_api-3.10.220 vs lib/ultracart_api/models/item.rb in ultracart_api-4.0.32.rc

- old
+ new

@@ -1,713 +1,748 @@ -=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 Item - attr_accessor :accounting - - attr_accessor :amember - - attr_accessor :auto_order - - attr_accessor :ccbill - - # Channel Partner Item Mapping - attr_accessor :channel_partner_item_mappings - - attr_accessor :chargeback - - attr_accessor :checkout - - attr_accessor :content - - # Date/time of creation - attr_accessor :creation_dts - - # Description of the item up to 500 characters. - attr_accessor :description - - # Description translated text instance id - attr_accessor :description_translated_text_instance_oid - - attr_accessor :digital_delivery - - attr_accessor :ebay - - attr_accessor :email_notifications - - attr_accessor :enrollment123 - - # Fulfillment Add-ons - attr_accessor :fulfillment_addons - - attr_accessor :gift_certificate - - attr_accessor :google_product_search - - attr_accessor :identifiers - - # True if this item is inactive and can not be purchased - attr_accessor :inactive - - attr_accessor :instant_payment_notifications - - attr_accessor :internal - - # True if this item is a kit - attr_accessor :kit - - # True if this item can only be usd as a kit component - attr_accessor :kit_component_only - - attr_accessor :kit_definition - - # Date/time of last modification - attr_accessor :last_modified_dts - - # UltraCart merchant ID owning item - attr_accessor :merchant_id - - # Unique item id assigned to this item - attr_accessor :merchant_item_id - - # Unique object identifier for this item - attr_accessor :merchant_item_oid - - # Options - attr_accessor :options - - # Parent category of the item. Zero indicates the root folder. - attr_accessor :parent_category_id - - # Parent category path. / indicates the root folder. - attr_accessor :parent_category_path - - attr_accessor :payment_processing - - attr_accessor :physical - - attr_accessor :pricing - - # Properties - attr_accessor :properties - - attr_accessor :realtime_pricing - - # Number of days to recommend replenishment after. Null is not configured. Set to zero to disable. - attr_accessor :recommend_replenishment_days - - attr_accessor :related - - attr_accessor :reporting - - attr_accessor :restriction - - attr_accessor :revguard - - attr_accessor :reviews - - attr_accessor :salesforce - - attr_accessor :shipping - - attr_accessor :tags - - attr_accessor :tax - - # 3rd Party Email Marketing - attr_accessor :third_party_email_marketing - - # Variant Items - attr_accessor :variant_items - - # Variations - attr_accessor :variations - - attr_accessor :wishlist_member - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'accounting' => :'accounting', - :'amember' => :'amember', - :'auto_order' => :'auto_order', - :'ccbill' => :'ccbill', - :'channel_partner_item_mappings' => :'channel_partner_item_mappings', - :'chargeback' => :'chargeback', - :'checkout' => :'checkout', - :'content' => :'content', - :'creation_dts' => :'creation_dts', - :'description' => :'description', - :'description_translated_text_instance_oid' => :'description_translated_text_instance_oid', - :'digital_delivery' => :'digital_delivery', - :'ebay' => :'ebay', - :'email_notifications' => :'email_notifications', - :'enrollment123' => :'enrollment123', - :'fulfillment_addons' => :'fulfillment_addons', - :'gift_certificate' => :'gift_certificate', - :'google_product_search' => :'google_product_search', - :'identifiers' => :'identifiers', - :'inactive' => :'inactive', - :'instant_payment_notifications' => :'instant_payment_notifications', - :'internal' => :'internal', - :'kit' => :'kit', - :'kit_component_only' => :'kit_component_only', - :'kit_definition' => :'kit_definition', - :'last_modified_dts' => :'last_modified_dts', - :'merchant_id' => :'merchant_id', - :'merchant_item_id' => :'merchant_item_id', - :'merchant_item_oid' => :'merchant_item_oid', - :'options' => :'options', - :'parent_category_id' => :'parent_category_id', - :'parent_category_path' => :'parent_category_path', - :'payment_processing' => :'payment_processing', - :'physical' => :'physical', - :'pricing' => :'pricing', - :'properties' => :'properties', - :'realtime_pricing' => :'realtime_pricing', - :'recommend_replenishment_days' => :'recommend_replenishment_days', - :'related' => :'related', - :'reporting' => :'reporting', - :'restriction' => :'restriction', - :'revguard' => :'revguard', - :'reviews' => :'reviews', - :'salesforce' => :'salesforce', - :'shipping' => :'shipping', - :'tags' => :'tags', - :'tax' => :'tax', - :'third_party_email_marketing' => :'third_party_email_marketing', - :'variant_items' => :'variant_items', - :'variations' => :'variations', - :'wishlist_member' => :'wishlist_member' - } - end - - # Attribute type mapping. - def self.swagger_types - { - :'accounting' => :'ItemAccounting', - :'amember' => :'ItemAmember', - :'auto_order' => :'ItemAutoOrder', - :'ccbill' => :'ItemCCBill', - :'channel_partner_item_mappings' => :'Array<ItemChannelPartnerMapping>', - :'chargeback' => :'ItemChargeback', - :'checkout' => :'ItemCheckout', - :'content' => :'ItemContent', - :'creation_dts' => :'String', - :'description' => :'String', - :'description_translated_text_instance_oid' => :'Integer', - :'digital_delivery' => :'ItemDigitalDelivery', - :'ebay' => :'ItemEbay', - :'email_notifications' => :'ItemEmailNotifications', - :'enrollment123' => :'ItemEnrollment123', - :'fulfillment_addons' => :'Array<ItemFulfillmentAddon>', - :'gift_certificate' => :'ItemGiftCertificate', - :'google_product_search' => :'ItemGoogleProductSearch', - :'identifiers' => :'ItemIdentifiers', - :'inactive' => :'BOOLEAN', - :'instant_payment_notifications' => :'ItemInstantPaymentNotifications', - :'internal' => :'ItemInternal', - :'kit' => :'BOOLEAN', - :'kit_component_only' => :'BOOLEAN', - :'kit_definition' => :'ItemKitDefinition', - :'last_modified_dts' => :'String', - :'merchant_id' => :'String', - :'merchant_item_id' => :'String', - :'merchant_item_oid' => :'Integer', - :'options' => :'Array<ItemOption>', - :'parent_category_id' => :'Integer', - :'parent_category_path' => :'String', - :'payment_processing' => :'ItemPaymentProcessing', - :'physical' => :'ItemPhysical', - :'pricing' => :'ItemPricing', - :'properties' => :'Array<ItemProperty>', - :'realtime_pricing' => :'ItemRealtimePricing', - :'recommend_replenishment_days' => :'Integer', - :'related' => :'ItemRelated', - :'reporting' => :'ItemReporting', - :'restriction' => :'ItemRestriction', - :'revguard' => :'ItemRevguard', - :'reviews' => :'ItemReviews', - :'salesforce' => :'ItemSalesforce', - :'shipping' => :'ItemShipping', - :'tags' => :'ItemTags', - :'tax' => :'ItemTax', - :'third_party_email_marketing' => :'Array<ItemThirdPartyEmailMarketing>', - :'variant_items' => :'Array<ItemVariantItem>', - :'variations' => :'Array<ItemVariation>', - :'wishlist_member' => :'ItemWishlistMember' - } - 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?(:'accounting') - self.accounting = attributes[:'accounting'] - end - - if attributes.has_key?(:'amember') - self.amember = attributes[:'amember'] - end - - if attributes.has_key?(:'auto_order') - self.auto_order = attributes[:'auto_order'] - end - - if attributes.has_key?(:'ccbill') - self.ccbill = attributes[:'ccbill'] - end - - if attributes.has_key?(:'channel_partner_item_mappings') - if (value = attributes[:'channel_partner_item_mappings']).is_a?(Array) - self.channel_partner_item_mappings = value - end - end - - if attributes.has_key?(:'chargeback') - self.chargeback = attributes[:'chargeback'] - end - - if attributes.has_key?(:'checkout') - self.checkout = attributes[:'checkout'] - end - - if attributes.has_key?(:'content') - self.content = attributes[:'content'] - end - - if attributes.has_key?(:'creation_dts') - self.creation_dts = attributes[:'creation_dts'] - end - - if attributes.has_key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.has_key?(:'description_translated_text_instance_oid') - self.description_translated_text_instance_oid = attributes[:'description_translated_text_instance_oid'] - end - - if attributes.has_key?(:'digital_delivery') - self.digital_delivery = attributes[:'digital_delivery'] - end - - if attributes.has_key?(:'ebay') - self.ebay = attributes[:'ebay'] - end - - if attributes.has_key?(:'email_notifications') - self.email_notifications = attributes[:'email_notifications'] - end - - if attributes.has_key?(:'enrollment123') - self.enrollment123 = attributes[:'enrollment123'] - end - - if attributes.has_key?(:'fulfillment_addons') - if (value = attributes[:'fulfillment_addons']).is_a?(Array) - self.fulfillment_addons = value - end - end - - if attributes.has_key?(:'gift_certificate') - self.gift_certificate = attributes[:'gift_certificate'] - end - - if attributes.has_key?(:'google_product_search') - self.google_product_search = attributes[:'google_product_search'] - end - - if attributes.has_key?(:'identifiers') - self.identifiers = attributes[:'identifiers'] - end - - if attributes.has_key?(:'inactive') - self.inactive = attributes[:'inactive'] - end - - if attributes.has_key?(:'instant_payment_notifications') - self.instant_payment_notifications = attributes[:'instant_payment_notifications'] - end - - if attributes.has_key?(:'internal') - self.internal = attributes[:'internal'] - end - - if attributes.has_key?(:'kit') - self.kit = attributes[:'kit'] - end - - if attributes.has_key?(:'kit_component_only') - self.kit_component_only = attributes[:'kit_component_only'] - end - - if attributes.has_key?(:'kit_definition') - self.kit_definition = attributes[:'kit_definition'] - end - - if attributes.has_key?(:'last_modified_dts') - self.last_modified_dts = attributes[:'last_modified_dts'] - end - - if attributes.has_key?(:'merchant_id') - self.merchant_id = attributes[:'merchant_id'] - end - - if attributes.has_key?(:'merchant_item_id') - self.merchant_item_id = attributes[:'merchant_item_id'] - end - - if attributes.has_key?(:'merchant_item_oid') - self.merchant_item_oid = attributes[:'merchant_item_oid'] - end - - if attributes.has_key?(:'options') - if (value = attributes[:'options']).is_a?(Array) - self.options = value - end - end - - if attributes.has_key?(:'parent_category_id') - self.parent_category_id = attributes[:'parent_category_id'] - end - - if attributes.has_key?(:'parent_category_path') - self.parent_category_path = attributes[:'parent_category_path'] - end - - if attributes.has_key?(:'payment_processing') - self.payment_processing = attributes[:'payment_processing'] - end - - if attributes.has_key?(:'physical') - self.physical = attributes[:'physical'] - end - - if attributes.has_key?(:'pricing') - self.pricing = attributes[:'pricing'] - end - - if attributes.has_key?(:'properties') - if (value = attributes[:'properties']).is_a?(Array) - self.properties = value - end - end - - if attributes.has_key?(:'realtime_pricing') - self.realtime_pricing = attributes[:'realtime_pricing'] - end - - if attributes.has_key?(:'recommend_replenishment_days') - self.recommend_replenishment_days = attributes[:'recommend_replenishment_days'] - end - - if attributes.has_key?(:'related') - self.related = attributes[:'related'] - end - - if attributes.has_key?(:'reporting') - self.reporting = attributes[:'reporting'] - end - - if attributes.has_key?(:'restriction') - self.restriction = attributes[:'restriction'] - end - - if attributes.has_key?(:'revguard') - self.revguard = attributes[:'revguard'] - end - - if attributes.has_key?(:'reviews') - self.reviews = attributes[:'reviews'] - end - - if attributes.has_key?(:'salesforce') - self.salesforce = attributes[:'salesforce'] - end - - if attributes.has_key?(:'shipping') - self.shipping = attributes[:'shipping'] - end - - if attributes.has_key?(:'tags') - self.tags = attributes[:'tags'] - end - - if attributes.has_key?(:'tax') - self.tax = attributes[:'tax'] - end - - if attributes.has_key?(:'third_party_email_marketing') - if (value = attributes[:'third_party_email_marketing']).is_a?(Array) - self.third_party_email_marketing = value - end - end - - if attributes.has_key?(:'variant_items') - if (value = attributes[:'variant_items']).is_a?(Array) - self.variant_items = value - end - end - - if attributes.has_key?(:'variations') - if (value = attributes[:'variations']).is_a?(Array) - self.variations = value - end - end - - if attributes.has_key?(:'wishlist_member') - self.wishlist_member = attributes[:'wishlist_member'] - 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 !@description.nil? && @description.to_s.length > 512 - invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 512.') - end - - if !@merchant_id.nil? && @merchant_id.to_s.length > 5 - invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.') - end - - if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 - invalid_properties.push('invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.') - 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 !@description.nil? && @description.to_s.length > 512 - return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5 - return false if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 - true - end - - # Custom attribute writer method with validation - # @param [Object] description Value to be assigned - def description=(description) - if !description.nil? && description.to_s.length > 512 - fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 512.' - end - - @description = description - end - - # Custom attribute writer method with validation - # @param [Object] merchant_id Value to be assigned - def merchant_id=(merchant_id) - if !merchant_id.nil? && merchant_id.to_s.length > 5 - fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.' - end - - @merchant_id = merchant_id - end - - # Custom attribute writer method with validation - # @param [Object] merchant_item_id Value to be assigned - def merchant_item_id=(merchant_item_id) - if !merchant_item_id.nil? && merchant_item_id.to_s.length > 20 - fail ArgumentError, 'invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.' - end - - @merchant_item_id = merchant_item_id - 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 && - accounting == o.accounting && - amember == o.amember && - auto_order == o.auto_order && - ccbill == o.ccbill && - channel_partner_item_mappings == o.channel_partner_item_mappings && - chargeback == o.chargeback && - checkout == o.checkout && - content == o.content && - creation_dts == o.creation_dts && - description == o.description && - description_translated_text_instance_oid == o.description_translated_text_instance_oid && - digital_delivery == o.digital_delivery && - ebay == o.ebay && - email_notifications == o.email_notifications && - enrollment123 == o.enrollment123 && - fulfillment_addons == o.fulfillment_addons && - gift_certificate == o.gift_certificate && - google_product_search == o.google_product_search && - identifiers == o.identifiers && - inactive == o.inactive && - instant_payment_notifications == o.instant_payment_notifications && - internal == o.internal && - kit == o.kit && - kit_component_only == o.kit_component_only && - kit_definition == o.kit_definition && - last_modified_dts == o.last_modified_dts && - merchant_id == o.merchant_id && - merchant_item_id == o.merchant_item_id && - merchant_item_oid == o.merchant_item_oid && - options == o.options && - parent_category_id == o.parent_category_id && - parent_category_path == o.parent_category_path && - payment_processing == o.payment_processing && - physical == o.physical && - pricing == o.pricing && - properties == o.properties && - realtime_pricing == o.realtime_pricing && - recommend_replenishment_days == o.recommend_replenishment_days && - related == o.related && - reporting == o.reporting && - restriction == o.restriction && - revguard == o.revguard && - reviews == o.reviews && - salesforce == o.salesforce && - shipping == o.shipping && - tags == o.tags && - tax == o.tax && - third_party_email_marketing == o.third_party_email_marketing && - variant_items == o.variant_items && - variations == o.variations && - wishlist_member == o.wishlist_member - 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 - [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].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<(?<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 = 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 +=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 Item + attr_accessor :accounting + + attr_accessor :amember + + attr_accessor :auto_order + + attr_accessor :ccbill + + # Channel Partner Item Mapping + attr_accessor :channel_partner_item_mappings + + attr_accessor :chargeback + + attr_accessor :checkout + + attr_accessor :content + + # Date/time of creation + attr_accessor :creation_dts + + # Description of the item up to 500 characters. + attr_accessor :description + + # Description translated text instance id + attr_accessor :description_translated_text_instance_oid + + attr_accessor :digital_delivery + + attr_accessor :ebay + + attr_accessor :email_notifications + + attr_accessor :enrollment123 + + # Fulfillment Add-ons + attr_accessor :fulfillment_addons + + attr_accessor :gift_certificate + + attr_accessor :google_product_search + + attr_accessor :identifiers + + # True if this item is inactive and can not be purchased + attr_accessor :inactive + + attr_accessor :instant_payment_notifications + + attr_accessor :internal + + # True if this item is a kit + attr_accessor :kit + + # True if this item can only be usd as a kit component + attr_accessor :kit_component_only + + attr_accessor :kit_definition + + # Date/time of last modification + attr_accessor :last_modified_dts + + # UltraCart merchant ID owning item + attr_accessor :merchant_id + + # Unique item id assigned to this item + attr_accessor :merchant_item_id + + # Unique object identifier for this item + attr_accessor :merchant_item_oid + + # Options + attr_accessor :options + + # Parent category of the item. Zero indicates the root folder. + attr_accessor :parent_category_id + + # Parent category path. / indicates the root folder. + attr_accessor :parent_category_path + + attr_accessor :payment_processing + + attr_accessor :physical + + attr_accessor :pricing + + # Properties + attr_accessor :properties + + attr_accessor :realtime_pricing + + # Number of days to recommend replenishment after. Null is not configured. Set to zero to disable. + attr_accessor :recommend_replenishment_days + + attr_accessor :related + + attr_accessor :reporting + + attr_accessor :restriction + + attr_accessor :revguard + + attr_accessor :reviews + + attr_accessor :salesforce + + attr_accessor :shipping + + attr_accessor :tags + + attr_accessor :tax + + # 3rd Party Email Marketing + attr_accessor :third_party_email_marketing + + # Variant Items + attr_accessor :variant_items + + # Variations + attr_accessor :variations + + attr_accessor :wishlist_member + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'accounting' => :'accounting', + :'amember' => :'amember', + :'auto_order' => :'auto_order', + :'ccbill' => :'ccbill', + :'channel_partner_item_mappings' => :'channel_partner_item_mappings', + :'chargeback' => :'chargeback', + :'checkout' => :'checkout', + :'content' => :'content', + :'creation_dts' => :'creation_dts', + :'description' => :'description', + :'description_translated_text_instance_oid' => :'description_translated_text_instance_oid', + :'digital_delivery' => :'digital_delivery', + :'ebay' => :'ebay', + :'email_notifications' => :'email_notifications', + :'enrollment123' => :'enrollment123', + :'fulfillment_addons' => :'fulfillment_addons', + :'gift_certificate' => :'gift_certificate', + :'google_product_search' => :'google_product_search', + :'identifiers' => :'identifiers', + :'inactive' => :'inactive', + :'instant_payment_notifications' => :'instant_payment_notifications', + :'internal' => :'internal', + :'kit' => :'kit', + :'kit_component_only' => :'kit_component_only', + :'kit_definition' => :'kit_definition', + :'last_modified_dts' => :'last_modified_dts', + :'merchant_id' => :'merchant_id', + :'merchant_item_id' => :'merchant_item_id', + :'merchant_item_oid' => :'merchant_item_oid', + :'options' => :'options', + :'parent_category_id' => :'parent_category_id', + :'parent_category_path' => :'parent_category_path', + :'payment_processing' => :'payment_processing', + :'physical' => :'physical', + :'pricing' => :'pricing', + :'properties' => :'properties', + :'realtime_pricing' => :'realtime_pricing', + :'recommend_replenishment_days' => :'recommend_replenishment_days', + :'related' => :'related', + :'reporting' => :'reporting', + :'restriction' => :'restriction', + :'revguard' => :'revguard', + :'reviews' => :'reviews', + :'salesforce' => :'salesforce', + :'shipping' => :'shipping', + :'tags' => :'tags', + :'tax' => :'tax', + :'third_party_email_marketing' => :'third_party_email_marketing', + :'variant_items' => :'variant_items', + :'variations' => :'variations', + :'wishlist_member' => :'wishlist_member' + } + 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 + { + :'accounting' => :'ItemAccounting', + :'amember' => :'ItemAmember', + :'auto_order' => :'ItemAutoOrder', + :'ccbill' => :'ItemCCBill', + :'channel_partner_item_mappings' => :'Array<ItemChannelPartnerMapping>', + :'chargeback' => :'ItemChargeback', + :'checkout' => :'ItemCheckout', + :'content' => :'ItemContent', + :'creation_dts' => :'String', + :'description' => :'String', + :'description_translated_text_instance_oid' => :'Integer', + :'digital_delivery' => :'ItemDigitalDelivery', + :'ebay' => :'ItemEbay', + :'email_notifications' => :'ItemEmailNotifications', + :'enrollment123' => :'ItemEnrollment123', + :'fulfillment_addons' => :'Array<ItemFulfillmentAddon>', + :'gift_certificate' => :'ItemGiftCertificate', + :'google_product_search' => :'ItemGoogleProductSearch', + :'identifiers' => :'ItemIdentifiers', + :'inactive' => :'Boolean', + :'instant_payment_notifications' => :'ItemInstantPaymentNotifications', + :'internal' => :'ItemInternal', + :'kit' => :'Boolean', + :'kit_component_only' => :'Boolean', + :'kit_definition' => :'ItemKitDefinition', + :'last_modified_dts' => :'String', + :'merchant_id' => :'String', + :'merchant_item_id' => :'String', + :'merchant_item_oid' => :'Integer', + :'options' => :'Array<ItemOption>', + :'parent_category_id' => :'Integer', + :'parent_category_path' => :'String', + :'payment_processing' => :'ItemPaymentProcessing', + :'physical' => :'ItemPhysical', + :'pricing' => :'ItemPricing', + :'properties' => :'Array<ItemProperty>', + :'realtime_pricing' => :'ItemRealtimePricing', + :'recommend_replenishment_days' => :'Integer', + :'related' => :'ItemRelated', + :'reporting' => :'ItemReporting', + :'restriction' => :'ItemRestriction', + :'revguard' => :'ItemRevguard', + :'reviews' => :'ItemReviews', + :'salesforce' => :'ItemSalesforce', + :'shipping' => :'ItemShipping', + :'tags' => :'ItemTags', + :'tax' => :'ItemTax', + :'third_party_email_marketing' => :'Array<ItemThirdPartyEmailMarketing>', + :'variant_items' => :'Array<ItemVariantItem>', + :'variations' => :'Array<ItemVariation>', + :'wishlist_member' => :'ItemWishlistMember' + } + 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::Item` 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::Item`. 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?(:'accounting') + self.accounting = attributes[:'accounting'] + end + + if attributes.key?(:'amember') + self.amember = attributes[:'amember'] + end + + if attributes.key?(:'auto_order') + self.auto_order = attributes[:'auto_order'] + end + + if attributes.key?(:'ccbill') + self.ccbill = attributes[:'ccbill'] + end + + if attributes.key?(:'channel_partner_item_mappings') + if (value = attributes[:'channel_partner_item_mappings']).is_a?(Array) + self.channel_partner_item_mappings = value + end + end + + if attributes.key?(:'chargeback') + self.chargeback = attributes[:'chargeback'] + end + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'creation_dts') + self.creation_dts = attributes[:'creation_dts'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'description_translated_text_instance_oid') + self.description_translated_text_instance_oid = attributes[:'description_translated_text_instance_oid'] + end + + if attributes.key?(:'digital_delivery') + self.digital_delivery = attributes[:'digital_delivery'] + end + + if attributes.key?(:'ebay') + self.ebay = attributes[:'ebay'] + end + + if attributes.key?(:'email_notifications') + self.email_notifications = attributes[:'email_notifications'] + end + + if attributes.key?(:'enrollment123') + self.enrollment123 = attributes[:'enrollment123'] + end + + if attributes.key?(:'fulfillment_addons') + if (value = attributes[:'fulfillment_addons']).is_a?(Array) + self.fulfillment_addons = value + end + end + + if attributes.key?(:'gift_certificate') + self.gift_certificate = attributes[:'gift_certificate'] + end + + if attributes.key?(:'google_product_search') + self.google_product_search = attributes[:'google_product_search'] + end + + if attributes.key?(:'identifiers') + self.identifiers = attributes[:'identifiers'] + end + + if attributes.key?(:'inactive') + self.inactive = attributes[:'inactive'] + end + + if attributes.key?(:'instant_payment_notifications') + self.instant_payment_notifications = attributes[:'instant_payment_notifications'] + end + + if attributes.key?(:'internal') + self.internal = attributes[:'internal'] + end + + if attributes.key?(:'kit') + self.kit = attributes[:'kit'] + end + + if attributes.key?(:'kit_component_only') + self.kit_component_only = attributes[:'kit_component_only'] + end + + if attributes.key?(:'kit_definition') + self.kit_definition = attributes[:'kit_definition'] + end + + if attributes.key?(:'last_modified_dts') + self.last_modified_dts = attributes[:'last_modified_dts'] + end + + if attributes.key?(:'merchant_id') + self.merchant_id = attributes[:'merchant_id'] + end + + if attributes.key?(:'merchant_item_id') + self.merchant_item_id = attributes[:'merchant_item_id'] + end + + if attributes.key?(:'merchant_item_oid') + self.merchant_item_oid = attributes[:'merchant_item_oid'] + end + + if attributes.key?(:'options') + if (value = attributes[:'options']).is_a?(Array) + self.options = value + end + end + + if attributes.key?(:'parent_category_id') + self.parent_category_id = attributes[:'parent_category_id'] + end + + if attributes.key?(:'parent_category_path') + self.parent_category_path = attributes[:'parent_category_path'] + end + + if attributes.key?(:'payment_processing') + self.payment_processing = attributes[:'payment_processing'] + end + + if attributes.key?(:'physical') + self.physical = attributes[:'physical'] + end + + if attributes.key?(:'pricing') + self.pricing = attributes[:'pricing'] + end + + if attributes.key?(:'properties') + if (value = attributes[:'properties']).is_a?(Array) + self.properties = value + end + end + + if attributes.key?(:'realtime_pricing') + self.realtime_pricing = attributes[:'realtime_pricing'] + end + + if attributes.key?(:'recommend_replenishment_days') + self.recommend_replenishment_days = attributes[:'recommend_replenishment_days'] + end + + if attributes.key?(:'related') + self.related = attributes[:'related'] + end + + if attributes.key?(:'reporting') + self.reporting = attributes[:'reporting'] + end + + if attributes.key?(:'restriction') + self.restriction = attributes[:'restriction'] + end + + if attributes.key?(:'revguard') + self.revguard = attributes[:'revguard'] + end + + if attributes.key?(:'reviews') + self.reviews = attributes[:'reviews'] + end + + if attributes.key?(:'salesforce') + self.salesforce = attributes[:'salesforce'] + end + + if attributes.key?(:'shipping') + self.shipping = attributes[:'shipping'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + end + + if attributes.key?(:'tax') + self.tax = attributes[:'tax'] + end + + if attributes.key?(:'third_party_email_marketing') + if (value = attributes[:'third_party_email_marketing']).is_a?(Array) + self.third_party_email_marketing = value + end + end + + if attributes.key?(:'variant_items') + if (value = attributes[:'variant_items']).is_a?(Array) + self.variant_items = value + end + end + + if attributes.key?(:'variations') + if (value = attributes[:'variations']).is_a?(Array) + self.variations = value + end + end + + if attributes.key?(:'wishlist_member') + self.wishlist_member = attributes[:'wishlist_member'] + 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 !@description.nil? && @description.to_s.length > 512 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 512.') + end + + if !@merchant_id.nil? && @merchant_id.to_s.length > 5 + invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.') + end + + if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 + invalid_properties.push('invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.') + 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 !@description.nil? && @description.to_s.length > 512 + return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5 + return false if !@merchant_item_id.nil? && @merchant_item_id.to_s.length > 20 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length > 512 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 512.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] merchant_id Value to be assigned + def merchant_id=(merchant_id) + if !merchant_id.nil? && merchant_id.to_s.length > 5 + fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.' + end + + @merchant_id = merchant_id + end + + # Custom attribute writer method with validation + # @param [Object] merchant_item_id Value to be assigned + def merchant_item_id=(merchant_item_id) + if !merchant_item_id.nil? && merchant_item_id.to_s.length > 20 + fail ArgumentError, 'invalid value for "merchant_item_id", the character length must be smaller than or equal to 20.' + end + + @merchant_item_id = merchant_item_id + 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 && + accounting == o.accounting && + amember == o.amember && + auto_order == o.auto_order && + ccbill == o.ccbill && + channel_partner_item_mappings == o.channel_partner_item_mappings && + chargeback == o.chargeback && + checkout == o.checkout && + content == o.content && + creation_dts == o.creation_dts && + description == o.description && + description_translated_text_instance_oid == o.description_translated_text_instance_oid && + digital_delivery == o.digital_delivery && + ebay == o.ebay && + email_notifications == o.email_notifications && + enrollment123 == o.enrollment123 && + fulfillment_addons == o.fulfillment_addons && + gift_certificate == o.gift_certificate && + google_product_search == o.google_product_search && + identifiers == o.identifiers && + inactive == o.inactive && + instant_payment_notifications == o.instant_payment_notifications && + internal == o.internal && + kit == o.kit && + kit_component_only == o.kit_component_only && + kit_definition == o.kit_definition && + last_modified_dts == o.last_modified_dts && + merchant_id == o.merchant_id && + merchant_item_id == o.merchant_item_id && + merchant_item_oid == o.merchant_item_oid && + options == o.options && + parent_category_id == o.parent_category_id && + parent_category_path == o.parent_category_path && + payment_processing == o.payment_processing && + physical == o.physical && + pricing == o.pricing && + properties == o.properties && + realtime_pricing == o.realtime_pricing && + recommend_replenishment_days == o.recommend_replenishment_days && + related == o.related && + reporting == o.reporting && + restriction == o.restriction && + revguard == o.revguard && + reviews == o.reviews && + salesforce == o.salesforce && + shipping == o.shipping && + tags == o.tags && + tax == o.tax && + third_party_email_marketing == o.third_party_email_marketing && + variant_items == o.variant_items && + variations == o.variations && + wishlist_member == o.wishlist_member + 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 + [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].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<(?<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 + # 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