Module: FootballData::Configuration

Included in:
FootballData
Defined in:
lib/football__data/configuration.rb

Constant Summary collapse

DEFAULT_API_KEY =
nil
DEFAULT_API_VERSON =
"alpha"
DEFAULT_RESPONSE_CONTROL =
"full"
API_ENDPOINT =
"http://api.football-data.org"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_key=(value) ⇒ Object (writeonly)

Sets the attribute api_key


9
10
11
# File 'lib/football__data/configuration.rb', line 9

def api_key=(value)
  @api_key = value
end

#api_version=(value) ⇒ Object (writeonly)

Sets the attribute api_version


9
10
11
# File 'lib/football__data/configuration.rb', line 9

def api_version=(value)
  @api_version = value
end

#response_control=(value) ⇒ Object (writeonly)

Sets the attribute response_control


9
10
11
# File 'lib/football__data/configuration.rb', line 9

def response_control=(value)
  @response_control = value
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:


11
12
13
14
15
16
# File 'lib/football__data/configuration.rb', line 11

def configure
    raise "don't you wanna configure it?" unless block_given?
    yield self
    @api_version ||= DEFAULT_API_VERSON
    @response_control ||= DEFAULT_RESPONSE_CONTROL
end

#reset!Object


18
19
20
21
22
# File 'lib/football__data/configuration.rb', line 18

def reset!
    @api_key = DEFAULT_API_KEY
    @api_version = DEFAULT_API_VERSON
    @response_control = DEFAULT_RESPONSE_CONTROL
end