Class: CloudPayments::Config
- Inherits:
-
Object
- Object
- CloudPayments::Config
- Defined in:
- lib/cloud_payments/config.rb
Constant Summary collapse
- DEFAULT_LOGGER =
->{ require 'logger' logger = Logger.new(STDERR) logger.progname = 'cloud_payments' logger.formatter = ->(severity, datetime, progname, msg){ "#{datetime} (#{progname}): #{msg}\n" } logger }
Instance Attribute Summary collapse
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#host ⇒ Object
Returns the value of attribute host.
-
#log ⇒ Object
Returns the value of attribute log.
- #logger ⇒ Object
-
#public_key ⇒ Object
Returns the value of attribute public_key.
-
#raise_banking_errors ⇒ Object
Returns the value of attribute raise_banking_errors.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
Instance Method Summary collapse
- #available_currencies ⇒ Object
- #connection_block(&block) ⇒ Object
- #dup ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cloud_payments/config.rb', line 15 def initialize @log = false @serializer = Client::Serializer::MultiJson.new(self) = {} @connection_block = nil @host = 'https://api.cloudpayments.ru' if block_given? yield self end end |
Instance Attribute Details
#connection_options ⇒ Object
Returns the value of attribute connection_options.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def end |
#host ⇒ Object
Returns the value of attribute host.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def host @host end |
#log ⇒ Object
Returns the value of attribute log.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def log @log end |
#logger ⇒ Object
26 27 28 |
# File 'lib/cloud_payments/config.rb', line 26 def logger @logger ||= log ? DEFAULT_LOGGER.call : nil end |
#public_key ⇒ Object
Returns the value of attribute public_key.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def public_key @public_key end |
#raise_banking_errors ⇒ Object
Returns the value of attribute raise_banking_errors.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def raise_banking_errors @raise_banking_errors end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def secret_key @secret_key end |
#serializer ⇒ Object
Returns the value of attribute serializer.
4 5 6 |
# File 'lib/cloud_payments/config.rb', line 4 def serializer @serializer end |
Instance Method Details
#available_currencies ⇒ Object
30 31 32 |
# File 'lib/cloud_payments/config.rb', line 30 def available_currencies %w{RUB USD EUR} end |
#connection_block(&block) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/cloud_payments/config.rb', line 34 def connection_block(&block) if block_given? @connection_block = block else @connection_block end end |
#dup ⇒ Object
42 43 44 45 46 |
# File 'lib/cloud_payments/config.rb', line 42 def dup clone = super clone. = .dup clone end |