Class: UnivapayClientSdk::TransactionHistoryMode

Inherits:
Object
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/transaction_history_mode.rb

Overview

Environment mode: live and test reflect the credential used to authenticate, while live_test is reserved for privileged callers testing against live-mode data.

Constant Summary collapse

TRANSACTION_HISTORY_MODE =
[
  # TODO: Write general description for LIVE
  LIVE = 'live'.freeze,

  # TODO: Write general description for TEST
  TEST = 'test'.freeze,

  # TODO: Write general description for LIVE_TEST
  LIVE_TEST = 'live_test'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = LIVE) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/univapay_client_sdk/models/transaction_history_mode.rb', line 28

def self.from_value(value, default_value = LIVE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'live' then LIVE
  when 'test' then TEST
  when 'live_test' then LIVE_TEST
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/univapay_client_sdk/models/transaction_history_mode.rb', line 22

def self.validate(value)
  return false if value.nil?

  TRANSACTION_HISTORY_MODE.include?(value)
end