Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Ruby wrapper for the WorldTimeEngine.com API
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.md
README.md
Rakefile
worldtimeengine.gemspec

README.md

Build Status

The WorldTimeEngine.com Ruby gem

Convert any IP address to current local time.

http://worldtimeengine.com/api/ip

Installation

Install the gem:

$ gem install worldtimeengine

Add it to your Gemfile:

gem 'worldtimeengine'

Configuration

WorldTimeEngine.configure do |config|
  config.api_key = YOUR_API_KEY
  config.timeout = 2 # in seconds
end

Synopsis

response = WorldTimeEngine.api('193.174.32.100')

response.version
=> '1.1'
response.location.region
=> 'Germany'
response.location.latitude
=> 53.25
response.location.longitude
=> 10.4

response.time.utc
=> 2012-08-25 14:10:29 UTC
response.time.local
=> 2012-08-25 16:10:29 +0200

response.time.zone.has_dst
=> true
response.time.zone.current.abbreviation
=> "CEST"
response.time.zone.current.description
=> "Central European Summer Time"
response.time.zone.current.utc_offset
=> '+02:00'
response.time.zone.current.is_dst
=> true
response.time.zone.current.effective_until
=> 2012-10-28 03:00:00 +0200

response.time.zone.next.abbreviation
=> 'CET'
response.time.zone.next.description
=> "Central European Time"
response.time.zone.next.utc_offset
=> "+01:00"
response.time.zone.next.is_dst
=> false
response.time.zone.next.effective_until
=> 2013-03-31 02:00:00 +0100

Copyright

Copyright (c) 2012 Nikita Fedyashev. See LICENSE for details.

Something went wrong with that request. Please try again.