Class: Nokotime::Configuration

Inherits:
Object
  • Object
show all
Includes:
Authentication
Defined in:
lib/nokotime/configuration.rb

Constant Summary collapse

DEFAULT_URL =
"https://api.nokotime.com".freeze

Constants included from Authentication

Authentication::AUTHENTICATION_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Authentication

#authorize_request, #valid_auth?

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
# File 'lib/nokotime/configuration.rb', line 12

def initialize
  @auth_type = nil
  @max_concurrency = nil
  @token = nil
  @url = DEFAULT_URL
end

Instance Attribute Details

#auth_typeObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/nokotime/configuration.rb', line 19

def auth_type
  unless valid_auth?(@auth_type)
    raise(
      Errors::Configuration,
      "#{@auth_type} isn't valid type authentication."
    )
  end

  @auth_type || raise(
    Errors::Configuration, "Authentication type missing."
  )
end

#max_concurrencyObject



32
33
34
35
36
# File 'lib/nokotime/configuration.rb', line 32

def max_concurrency
  @max_concurrency || raise(
    Errors::Configuration, "Max concurrency missing."
  )
end

#tokenObject



38
39
40
41
42
# File 'lib/nokotime/configuration.rb', line 38

def token
  @token || raise(
    Errors::Configuration, "Token missing."
  )
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/nokotime/configuration.rb', line 8

def url
  @url
end