class IssuerResponseCodes::Context
Constants
- NOT_PROVIDED
Attributes
default_locale[R]
default_target[R]
fraud_notice_by_default[R]
Public Class Methods
new(default_target: :merchant, default_locale: :en, fraud_notice_by_default: NOT_PROVIDED)
click to toggle source
# File lib/issuer_response_codes/context.rb, line 9 def initialize(default_target: :merchant, default_locale: :en, fraud_notice_by_default: NOT_PROVIDED) @default_target = default_target @default_locale = default_locale raise IllegalLocale, "No such locale: #{default_locale.inspect}" unless AVAILABLE_LOCALES.include?(default_locale) raise IllegalTarget, "No such target: #{default_target.inspect}" unless AVAILABLE_TARGETS.include?(default_target) if fraud_notice_by_default != NOT_PROVIDED @fraud_notice_by_default = fraud_notice_by_default return end @fraud_notice_by_default = default_target == :merchant end
Public Instance Methods
code(id:, target: default_target, locale: default_locale, fraud_notice: fraud_notice_by_default)
click to toggle source
# File lib/issuer_response_codes/context.rb, line 24 def code(id:, target: default_target, locale: default_locale, fraud_notice: fraud_notice_by_default) Code.new(id: id, target: target, locale: locale, fraud_notice: fraud_notice) end
tds_code(id:, target: default_target, locale: default_locale, fraud_notice: fraud_notice_by_default)
click to toggle source
# File lib/issuer_response_codes/context.rb, line 28 def tds_code(id:, target: default_target, locale: default_locale, fraud_notice: fraud_notice_by_default) TdsCode.new(id: id, target: target, locale: locale, fraud_notice: fraud_notice) end