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

The WorldTimeApi module contains methods for making requests to 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.

Returns:

-> { Request::Call["/timezone"] }
Time =

Returns the current time for the specified timezone.

Returns:

-> (timezone) { Request::Call["/timezone/#{timezone}"] }
ClientIp =

Returns the current time for the client's IP address, or for the specified IP address if provided.

Returns:

-> (ip = nil) { Request::Call["/ip#{ip ? "/#{ip}" : ''}"] }
Error =

Creates an error object with the specified message.

Returns:

  • (Hash)

    A hash with a single key `“error”` containing the error message.

-> (message) { { error: message } }
VERSION =

The current version number of the WorldTimeApi gem.

"0.1.5"
Response =

Converts the HTTParty response object into a hash.

Returns:

  • (Hash)

    A hash representation of the response body.

-> (response) { JSON.parse(response.body) }