Class: OxTenderAbstract::Configuration
- Inherits:
-
Object
- Object
- OxTenderAbstract::Configuration
- Defined in:
- lib/oxtenderabstract/configuration.rb
Overview
Configuration for the library
Instance Attribute Summary collapse
-
#auto_wait_on_block ⇒ Object
Returns the value of attribute auto_wait_on_block.
-
#block_wait_time ⇒ Object
Returns the value of attribute block_wait_time.
- #logger ⇒ Object
-
#max_wait_time ⇒ Object
Returns the value of attribute max_wait_time.
-
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
-
#timeout_open ⇒ Object
Returns the value of attribute timeout_open.
-
#timeout_read ⇒ Object
Returns the value of attribute timeout_read.
-
#token ⇒ Object
Returns the value of attribute token.
- #wsdl_url ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #token_from_file(file_path) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/oxtenderabstract/configuration.rb', line 12 def initialize @token = nil @timeout_open = 30 @timeout_read = 120 @ssl_verify = false @wsdl_url = nil # Will be set later @logger = nil # Will be set later @auto_wait_on_block = true # Автоматически ждать при блокировке @block_wait_time = 610 # Время ожидания при блокировке (10 мин + 10 сек) @max_wait_time = 900 # Максимальное время ожидания (15 мин) end |
Instance Attribute Details
#auto_wait_on_block ⇒ Object
Returns the value of attribute auto_wait_on_block.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def auto_wait_on_block @auto_wait_on_block end |
#block_wait_time ⇒ Object
Returns the value of attribute block_wait_time.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def block_wait_time @block_wait_time end |
#logger ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/oxtenderabstract/configuration.rb', line 28 def logger @logger ||= Logger.new($stdout).tap do |log| log.level = Logger::INFO log.formatter = proc do |severity, datetime, progname, msg| "[#{datetime.strftime('%Y-%m-%d %H:%M:%S')}] #{severity}: #{msg}\n" end end end |
#max_wait_time ⇒ Object
Returns the value of attribute max_wait_time.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def max_wait_time @max_wait_time end |
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def ssl_verify @ssl_verify end |
#timeout_open ⇒ Object
Returns the value of attribute timeout_open.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def timeout_open @timeout_open end |
#timeout_read ⇒ Object
Returns the value of attribute timeout_read.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def timeout_read @timeout_read end |
#token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/oxtenderabstract/configuration.rb', line 8 def token @token end |
#wsdl_url ⇒ Object
24 25 26 |
# File 'lib/oxtenderabstract/configuration.rb', line 24 def wsdl_url @wsdl_url ||= DocumentTypes::API_CONFIG[:wsdl] end |
Instance Method Details
#token_from_file(file_path) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/oxtenderabstract/configuration.rb', line 41 def token_from_file(file_path) return nil unless File.exist?(file_path) content = File.read(file_path).strip content.empty? ? nil : content end |
#valid? ⇒ Boolean
37 38 39 |
# File 'lib/oxtenderabstract/configuration.rb', line 37 def valid? !token.nil? && !token.empty? end |