class Io::Flow::V0::Models::ReservationError
Types
of failed inventory reservation reasons
Attributes
code[R]
Public Class Methods
from_json(hash)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15008 def ReservationError.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:code].to_s.strip if discriminator.empty? raise "Union type[reservation_error] requires a field named 'code'" end case discriminator when Types::NO_INVENTORY_RESERVATION_ERROR; NoInventoryReservationError.new(hash) when Types::EXTERNAL_API_TIMEOUT_RESERVATION_ERROR; ExternalApiTimeoutReservationError.new(hash) when Types::GENERIC_RESERVATION_ERROR; GenericReservationError.new(hash) else ReservationErrorUndefinedType.new(:code => discriminator) end end
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 14994 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:code], 'ReservationError') @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String) end
Public Instance Methods
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15000 def subtype_to_hash raise 'Cannot serialize an instance of reservation_error directly - must use one of the specific types: no_inventory_reservation_error, external_api_timeout_reservation_error, generic_reservation_error' end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15004 def to_hash subtype_to_hash.merge(:code => @code) end