Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/bs2_api/configuration.rb
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#env ⇒ Object
Returns the value of attribute env.
-
#pix_key ⇒ Object
Returns the value of attribute pix_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 |
# File 'lib/bs2_api/configuration.rb', line 6 def initialize @env = ENV.fetch('BS2_ENVIRONMENT', 'sandbox') @client_id = ENV.fetch('BS2_CLIENT_ID', nil) @client_secret = ENV.fetch('BS2_CLIENT_SECRET', nil) end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/bs2_api/configuration.rb', line 4 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
4 5 6 |
# File 'lib/bs2_api/configuration.rb', line 4 def client_secret @client_secret end |
#env ⇒ Object
Returns the value of attribute env.
4 5 6 |
# File 'lib/bs2_api/configuration.rb', line 4 def env @env end |
#pix_key ⇒ Object
Returns the value of attribute pix_key.
4 5 6 |
# File 'lib/bs2_api/configuration.rb', line 4 def pix_key @pix_key end |
Instance Method Details
#valid? ⇒ Boolean
12 13 14 15 16 |
# File 'lib/bs2_api/configuration.rb', line 12 def valid? raise Bs2Api::Errors::MissingConfiguration, 'Missing configuration credentials' if @client_id.blank? || @client_secret.blank? true end |