Module: WorldTimeApi
- Defined in:
- lib/world_time_api.rb,
lib/world_time_api/error.rb,
lib/world_time_api/request.rb,
lib/world_time_api/version.rb,
lib/world_time_api/response.rb
Overview
A Ruby wrapper for the World Time API.
Defined Under Namespace
Modules: Request
Constant Summary collapse
- Timezones =
Returns a list of all timezones supported by the World Time API.
-> { Request::Call["/timezone"] }
- Time =
Returns the current time for the specified timezone.
->(timezone) { Request::Call["/timezone/#{timezone}"] }
- ClientIp =
Returns the current time for the client’s IP address, or for the specified IP address if provided.
->(ip = nil) { Request::Call["/ip#{ip ? "/#{ip}" : ""}"] }
- AreaTimezones =
Returns a list of all timezones for a given area.
->(area) { Request::Call["/timezone/#{area}"] }
- LocationTimezones =
Returns a list of all timezones for a given area and location.
->(area, location) { Request::Call["/timezone/#{area}/#{location}"] }
- RegionTime =
Returns the current time for a given area, location, and region.
->(area, location, region) { Request::Call["/timezone/#{area}/#{location}/#{region}"] }
- TimezonesTxt =
Returns a list of all timezones in plain text format.
-> { Request::Call["/timezone.txt"] }
- AreaTimezonesTxt =
Returns a list of all timezones for a given area in plain text format.
->(area) { Request::Call["/timezone/#{area}.txt"] }
- LocationTimezonesTxt =
Returns a list of all timezones for a given area and location in plain text format.
->(area, location) { Request::Call["/timezone/#{area}/#{location}.txt"] }
- RegionTimeTxt =
Returns the current time for a given area, location, and region in plain text format.
->(area, location, region) { Request::Call["/timezone/#{area}/#{location}/#{region}.txt"] }
- ClientIpTxt =
Returns the current time for the client’s IP address in plain text format, or for the specified IP address if provided.
->(ip = nil) { Request::Call["/ip#{ip ? "/#{ip}" : ""}.txt"] }
- Error =
Creates an error object with the specified message.
->() { { error: } }
- VERSION =
The current version number of the WorldTimeApi gem.
"0.1.8"- Response =
Converts the HTTParty response object into a hash.
->(response) { JSON.parse(response.body) }