Class: Lmb::Developers::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initial config.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lmb/developers/configuration.rb', line 9

def initialize
    @config = {
        'DEV' => {
            'url': 'https://api-dev.leroymerlin.com.br'
        },
        'TEST' => {
            'url': 'https://api-test.leroymerlin.com.br'
        },
        'PROD' => {
            'url': 'https://api.leroymerlin.com.br'
        }
    }
    configure('DEV', nil)
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#environmentObject

Returns the value of attribute environment.



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

def environment
  @environment
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/lmb/developers/configuration.rb', line 6

def url
  @url
end

Instance Method Details

#configure(environment = 'DEV', api_key) ⇒ Lmb::Developers::Configuration

Configure global parameters

Parameters:

  • (defaults to: 'DEV')

    environment to consume APIs, TEST or PROD

  • ApiKey to consume APIs.

Returns:



28
29
30
31
32
33
# File 'lib/lmb/developers/configuration.rb', line 28

def configure(environment = 'DEV', api_key)
    @api_key = api_key
    @environment = environment
    @url = @config[environment][:url]
    self
end