lib/VoucherifySdk/models/order_item.rb in voucherify-5.0.0 vs lib/VoucherifySdk/models/order_item.rb in voucherify-6.0.0
- old
+ new
@@ -13,20 +13,20 @@
require 'date'
require 'time'
module VoucherifySdk
class OrderItem
- # A unique SKU ID assigned by Voucherify.
+ # Unique identifier of the SKU. It is assigned by Voucherify.
attr_accessor :sku_id
- # A unique product ID assigned by Voucherify.
+ # Unique identifier of the product. It is assigned by Voucherify.
attr_accessor :product_id
# Used along with the source_id property, can be set to either sku or product.
attr_accessor :related_object
- # The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service.
+ # The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service.
attr_accessor :source_id
# The quantity of the particular item in the cart.
attr_accessor :quantity
@@ -37,11 +37,11 @@
attr_accessor :initial_quantity
# The total amount of the order item (price * quantity).
attr_accessor :amount
- # Sum of all order-item-level discounts applied to the order.
+ # Sum of all order-item-level discounts applied to the order.
attr_accessor :discount_amount
# A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.
attr_accessor :initial_amount
@@ -50,11 +50,11 @@
attr_accessor :product
attr_accessor :sku
- # A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format.
+ # A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format.
attr_accessor :metadata
class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
@@ -123,25 +123,32 @@
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
+ :'sku_id',
+ :'product_id',
+ :'related_object',
+ :'source_id',
+ :'quantity',
+ :'discount_quantity',
+ :'initial_quantity',
+ :'amount',
+ :'discount_amount',
+ :'initial_amount',
+ :'price',
+ :'product',
+ :'sku',
+ :'metadata'
])
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 `VoucherifySdk::OrderItem` 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 `VoucherifySdk::OrderItem`. 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?(:'sku_id')
self.sku_id = attributes[:'sku_id']
@@ -213,19 +220,9 @@
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
related_object_validator = EnumAttributeValidator.new('String', ["product", "sku"])
return false unless related_object_validator.valid?(@related_object)
true
- end
-
- # Custom attribute writer method checking allowed values (enum).
- # @param [Object] related_object Object to be assigned
- def related_object=(related_object)
- validator = EnumAttributeValidator.new('String', ["product", "sku"])
- unless validator.valid?(related_object)
- fail ArgumentError, "invalid value for \"related_object\", must be one of #{validator.allowable_values}."
- end
- @related_object = related_object
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)