Class: WalletPay::Configuration
- Inherits:
-
Object
- Object
- WalletPay::Configuration
- Defined in:
- lib/wallet_pay.rb
Constant Summary collapse
- DEFAULT_URI_BASE =
"https://pay.wallet.tg/wpay/store-api/"- DEFAULT_REQUEST_TIMEOUT =
20- DEFAULT_API_VERSION =
"v1"
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#connection_open_timeout ⇒ Object
Returns the value of attribute connection_open_timeout.
-
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
- #token ⇒ Object
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 22 |
# File 'lib/wallet_pay.rb', line 15 def initialize @token = nil @extra_headers = nil @url = DEFAULT_URI_BASE @api_version = DEFAULT_API_VERSION @request_timeout = DEFAULT_REQUEST_TIMEOUT @connection_open_timeout = DEFAULT_REQUEST_TIMEOUT end |
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
9 10 11 |
# File 'lib/wallet_pay.rb', line 9 def api_version @api_version end |
#connection_open_timeout ⇒ Object
Returns the value of attribute connection_open_timeout.
9 10 11 |
# File 'lib/wallet_pay.rb', line 9 def connection_open_timeout @connection_open_timeout end |
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
9 10 11 |
# File 'lib/wallet_pay.rb', line 9 def extra_headers @extra_headers end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
9 10 11 |
# File 'lib/wallet_pay.rb', line 9 def request_timeout @request_timeout end |
#token ⇒ Object
24 25 26 27 28 29 |
# File 'lib/wallet_pay.rb', line 24 def token return @token if @token error_text = "WalletPay api token missing!" raise ConfigurationError, error_text end |
#url ⇒ Object
Returns the value of attribute url.
9 10 11 |
# File 'lib/wallet_pay.rb', line 9 def url @url end |
Instance Method Details
#headers ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/wallet_pay.rb', line 31 def headers { "Content-Type" => "application/json", "Wpay-Store-Api-Key" => token, "Accept" => "application/json" }.merge(extra_headers || {}) end |