Class: Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/bs2_api/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_idObject

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_secretObject

Returns the value of attribute client_secret.



4
5
6
# File 'lib/bs2_api/configuration.rb', line 4

def client_secret
  @client_secret
end

#envObject

Returns the value of attribute env.



4
5
6
# File 'lib/bs2_api/configuration.rb', line 4

def env
  @env
end

#pix_keyObject

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

Returns:

  • (Boolean)

Raises:



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