lib/patch_ruby/models/order.rb in patch_ruby-1.0.0 vs lib/patch_ruby/models/order.rb in patch_ruby-1.1.0
- old
+ new
@@ -26,10 +26,12 @@
attr_accessor :price_cents_usd
attr_accessor :allocations
+ attr_accessor :metadata
+
class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
def initialize(datatype, allowable_values)
@@ -57,11 +59,12 @@
:'mass_g' => :'mass_g',
:'production' => :'production',
:'state' => :'state',
:'allocation_state' => :'allocation_state',
:'price_cents_usd' => :'price_cents_usd',
- :'allocations' => :'allocations'
+ :'allocations' => :'allocations',
+ :'metadata' => :'metadata'
}
end
# Attribute type mapping.
def self.openapi_types
@@ -70,11 +73,12 @@
:'mass_g' => :'Integer',
:'production' => :'Boolean',
:'state' => :'String',
:'allocation_state' => :'String',
:'price_cents_usd' => :'String',
- :'allocations' => :'Array<Allocation>'
+ :'allocations' => :'Array<Allocation>',
+ :'metadata' => :'Object'
}
end
# Allows models with corresponding API classes to delegate API operations to those API classes
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
@@ -129,26 +133,65 @@
if attributes.key?(:'allocations')
if (value = attributes[:'allocations']).is_a?(Array)
self.allocations = value
end
end
+
+ if attributes.key?(:'metadata')
+ self.metadata = attributes[:'metadata']
+ 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 @id.nil?
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
+ end
+
+ if @mass_g.nil?
+ invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
+ end
+
+ if @production.nil?
+ invalid_properties.push('invalid value for "production", production cannot be nil.')
+ end
+
+ if @state.nil?
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
+ end
+
+ if @allocation_state.nil?
+ invalid_properties.push('invalid value for "allocation_state", allocation_state cannot be nil.')
+ end
+
+ if @allocations.nil?
+ invalid_properties.push('invalid value for "allocations", allocations cannot be nil.')
+ end
+
+ if @metadata.nil?
+ invalid_properties.push('invalid value for "metadata", metadata 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 @id.nil?
+ return false if @mass_g.nil?
+ return false if @production.nil?
+ return false if @state.nil?
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
return false unless state_validator.valid?(@state)
+ return false if @allocation_state.nil?
allocation_state_validator = EnumAttributeValidator.new('String', ["pending", "partially_allocated", "allocated"])
return false unless allocation_state_validator.valid?(@allocation_state)
+ return false if @allocations.nil?
+ return false if @metadata.nil?
true
end
# Custom attribute writer method checking allowed values (enum).
# @param [Object] state Object to be assigned
@@ -179,11 +222,12 @@
mass_g == o.mass_g &&
production == o.production &&
state == o.state &&
allocation_state == o.allocation_state &&
price_cents_usd == o.price_cents_usd &&
- allocations == o.allocations
+ allocations == o.allocations &&
+ metadata == o.metadata
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
@@ -191,10 +235,10 @@
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [id, mass_g, production, state, allocation_state, price_cents_usd, allocations].hash
+ [id, mass_g, production, state, allocation_state, price_cents_usd, allocations, metadata].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself