Class: Io::Flow::V0::Models::MerchantGiftCardErrorCode

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) ⇒ MerchantGiftCardErrorCode

Returns a new instance of MerchantGiftCardErrorCode.



22412
22413
22414
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22412

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



22410
22411
22412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22410

def value
  @value
end

Class Method Details

.apply(value) ⇒ Object

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



22417
22418
22419
22420
22421
22422
22423
22424
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22417

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

.emptyObject

Balance is 0



22446
22447
22448
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22446

def MerchantGiftCardErrorCode.empty
  @@_empty ||= MerchantGiftCardErrorCode.new('empty')
end

.expiredObject



22441
22442
22443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22441

def MerchantGiftCardErrorCode.expired
  @@_expired ||= MerchantGiftCardErrorCode.new('expired')
end

.from_string(value) ⇒ Object

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



22427
22428
22429
22430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22427

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

.insufficient_fundsObject

Redemption amount greater than balance



22451
22452
22453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22451

def MerchantGiftCardErrorCode.insufficient_funds
  @@_insufficient_funds ||= MerchantGiftCardErrorCode.new('insufficient_funds')
end

.invalidObject

Generic error type



22437
22438
22439
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22437

def MerchantGiftCardErrorCode.invalid
  @@_invalid ||= MerchantGiftCardErrorCode.new('invalid')
end

.unsupported_currencyObject

Redemption or reversal currency is not supported



22456
22457
22458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22456

def MerchantGiftCardErrorCode.unsupported_currency
  @@_unsupported_currency ||= MerchantGiftCardErrorCode.new('unsupported_currency')
end

Instance Method Details

#to_hashObject



22460
22461
22462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22460

def to_hash
  value
end