Class: Timezone::Lookup::Basic

Inherits:
Object
  • Object
show all
Defined in:
lib/timezone/lookup/basic.rb

Direct Known Subclasses

Geonames, Google

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Basic

Returns a new instance of Basic.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/timezone/lookup/basic.rb', line 8

def initialize(config)
  if config.protocol.nil?
    raise(::Timezone::Error::InvalidConfig, 'missing protocol')
  end

  if config.url.nil?
    raise(::Timezone::Error::InvalidConfig, 'missing url')
  end

  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/timezone/lookup/basic.rb', line 6

def config
  @config
end

Instance Method Details

#clientObject



20
21
22
# File 'lib/timezone/lookup/basic.rb', line 20

def client
  @client ||= config.http_client.new(config.protocol, config.url)
end

#lookup(lat, lng) ⇒ Object

Raises:

  • (NoMethodError)


24
25
26
# File 'lib/timezone/lookup/basic.rb', line 24

def lookup(lat, lng)
  raise NoMethodError, 'lookup is not implemented'
end