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.



17811
17812
17813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17811

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17809
17810
17811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17809

def value
  @value
end

Class Method Details

.ALLObject



17831
17832
17833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17831

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



17816
17817
17818
17819
17820
17821
17822
17823
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17816

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



17845
17846
17847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17845

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

.expiredObject



17840
17841
17842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17840

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



17826
17827
17828
17829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17826

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



17850
17851
17852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17850

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

.invalidObject

Generic error type



17836
17837
17838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17836

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



17855
17856
17857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17855

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

Instance Method Details

#to_hashObject



17859
17860
17861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17859

def to_hash
  value
end