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.



16995
16996
16997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16995

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16993
16994
16995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16993

def value
  @value
end

Class Method Details

.ALLObject



17015
17016
17017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17015

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



17000
17001
17002
17003
17004
17005
17006
17007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17000

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



17029
17030
17031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17029

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

.expiredObject



17024
17025
17026
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17024

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



17010
17011
17012
17013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17010

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



17034
17035
17036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17034

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

.invalidObject

Generic error type



17020
17021
17022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17020

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



17039
17040
17041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17039

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

Instance Method Details

#to_hashObject



17043
17044
17045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17043

def to_hash
  value
end