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.



17456
17457
17458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17456

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17454
17455
17456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17454

def value
  @value
end

Class Method Details

.ALLObject



17476
17477
17478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17476

def MerchantGiftCardErrorCode.ALL
  @@all ||= [MerchantGiftCardErrorCode.invalid, MerchantGiftCardErrorCode.expired, MerchantGiftCardErrorCode.empty, MerchantGiftCardErrorCode.insufficient_funds, MerchantGiftCardErrorCode.unsupported_currency]
end

.apply(value) ⇒ Object

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



17461
17462
17463
17464
17465
17466
17467
17468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17461

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



17490
17491
17492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17490

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

.expiredObject



17485
17486
17487
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17485

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



17471
17472
17473
17474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17471

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



17495
17496
17497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17495

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

.invalidObject

Generic error type



17481
17482
17483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17481

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



17500
17501
17502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17500

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

Instance Method Details

#to_hashObject



17504
17505
17506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17504

def to_hash
  value
end