Class: Io::Flow::V0::Models::NoInventoryReservationError

Inherits:
ReservationError show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from ReservationError

#code

Instance Method Summary collapse

Methods inherited from ReservationError

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ NoInventoryReservationError

Returns a new instance of NoInventoryReservationError.



30555
30556
30557
30558
30559
30560
30561
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30555

def initialize(incoming={})
  super(:code => ReservationError::Types::NO_INVENTORY_RESERVATION_ERROR)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:messages, :items], 'NoInventoryReservationError')
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::NoInventoryReservationErrorItem) ? x : ::Io::Flow::V0::Models::NoInventoryReservationErrorItem.new(x)) }
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



30553
30554
30555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30553

def items
  @items
end

#messagesObject (readonly)

Returns the value of attribute messages.



30553
30554
30555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30553

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30567
30568
30569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30567

def copy(incoming={})
  NoInventoryReservationError.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



30571
30572
30573
30574
30575
30576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30571

def subtype_to_hash
  {
    :messages => messages,
    :items => items.map { |o| o.to_hash }
  }
end

#to_jsonObject



30563
30564
30565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30563

def to_json
  JSON.dump(to_hash)
end