Class: Loqate::Configuration

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

Overview

Configuration for the gem

Constant Summary collapse

DEFAULT_LANGUAGE =
'en-gb'.freeze
DEFAULT_HOST =
'https://api.addressy.com'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, host: DEFAULT_HOST, language: DEFAULT_LANGUAGE) ⇒ Configuration

Instantiates the gem configuration

Parameters:

  • api_key (String)

    API key that will give you access to all services

  • host (String) (defaults to: DEFAULT_HOST)

    Base URL for Loqate’s services

  • language (String) (defaults to: DEFAULT_LANGUAGE)

    Preferred language for results



28
29
30
31
32
# File 'lib/loqate/configuration.rb', line 28

def initialize(api_key:, host: DEFAULT_HOST, language: DEFAULT_LANGUAGE)
  @api_key  = api_key
  @host     = host
  @language = language
end

Instance Attribute Details

#api_keyString (readonly)

API key that will give you access to all services.

Returns:

  • (String)


10
11
12
# File 'lib/loqate/configuration.rb', line 10

def api_key
  @api_key
end

#hostString (readonly)

Base URL for Loqate’s services. Defaults to api.addressy.com

Returns:

  • (String)


15
16
17
# File 'lib/loqate/configuration.rb', line 15

def host
  @host
end

#languageString (readonly)

Preferred language for results. This should be a 2 or 4 character language code e.g. (en, fr, en-gb, etc).

Returns:

  • (String)


20
21
22
# File 'lib/loqate/configuration.rb', line 20

def language
  @language
end