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.



20715
20716
20717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20715

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20713
20714
20715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20713

def value
  @value
end

Class Method Details

.ALLObject



20735
20736
20737
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20735

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



20720
20721
20722
20723
20724
20725
20726
20727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20720

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



20749
20750
20751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20749

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

.expiredObject



20744
20745
20746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20744

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



20730
20731
20732
20733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20730

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



20754
20755
20756
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20754

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

.invalidObject

Generic error type



20740
20741
20742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20740

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



20759
20760
20761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20759

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

Instance Method Details

#to_hashObject



20763
20764
20765
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20763

def to_hash
  value
end