Class: KOSapiClient::Configuration

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

Constant Summary collapse

DEFAULT_OPTIONS =
{
  base_url: 'https://kosapi.fit.cvut.cz/api/3'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Returns a new instance of Configuration.



8
9
10
11
12
# File 'lib/kosapi_client/configuration.rb', line 8

def initialize(options = {})
  DEFAULT_OPTIONS.merge(options).each do |option, value|
    self[option] = value
  end
end

Instance Attribute Details

#auth_urlObject

Returns the value of attribute auth_url

Returns:

  • (Object)

    the current value of auth_url



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def auth_url
  @auth_url
end

#base_urlObject

Returns the value of attribute base_url

Returns:

  • (Object)

    the current value of base_url



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def base_url
  @base_url
end

#client_idObject

Returns the value of attribute client_id

Returns:

  • (Object)

    the current value of client_id



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret

Returns:

  • (Object)

    the current value of client_secret



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def client_secret
  @client_secret
end

#connection_optsObject

Returns the value of attribute connection_opts

Returns:

  • (Object)

    the current value of connection_opts



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def connection_opts
  @connection_opts
end

#token_urlObject

Returns the value of attribute token_url

Returns:

  • (Object)

    the current value of token_url



2
3
4
# File 'lib/kosapi_client/configuration.rb', line 2

def token_url
  @token_url
end

Instance Method Details

#credentialsObject



14
15
16
17
18
19
20
# File 'lib/kosapi_client/configuration.rb', line 14

def credentials
  if client_id && client_secret
    {client_id: client_id, client_secret: client_secret}
  else
    {}
  end
end