lib/patch_ruby/models/order.rb in patch_ruby-1.5.2 vs lib/patch_ruby/models/order.rb in patch_ruby-1.6.0

- old
+ new

@@ -36,10 +36,13 @@ attr_accessor :patch_fee_cents_usd # An array containing the inventory allocations for this order. attr_accessor :allocations + # The url of this order in the public registry. + attr_accessor :registry_url + # An optional JSON object containing metadata for this order. attr_accessor :metadata class EnumAttributeValidator attr_reader :datatype @@ -72,10 +75,11 @@ :'state' => :'state', :'allocation_state' => :'allocation_state', :'price_cents_usd' => :'price_cents_usd', :'patch_fee_cents_usd' => :'patch_fee_cents_usd', :'allocations' => :'allocations', + :'registry_url' => :'registry_url', :'metadata' => :'metadata' } end # Attribute type mapping. @@ -87,10 +91,11 @@ :'state' => :'String', :'allocation_state' => :'String', :'price_cents_usd' => :'String', :'patch_fee_cents_usd' => :'String', :'allocations' => :'Array<Allocation>', + :'registry_url' => :'String', :'metadata' => :'Object' } end # Set with nullable attributes. @@ -162,10 +167,14 @@ if (value = attributes[:'allocations']).is_a?(Array) self.allocations = value end end + if attributes.key?(:'registry_url') + self.registry_url = attributes[:'registry_url'] + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end end @@ -219,11 +228,11 @@ return false if @mass_g.nil? return false if @mass_g > 2000000000 return false if @mass_g < 0 return false if @production.nil? return false if @state.nil? - state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"]) + state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "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? @@ -250,11 +259,11 @@ end # Custom attribute writer method checking allowed values (enum). # @param [Object] state Object to be assigned def state=(state) - validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"]) + validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "complete", "cancelled"]) unless validator.valid?(state) fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." end @state = state end @@ -280,10 +289,11 @@ state == o.state && allocation_state == o.allocation_state && price_cents_usd == o.price_cents_usd && patch_fee_cents_usd == o.patch_fee_cents_usd && allocations == o.allocations && + registry_url == o.registry_url && metadata == o.metadata end # @see the `==` method # @param [Object] Object to be compared @@ -292,10 +302,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, patch_fee_cents_usd, allocations, metadata].hash + [id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself