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.



17993
17994
17995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17993

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17991
17992
17993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17991

def value
  @value
end

Class Method Details

.ALLObject



18013
18014
18015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18013

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



17998
17999
18000
18001
18002
18003
18004
18005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17998

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



18027
18028
18029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18027

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

.expiredObject



18022
18023
18024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18022

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



18008
18009
18010
18011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18008

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



18032
18033
18034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18032

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

.invalidObject

Generic error type



18018
18019
18020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18018

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



18037
18038
18039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18037

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

Instance Method Details

#to_hashObject



18041
18042
18043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18041

def to_hash
  value
end