Class: Timezone::Lookup::Basic
- Inherits:
-
Object
- Object
- Timezone::Lookup::Basic
- Defined in:
- lib/timezone/lookup/basic.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(config) ⇒ Basic
constructor
A new instance of Basic.
- #lookup(lat, lng) ⇒ Object
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
#config ⇒ Object (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
#client ⇒ Object
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
24 25 26 |
# File 'lib/timezone/lookup/basic.rb', line 24 def lookup(lat, lng) raise NoMethodError, 'lookup is not implemented' end |