class Locotimezone::Locotime
Attributes
address[R]
location[RW]
skip[R]
Public Class Methods
new(address:, location:, skip:)
click to toggle source
# File lib/locotimezone/locotime.rb, line 9 def initialize(address:, location:, skip:) @location = location @address = address @skip = location ? :location : skip end
Public Instance Methods
call()
click to toggle source
# File lib/locotimezone/locotime.rb, line 15 def call validate_options ResultsFormatter.build_hash_for(geolocation, timezone) end
Private Instance Methods
geolocation()
click to toggle source
# File lib/locotimezone/locotime.rb, line 30 def geolocation return if skip == :location results = Geolocate.new(address).call @location = results[:location] || {} results end
options_invalid?()
click to toggle source
# File lib/locotimezone/locotime.rb, line 26 def options_invalid? address.nil? && (skip == :timezone || skip.nil?) end
timezone()
click to toggle source
# File lib/locotimezone/locotime.rb, line 37 def timezone return if skip == :timezone Timezone.new(location).call end
validate_options()
click to toggle source
# File lib/locotimezone/locotime.rb, line 22 def validate_options raise InvalidOptionsError if options_invalid? end