Class: PaygatePk::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/paygate_pk/config.rb

Overview

Global configuration for PaygatePk

Defined Under Namespace

Classes: ProviderConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



9
10
11
12
13
14
15
16
17
18
# File 'lib/paygate_pk/config.rb', line 9

def initialize
  @logger = nil
  @default_currency = "PKR"
  @timeouts = { open_timeout: 5, read_timeout: 10 }
  @retry = { max: 2, interval: 0.2, backoff_factor: 2.0, retry_statuses: [429, 500, 502, 503, 504] }
  @user_agent = "paygate_pk/#{PaygatePk::VERSION}"

  @pay_fast = ProviderConfig.new
  @frozen = false
end

Instance Attribute Details

#default_currencyObject

Returns the value of attribute default_currency.



6
7
8
# File 'lib/paygate_pk/config.rb', line 6

def default_currency
  @default_currency
end

#loggerObject

Returns the value of attribute logger.



6
7
8
# File 'lib/paygate_pk/config.rb', line 6

def logger
  @logger
end

#pay_fastObject (readonly)

Returns the value of attribute pay_fast.



7
8
9
# File 'lib/paygate_pk/config.rb', line 7

def pay_fast
  @pay_fast
end

#retryObject

Returns the value of attribute retry.



6
7
8
# File 'lib/paygate_pk/config.rb', line 6

def retry
  @retry
end

#timeoutsObject

Returns the value of attribute timeouts.



6
7
8
# File 'lib/paygate_pk/config.rb', line 6

def timeouts
  @timeouts
end

#user_agentObject

Returns the value of attribute user_agent.



6
7
8
# File 'lib/paygate_pk/config.rb', line 6

def user_agent
  @user_agent
end

Instance Method Details

#freeze!Object



20
21
22
23
# File 'lib/paygate_pk/config.rb', line 20

def freeze!
  @frozen = true
  self
end

#frozen?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/paygate_pk/config.rb', line 25

def frozen?
  @frozen
end