Class: Io::Flow::V0::Models::OrderErrorCode

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ OrderErrorCode

Returns a new instance of OrderErrorCode.



6427
6428
6429
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6427

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6425
6426
6427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6425

def value
  @value
end

Class Method Details

.ALLObject



6447
6448
6449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6447

def OrderErrorCode.ALL
  @@all ||= [OrderErrorCode.generic_error, OrderErrorCode.order_item_not_available]
end

.apply(value) ⇒ Object

Returns the instance of OrderErrorCode for this value, creating a new instance for an unknown value



6432
6433
6434
6435
6436
6437
6438
6439
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6432

def OrderErrorCode.apply(value)
  if value.instance_of?(OrderErrorCode)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || OrderErrorCode.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of OrderErrorCode for this value, or nil if not found



6442
6443
6444
6445
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6442

def OrderErrorCode.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  OrderErrorCode.ALL.find { |v| v.value == value }
end

.generic_errorObject



6451
6452
6453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6451

def OrderErrorCode.generic_error
  @@_generic_error ||= OrderErrorCode.new('generic_error')
end

.order_item_not_availableObject

When creating an order, if a particular item is not available in the country / destination (either because it was restricted or excluded from that country), we return this error code and list the specific item numbers which are not available in the ‘numbers’ field.



6459
6460
6461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6459

def OrderErrorCode.order_item_not_available
  @@_order_item_not_available ||= OrderErrorCode.new('order_item_not_available')
end

Instance Method Details

#to_hashObject



6463
6464
6465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6463

def to_hash
  value
end