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.



16594
16595
16596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16594

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16592
16593
16594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16592

def value
  @value
end

Class Method Details

.ALLObject



16614
16615
16616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16614

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



16599
16600
16601
16602
16603
16604
16605
16606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

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



16628
16629
16630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16628

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

.expiredObject



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

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



16609
16610
16611
16612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16609

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



16633
16634
16635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16633

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

.invalidObject

Generic error type



16619
16620
16621
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16619

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



16638
16639
16640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16638

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

Instance Method Details

#to_hashObject



16642
16643
16644
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16642

def to_hash
  value
end