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.



17550
17551
17552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17550

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17548
17549
17550
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17548

def value
  @value
end

Class Method Details

.ALLObject



17570
17571
17572
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17570

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



17555
17556
17557
17558
17559
17560
17561
17562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17555

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



17584
17585
17586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17584

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

.expiredObject



17579
17580
17581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17579

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



17565
17566
17567
17568
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17565

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



17589
17590
17591
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17589

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

.invalidObject

Generic error type



17575
17576
17577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17575

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

.unsupported_currencyObject

Redemption or reversal currency is not supported



17594
17595
17596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17594

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

Instance Method Details

#to_hashObject



17598
17599
17600
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17598

def to_hash
  value
end