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.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16771
16772
16773
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16771

def value
  @value
end

Class Method Details

.ALLObject



16793
16794
16795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16793

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



16778
16779
16780
16781
16782
16783
16784
16785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16778

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



16807
16808
16809
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16807

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

.expiredObject



16802
16803
16804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16802

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



16788
16789
16790
16791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16788

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



16812
16813
16814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16812

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

.invalidObject

Generic error type



16798
16799
16800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16798

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



16817
16818
16819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16817

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

Instance Method Details

#to_hashObject



16821
16822
16823
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16821

def to_hash
  value
end