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.



16701
16702
16703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16701

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16699
16700
16701
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16699

def value
  @value
end

Class Method Details

.ALLObject



16721
16722
16723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16721

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



16706
16707
16708
16709
16710
16711
16712
16713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16706

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



16735
16736
16737
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16735

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

.expiredObject



16730
16731
16732
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16730

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



16716
16717
16718
16719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16716

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



16740
16741
16742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16740

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

.invalidObject

Generic error type



16726
16727
16728
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16726

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



16745
16746
16747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16745

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

Instance Method Details

#to_hashObject



16749
16750
16751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16749

def to_hash
  value
end