Class: TimeLogic::Api::TimeApi

Inherits:
Object
  • Object
show all
Defined in:
lib/timelogic-api/api/time_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TimeApi

Returns a new instance of TimeApi.



19
20
21
# File 'lib/timelogic-api/api/time_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/timelogic-api/api/time_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_time(opts = {}) ⇒ TimePayload

Add modifiers to a timestamp Adds seconds, minutes, hours, and days to an optional base timestamp. Input timestamp forms: - unix=1711300000 - unix_ms=1711300000000 - iso=2026-04-16T09:00:00Z - iso=2026-04-16T09:00:00&source_tz=America/New_York - iso=2026-04-16T09:00:00&source_ip=8.8.8.8 - iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060 - iso=2026-04-16T09:00:00&source_offset=-05:00 - if no input timestamp is provided, the base timestamp defaults to the request time Modifiers: - seconds=30 - minutes=15 - hours=2 - days=7 Target selector forms: - tz=America/New_York - ip=8.8.8.8 - lat=40.7128&lon=-74.0060 - offset=-04:00 - auto_tz=true - utc=true Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of source_tz, source_ip, source_lat/source_lon, or source_offset - local-ISO companion selectors are valid only with iso=... that has no explicit offset - bulk is not supported on this route Examples: - /v1/time/add?iso=2026-04-16T09:00:00&source_tz=America/New_York&days=1&tz=Europe/London - /v1/time/add?minutes=30&utc=true

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :seconds (Integer)
  • :minutes (Integer)
  • :hours (Integer)
  • :days (Integer)
  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :utc (Boolean)

    Set to `true` to force UTC on routes that support it.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



47
48
49
50
# File 'lib/timelogic-api/api/time_api.rb', line 47

def add_time(opts = {})
  data, _status_code, _headers = add_time_with_http_info(opts)
  data
end

#add_time_with_http_info(opts = {}) ⇒ Array<(TimePayload, Integer, Hash)>

Add modifiers to a timestamp Adds `seconds`, `minutes`, `hours`, and `days` to an optional base timestamp. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the base timestamp defaults to the request time Modifiers: - `seconds=30` - `minutes=15` - `hours=2` - `days=7` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/add?iso=2026-04-16T09:00:00&source_tz=America/New_York&days=1&tz=Europe/London` - `/v1/time/add?minutes=30&utc=true`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :seconds (Integer)
  • :minutes (Integer)
  • :hours (Integer)
  • :days (Integer)
  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :utc (Boolean)

    Set to `true` to force UTC on routes that support it.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(TimePayload, Integer, Hash)>)

    TimePayload data, response status code and response headers



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/timelogic-api/api/time_api.rb', line 77

def add_time_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.add_time ...'
  end
  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.add_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.add_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.add_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.add_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.add_time, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.add_time, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.add_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.add_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.add_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.add_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.add_time, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/add'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
  query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
  query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
  query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
  query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
  query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
  query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
  query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
  query_params[:'seconds'] = opts[:'seconds'] if !opts[:'seconds'].nil?
  query_params[:'minutes'] = opts[:'minutes'] if !opts[:'minutes'].nil?
  query_params[:'hours'] = opts[:'hours'] if !opts[:'hours'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'utc'] = opts[:'utc'] if !opts[:'utc'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'TimePayload'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.add_time",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#add_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#convert_time(opts = {}) ⇒ GetCurrentTime200Response

Convert a timestamp into a target timezone or offset Converts one required input timestamp into a single target or a bulk array. Input timestamp forms: - unix=1711300000 - unix_ms=1711300000000 - iso=2026-04-16T09:00:00Z - iso=2026-04-16T09:00:00&source_tz=America/New_York - iso=2026-04-16T09:00:00&source_ip=8.8.8.8 - iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060 - iso=2026-04-16T09:00:00&source_offset=-05:00 Target selector forms: - tz=America/New_York - ip=8.8.8.8 - lat=40.7128&lon=-74.0060 - offset=-04:00 - auto_tz=true - utc=true Incompatible combinations: - exactly one input timestamp form - exactly one target selector family - use at most one of source_tz, source_ip, source_lat/source_lon, or source_offset - local-ISO companion selectors are valid only with iso=... that has no explicit offset - bulk is allowed only through one comma-separated tz, ip, or offset selector Examples: - Single target: /v1/time/convert?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London - Bulk target set: /v1/time/convert?unix=1711300000&offset=-04:00,+00:00,+09:00

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :utc (Boolean)

    Set to `true` to force UTC on routes that support it.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



209
210
211
212
# File 'lib/timelogic-api/api/time_api.rb', line 209

def convert_time(opts = {})
  data, _status_code, _headers = convert_time_with_http_info(opts)
  data
end

#convert_time_with_http_info(opts = {}) ⇒ Array<(GetCurrentTime200Response, Integer, Hash)>

Convert a timestamp into a target timezone or offset Converts one required input timestamp into a single target or a bulk array. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - exactly one input timestamp form - exactly one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is allowed only through one comma-separated `tz`, `ip`, or `offset` selector Examples: - Single target: `/v1/time/convert?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Bulk target set: `/v1/time/convert?unix=1711300000&offset=-04:00,+00:00,+09:00`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :utc (Boolean)

    Set to `true` to force UTC on routes that support it.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(GetCurrentTime200Response, Integer, Hash)>)

    GetCurrentTime200Response data, response status code and response headers



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/timelogic-api/api/time_api.rb', line 235

def convert_time_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.convert_time ...'
  end
  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.convert_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.convert_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.convert_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.convert_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.convert_time, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.convert_time, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.convert_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.convert_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.convert_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.convert_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.convert_time, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/convert'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
  query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
  query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
  query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
  query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
  query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
  query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
  query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'utc'] = opts[:'utc'] if !opts[:'utc'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetCurrentTime200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.convert_time",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#convert_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#diff_time(from, to, opts = {}) ⇒ DiffResponse

Difference between two instants Computes the duration between from and to. Required query fields: from and to only. Do not send every optional companion field. For each side, choose one supported specifier form. A from_* or to_* companion is allowed only when that side uses iso=... with no explicit offset; use at most one companion selector, except that coordinate input requires its paired latitude and longitude. from and to are embedded specifier strings. Accepted specifier forms: - from=now - from=unix=1711300000 - from=unix_ms=1711300000000 - from=iso=2026-04-16T09:00:00 - from=tz=America/New_York - from=ip=8.8.8.8 - from=offset=-05:00 - the same forms are accepted for to Timezone hint pairings: - from_tz only with from=iso=... that has no explicit offset - from_ip, from_lat/from_lon, and from_offset only with from=iso=... that has no explicit offset - to_tz only with to=iso=... that has no explicit offset - to_ip, to_lat/to_lon, and to_offset only with to=iso=... that has no explicit offset Selector semantics: - tz=..., ip=..., and offset=... inside from or to mean the current request-time instant resolved through that selector - those selector forms do not represent an arbitrary local wall-clock time - returned duration magnitudes are absolute; use direction to see whether to is after, before, or the same instant as from Business-day rules: - holiday_country and holiday_subdivision require business_days=true - holiday_subdivision also requires holiday_country Examples: - Selector-current instant: /v1/time/diff?from=unix=1711300000&to=tz=America/New_York - Wall-clock pairing: /v1/time/diff?from=iso=2026-04-16T09:00:00&from_tz=America/New_York&to=iso=2026-04-16T09:00:00&to_tz=Europe/London - Wall-clock via selector: /v1/time/diff?from=iso=2026-01-01T12:00:00&from_ip=8.8.8.8&to=iso=2026-01-01T12:00:00&to_offset=-05:00

Parameters:

  • from (String)

    Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `from=iso=...` together with one of `from_tz`, `from_ip`, `from_lat`+`from_lon`, or `from_offset`.

  • to (String)

    Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `to=iso=...` together with one of `to_tz`, `to_ip`, `to_lat`+`to_lon`, or `to_offset`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from_tz (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset.

  • :from_ip (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :from_lat (Float)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :from_lon (Float)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`.

  • :from_offset (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :to_tz (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset.

  • :to_ip (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :to_lat (Float)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :to_lon (Float)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`.

  • :to_offset (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :format (String)

    Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.

  • :business_days (Boolean)

    Set to `true` to enable weekday/business-day counting.

  • :holiday_country (String)

    ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.

  • :holiday_subdivision (String)

    Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



363
364
365
366
# File 'lib/timelogic-api/api/time_api.rb', line 363

def diff_time(from, to, opts = {})
  data, _status_code, _headers = diff_time_with_http_info(from, to, opts)
  data
end

#diff_time_with_http_info(from, to, opts = {}) ⇒ Array<(DiffResponse, Integer, Hash)>

Difference between two instants Computes the duration between `from` and `to`. Required query fields: `from` and `to` only. Do not send every optional companion field. For each side, choose one supported specifier form. A `from_*` or `to_*` companion is allowed only when that side uses `iso=...` with no explicit offset; use at most one companion selector, except that coordinate input requires its paired latitude and longitude. `from` and `to` are embedded specifier strings. Accepted specifier forms: - `from=now` - `from=unix=1711300000` - `from=unix_ms=1711300000000` - `from=iso=2026-04-16T09:00:00` - `from=tz=America/New_York` - `from=ip=8.8.8.8` - `from=offset=-05:00` - the same forms are accepted for `to` Timezone hint pairings: - `from_tz` only with `from=iso=...` that has no explicit offset - `from_ip`, `from_lat`/`from_lon`, and `from_offset` only with `from=iso=...` that has no explicit offset - `to_tz` only with `to=iso=...` that has no explicit offset - `to_ip`, `to_lat`/`to_lon`, and `to_offset` only with `to=iso=...` that has no explicit offset Selector semantics: - `tz=...`, `ip=...`, and `offset=...` inside `from` or `to` mean the current request-time instant resolved through that selector - those selector forms do not represent an arbitrary local wall-clock time - returned duration magnitudes are absolute; use `direction` to see whether `to` is after, before, or the same instant as `from` Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Selector-current instant: `/v1/time/diff?from=unix=1711300000&to=tz=America/New_York` - Wall-clock pairing: `/v1/time/diff?from=iso=2026-04-16T09:00:00&from_tz=America/New_York&to=iso=2026-04-16T09:00:00&to_tz=Europe/London` - Wall-clock via selector: `/v1/time/diff?from=iso=2026-01-01T12:00:00&from_ip=8.8.8.8&to=iso=2026-01-01T12:00:00&to_offset=-05:00`

Parameters:

  • from (String)

    Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `from=iso=...` together with one of `from_tz`, `from_ip`, `from_lat`+`from_lon`, or `from_offset`.

  • to (String)

    Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `to=iso=...` together with one of `to_tz`, `to_ip`, `to_lat`+`to_lon`, or `to_offset`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from_tz (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset.

  • :from_ip (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :from_lat (Float)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :from_lon (Float)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`.

  • :from_offset (String)

    Used only with `from=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :to_tz (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset.

  • :to_ip (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :to_lat (Float)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :to_lon (Float)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`.

  • :to_offset (String)

    Used only with `to=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :format (String)

    Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.

  • :business_days (Boolean)

    Set to `true` to enable weekday/business-day counting.

  • :holiday_country (String)

    ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.

  • :holiday_subdivision (String)

    Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(DiffResponse, Integer, Hash)>)

    DiffResponse data, response status code and response headers



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/timelogic-api/api/time_api.rb', line 389

def diff_time_with_http_info(from, to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.diff_time ...'
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling TimeApi.diff_time"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling TimeApi.diff_time"
  end
  if @api_client.config.client_side_validation && !opts[:'from_lat'].nil? && opts[:'from_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"from_lat"]" when calling TimeApi.diff_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'from_lat'].nil? && opts[:'from_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"from_lat"]" when calling TimeApi.diff_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'from_lon'].nil? && opts[:'from_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"from_lon"]" when calling TimeApi.diff_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'from_lon'].nil? && opts[:'from_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"from_lon"]" when calling TimeApi.diff_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'from_offset'].nil? && opts[:'from_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"from_offset\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'to_lat'].nil? && opts[:'to_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"to_lat"]" when calling TimeApi.diff_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'to_lat'].nil? && opts[:'to_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"to_lat"]" when calling TimeApi.diff_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'to_lon'].nil? && opts[:'to_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"to_lon"]" when calling TimeApi.diff_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'to_lon'].nil? && opts[:'to_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"to_lon"]" when calling TimeApi.diff_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'to_offset'].nil? && opts[:'to_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"to_offset\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^[A-Z]{2}$/)
  if @api_client.config.client_side_validation && !opts[:'holiday_country'].nil? && opts[:'holiday_country'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"holiday_country\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/diff'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = from
  query_params[:'to'] = to
  query_params[:'from_tz'] = opts[:'from_tz'] if !opts[:'from_tz'].nil?
  query_params[:'from_ip'] = opts[:'from_ip'] if !opts[:'from_ip'].nil?
  query_params[:'from_lat'] = opts[:'from_lat'] if !opts[:'from_lat'].nil?
  query_params[:'from_lon'] = opts[:'from_lon'] if !opts[:'from_lon'].nil?
  query_params[:'from_offset'] = opts[:'from_offset'] if !opts[:'from_offset'].nil?
  query_params[:'to_tz'] = opts[:'to_tz'] if !opts[:'to_tz'].nil?
  query_params[:'to_ip'] = opts[:'to_ip'] if !opts[:'to_ip'].nil?
  query_params[:'to_lat'] = opts[:'to_lat'] if !opts[:'to_lat'].nil?
  query_params[:'to_lon'] = opts[:'to_lon'] if !opts[:'to_lon'].nil?
  query_params[:'to_offset'] = opts[:'to_offset'] if !opts[:'to_offset'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'business_days'] = opts[:'business_days'] if !opts[:'business_days'].nil?
  query_params[:'holiday_country'] = opts[:'holiday_country'] if !opts[:'holiday_country'].nil?
  query_params[:'holiday_subdivision'] = opts[:'holiday_subdivision'] if !opts[:'holiday_subdivision'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DiffResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.diff_time",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#diff_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_calendar(opts = {}) ⇒ CalendarResponse

Calendar projection for a target instant Returns calendar fields for an optional timestamp and target. Input timestamp forms: - unix=1711300000 - unix_ms=1711300000000 - iso=2026-04-16T09:00:00Z - iso=2026-04-16T09:00:00&source_tz=America/New_York - iso=2026-04-16T09:00:00&source_ip=8.8.8.8 - iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060 - iso=2026-04-16T09:00:00&source_offset=-05:00 - if no input timestamp is provided, the request time is used Target selector forms: - tz=America/New_York - ip=8.8.8.8 - lat=40.7128&lon=-74.0060 - offset=-04:00 - auto_tz=true Additional flags: - week=true adds week_number Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of source_tz, source_ip, source_lat/source_lon, or source_offset - local-ISO companion selectors are valid only with iso=... that has no explicit offset - bulk is not supported on this route Examples: - /v1/time/calendar?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London&week=true - /v1/time/calendar?unix=1711300000&auto_tz=true

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :week (Boolean)
  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



526
527
528
529
# File 'lib/timelogic-api/api/time_api.rb', line 526

def get_calendar(opts = {})
  data, _status_code, _headers = get_calendar_with_http_info(opts)
  data
end

#get_calendar_with_http_info(opts = {}) ⇒ Array<(CalendarResponse, Integer, Hash)>

Calendar projection for a target instant Returns calendar fields for an optional timestamp and target. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the request time is used Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Additional flags: - `week=true` adds `week_number` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/calendar?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London&week=true` - `/v1/time/calendar?unix=1711300000&auto_tz=true`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :week (Boolean)
  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(CalendarResponse, Integer, Hash)>)

    CalendarResponse data, response status code and response headers



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/timelogic-api/api/time_api.rb', line 552

def get_calendar_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_calendar ...'
  end
  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_calendar, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_calendar, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_calendar, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_calendar, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_calendar, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_calendar, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_calendar, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_calendar, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_calendar, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_calendar, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_calendar, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/calendar'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
  query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
  query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
  query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
  query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
  query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
  query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
  query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CalendarResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_calendar",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_calendar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_clock(style, opts = {}) ⇒ String

Render a live HTML clock Returns an embeddable HTML clock fragment. Input timestamp forms: - unix=1711300000 - unix_ms=1711300000000 - iso=2026-04-16T09:00:00Z - iso=2026-04-16T09:00:00&source_tz=America/New_York Target selector forms: - tz=America/New_York - ip=8.8.8.8 - lat=40.7128&lon=-74.0060 - offset=-04:00 Incompatible combinations: - style is required and must be one of the 30 names in the style enum - at most one input timestamp form - at most one target selector family - use at most one of source_tz, source_ip, source_lat/source_lon, or source_offset - local-ISO companion selectors are valid only with iso=... that has no explicit offset - this route is single-target only; comma-separated tz, ip, and offset values are rejected - auto_tz is not supported on this route - sign is not supported on this route Examples: - Digital: /v1/time/clock?style=digital-dashboard&iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London - Analog: /v1/time/clock?style=analog-station&offset=-04:00

Parameters:

  • style (String)

    Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

Returns:

  • (String)


678
679
680
681
# File 'lib/timelogic-api/api/time_api.rb', line 678

def get_clock(style, opts = {})
  data, _status_code, _headers = get_clock_with_http_info(style, opts)
  data
end

#get_clock_with_http_info(style, opts = {}) ⇒ Array<(String, Integer, Hash)>

Render a live HTML clock Returns an embeddable HTML clock fragment. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` Incompatible combinations: - `style` is required and must be one of the 30 names in the `style` enum - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - this route is single-target only; comma-separated `tz`, `ip`, and `offset` values are rejected - `auto_tz` is not supported on this route - `sign` is not supported on this route Examples: - Digital: `/v1/time/clock?style=digital-dashboard&iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Analog: `/v1/time/clock?style=analog-station&offset=-04:00`

Parameters:

  • style (String)

    Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
# File 'lib/timelogic-api/api/time_api.rb', line 702

def get_clock_with_http_info(style, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_clock ...'
  end
  # verify the required parameter 'style' is set
  if @api_client.config.client_side_validation && style.nil?
    fail ArgumentError, "Missing the required parameter 'style' when calling TimeApi.get_clock"
  end
  # verify enum value
  allowable_values = ["analog-station", "analog-aviation", "analog-bauhaus", "analog-graphite", "analog-arctic", "analog-brass", "analog-marine", "analog-grid", "analog-slate", "analog-executive", "digital-segment-red", "digital-segment-amber", "digital-segment-ice", "digital-terminal-green", "digital-terminal-white", "digital-broadcast", "digital-dashboard", "digital-control-room", "digital-slate", "digital-onyx", "digital-frost", "digital-card", "digital-glass", "digital-matrix", "digital-timetable", "digital-split-flap", "digital-cyan", "digital-emerald", "digital-monolith", "digital-minimal"]
  if @api_client.config.client_side_validation && !allowable_values.include?(style)
    fail ArgumentError, "invalid value for \"style\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_clock, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_clock, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_clock, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_clock, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_clock, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_clock, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_clock, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_clock, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_clock, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_clock, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_clock, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/clock'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'style'] = style
  query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
  query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
  query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
  query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
  query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
  query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
  query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
  query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/html', 'application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_clock",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_clock\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_current_time(opts = {}) ⇒ GetCurrentTime200Response

Get the current time for a target Returns current time data for a single target, or a bulk array when exactly one of tz, ip, or offset is supplied as a comma-separated list. Target selector rules: - Use at most one selector family per request: tz, ip, lat + lon, offset, or auto_tz=true. - If no selector is provided, the response defaults to UTC with timezone=null and iso_local=null. - Bulk mode is available only through one comma-separated tz, ip, or offset selector and cannot be combined with any other selector. Example: - Single target: /v1/time/current?tz=America/New_York - For bulk, provide one comma-separated tz, ip, or offset value, for example /v1/time/current?tz=America/New_York,Europe/London,Asia/Tokyo.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



828
829
830
831
# File 'lib/timelogic-api/api/time_api.rb', line 828

def get_current_time(opts = {})
  data, _status_code, _headers = get_current_time_with_http_info(opts)
  data
end

#get_current_time_with_http_info(opts = {}) ⇒ Array<(GetCurrentTime200Response, Integer, Hash)>

Get the current time for a target Returns current time data for a single target, or a bulk array when exactly one of `tz`, `ip`, or `offset` is supplied as a comma-separated list. Target selector rules: - Use at most one selector family per request: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC with `timezone=null` and `iso_local=null`. - Bulk mode is available only through one comma-separated `tz`, `ip`, or `offset` selector and cannot be combined with any other selector. Example: - Single target: `/v1/time/current?tz=America/New_York` - For bulk, provide one comma-separated `tz`, `ip`, or `offset` value, for example `/v1/time/current?tz=America/New_York,Europe/London,Asia/Tokyo`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(GetCurrentTime200Response, Integer, Hash)>)

    GetCurrentTime200Response data, response status code and response headers



845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
# File 'lib/timelogic-api/api/time_api.rb', line 845

def get_current_time_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_current_time ...'
  end
  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_current_time, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_current_time, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_current_time, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_current_time, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_current_time, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_current_time, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/current'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetCurrentTime200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_current_time",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_current_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dst(opts = {}) ⇒ DstResponse

Daylight-saving status for a target Returns daylight-saving status for the selected target. Target selector rules: - Use at most one selector family: tz, ip, lat + lon, offset, or auto_tz=true. - If no selector is provided, the response defaults to UTC. - Bulk is not supported on this route. - next=true adds next_transition when the resolver provides a transition timestamp. Example: - /v1/time/dst?tz=America/New_York&next=true

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :_next (Boolean)
  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



935
936
937
938
# File 'lib/timelogic-api/api/time_api.rb', line 935

def get_dst(opts = {})
  data, _status_code, _headers = get_dst_with_http_info(opts)
  data
end

#get_dst_with_http_info(opts = {}) ⇒ Array<(DstResponse, Integer, Hash)>

Daylight-saving status for a target Returns daylight-saving status for the selected target. Target selector rules: - Use at most one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC. - Bulk is not supported on this route. - `next=true` adds `next_transition` when the resolver provides a transition timestamp. Example: - `/v1/time/dst?tz=America/New_York&next=true`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: strftime.

  • :_next (Boolean)
  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(DstResponse, Integer, Hash)>)

    DstResponse data, response status code and response headers



953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
# File 'lib/timelogic-api/api/time_api.rb', line 953

def get_dst_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_dst ...'
  end
  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_dst, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_dst, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_dst, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_dst, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_dst, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_dst, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/dst'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DstResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_dst",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_dst\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_elapsed(opts = {}) ⇒ ElapsedResponse

Time elapsed since or remaining until a reference instant Computes elapsed or remaining duration relative to one required reference timestamp. Reference timestamp forms: - unix=1711300000 - unix_ms=1711300000000 - iso=2026-04-16T09:00:00Z - iso=2026-04-16T09:00:00&source_tz=America/New_York - iso=2026-04-16T09:00:00&source_ip=8.8.8.8 - iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060 - iso=2026-04-16T09:00:00&source_offset=-05:00 Compare timestamp forms: - compare_unix=1711213600 - compare_unix_ms=1711213600000 - compare_iso=2026-04-16T09:00:00Z - compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London - compare_iso=2026-04-16T09:00:00&compare_source_ip=8.8.8.8 - compare_iso=2026-04-16T09:00:00&compare_source_lat=40.7128&compare_source_lon=-74.0060 - compare_iso=2026-04-16T09:00:00&compare_source_offset=-05:00 Compare selector forms: - tz=America/New_York - ip=8.8.8.8 - lat=40.7128&lon=-74.0060 - offset=-04:00 - auto_tz=true Incompatible combinations: - exactly one reference timestamp form - use either one compare timestamp form or one compare selector family, not both - use at most one of source_tz, source_ip, source_lat/source_lon, or source_offset - use at most one of compare_source_tz, compare_source_ip, compare_source_lat/compare_source_lon, or compare_source_offset - local-ISO companion selectors are valid only with iso=... that has no explicit offset - compare local-ISO companion selectors are valid only with compare_iso=... that has no explicit offset - if no compare input is provided, the comparison defaults to the request time Business-day rules: - holiday_country and holiday_subdivision require business_days=true - holiday_subdivision also requires holiday_country Examples: - Timestamp-to-timestamp: /v1/time/elapsed?iso=2026-04-16T09:00:00&source_tz=America/New_York&compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London - Timestamp-to-selector: /v1/time/elapsed?unix=1711300000&tz=America/New_York&business_days=true

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :compare_unix (Integer)
  • :compare_unix_ms (Integer)
  • :compare_iso (String)

    ISO-8601 comparison timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `compare_source_tz=Area/City`, `compare_source_ip=...`, `compare_source_lat=...&compare_source_lon=...`, or `compare_source_offset=±HH:MM`.

  • :compare_source_tz (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset.

  • :compare_source_ip (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :compare_source_lat (Float)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :compare_source_lon (Float)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`.

  • :compare_source_offset (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.

  • :business_days (Boolean)

    Set to `true` to enable weekday/business-day counting.

  • :holiday_country (String)

    ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.

  • :holiday_subdivision (String)

    Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



1062
1063
1064
1065
# File 'lib/timelogic-api/api/time_api.rb', line 1062

def get_elapsed(opts = {})
  data, _status_code, _headers = get_elapsed_with_http_info(opts)
  data
end

#get_elapsed_with_http_info(opts = {}) ⇒ Array<(ElapsedResponse, Integer, Hash)>

Time elapsed since or remaining until a reference instant Computes elapsed or remaining duration relative to one required reference timestamp. Reference timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Compare timestamp forms: - `compare_unix=1711213600` - `compare_unix_ms=1711213600000` - `compare_iso=2026-04-16T09:00:00Z` - `compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - `compare_iso=2026-04-16T09:00:00&compare_source_ip=8.8.8.8` - `compare_iso=2026-04-16T09:00:00&compare_source_lat=40.7128&compare_source_lon=-74.0060` - `compare_iso=2026-04-16T09:00:00&compare_source_offset=-05:00` Compare selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Incompatible combinations: - exactly one reference timestamp form - use either one compare timestamp form or one compare selector family, not both - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - use at most one of `compare_source_tz`, `compare_source_ip`, `compare_source_lat`/`compare_source_lon`, or `compare_source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - compare local-ISO companion selectors are valid only with `compare_iso=...` that has no explicit offset - if no compare input is provided, the comparison defaults to the request time Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Timestamp-to-timestamp: `/v1/time/elapsed?iso=2026-04-16T09:00:00&source_tz=America/New_York&compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - Timestamp-to-selector: `/v1/time/elapsed?unix=1711300000&tz=America/New_York&business_days=true`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :unix (Integer)
  • :unix_ms (Integer)
  • :iso (String)

    ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.

  • :source_tz (String)

    Used only with `iso=...` when the ISO value has no explicit offset.

  • :source_ip (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :source_lat (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :source_lon (Float)

    Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.

  • :source_offset (String)

    Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :compare_unix (Integer)
  • :compare_unix_ms (Integer)
  • :compare_iso (String)

    ISO-8601 comparison timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `compare_source_tz=Area/City`, `compare_source_ip=...`, `compare_source_lat=...&compare_source_lon=...`, or `compare_source_offset=±HH:MM`.

  • :compare_source_tz (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset.

  • :compare_source_ip (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.

  • :compare_source_lat (Float)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.

  • :compare_source_lon (Float)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`.

  • :compare_source_offset (String)

    Used only with `compare_iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :format (String)

    Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.

  • :business_days (Boolean)

    Set to `true` to enable weekday/business-day counting.

  • :holiday_country (String)

    ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.

  • :holiday_subdivision (String)

    Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(ElapsedResponse, Integer, Hash)>)

    ElapsedResponse data, response status code and response headers



1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/timelogic-api/api/time_api.rb', line 1098

def get_elapsed_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_elapsed ...'
  end
  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'compare_source_lat'].nil? && opts[:'compare_source_lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"compare_source_lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'compare_source_lat'].nil? && opts[:'compare_source_lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"compare_source_lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'compare_source_lon'].nil? && opts[:'compare_source_lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"compare_source_lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'compare_source_lon'].nil? && opts[:'compare_source_lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"compare_source_lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'compare_source_offset'].nil? && opts[:'compare_source_offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"compare_source_offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_elapsed, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^[A-Z]{2}$/)
  if @api_client.config.client_side_validation && !opts[:'holiday_country'].nil? && opts[:'holiday_country'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"holiday_country\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/time/elapsed'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
  query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
  query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
  query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
  query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
  query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
  query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
  query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
  query_params[:'compare_unix'] = opts[:'compare_unix'] if !opts[:'compare_unix'].nil?
  query_params[:'compare_unix_ms'] = opts[:'compare_unix_ms'] if !opts[:'compare_unix_ms'].nil?
  query_params[:'compare_iso'] = opts[:'compare_iso'] if !opts[:'compare_iso'].nil?
  query_params[:'compare_source_tz'] = opts[:'compare_source_tz'] if !opts[:'compare_source_tz'].nil?
  query_params[:'compare_source_ip'] = opts[:'compare_source_ip'] if !opts[:'compare_source_ip'].nil?
  query_params[:'compare_source_lat'] = opts[:'compare_source_lat'] if !opts[:'compare_source_lat'].nil?
  query_params[:'compare_source_lon'] = opts[:'compare_source_lon'] if !opts[:'compare_source_lon'].nil?
  query_params[:'compare_source_offset'] = opts[:'compare_source_offset'] if !opts[:'compare_source_offset'].nil?
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'business_days'] = opts[:'business_days'] if !opts[:'business_days'].nil?
  query_params[:'holiday_country'] = opts[:'holiday_country'] if !opts[:'holiday_country'].nil?
  query_params[:'holiday_subdivision'] = opts[:'holiday_subdivision'] if !opts[:'holiday_subdivision'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ElapsedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_elapsed",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_elapsed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_timezone(opts = {}) ⇒ GetTimezone200Response

Resolve timezone information for a target Resolves timezone metadata for a single target. Target selector rules: - Use exactly one selector family: tz, ip, lat + lon, offset, or auto_tz=true. - Bulk is not supported on this route. - offset queries return a specialized payload that includes matching_zones for the request-time offset match. Examples: - Single target: /v1/timezone?tz=America/New_York - Offset match: /v1/timezone?offset=-04:00

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:



1252
1253
1254
1255
# File 'lib/timelogic-api/api/time_api.rb', line 1252

def get_timezone(opts = {})
  data, _status_code, _headers = get_timezone_with_http_info(opts)
  data
end

#get_timezone_with_http_info(opts = {}) ⇒ Array<(GetTimezone200Response, Integer, Hash)>

Resolve timezone information for a target Resolves timezone metadata for a single target. Target selector rules: - Use exactly one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - Bulk is not supported on this route. - `offset` queries return a specialized payload that includes `matching_zones` for the request-time offset match. Examples: - Single target: `/v1/timezone?tz=America/New_York` - Offset match: `/v1/timezone?offset=-04:00`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :tz (String)

    IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :ip (String)

    IP address. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :lat (Float)

    Latitude. Must be provided together with `lon`.

  • :lon (Float)

    Longitude. Must be provided together with `lat`.

  • :offset (String)

    Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.

  • :auto_tz (Boolean)

    Set to `true` to resolve using the caller IP from Cloudflare headers.

  • :sign (Boolean)

    Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.

Returns:

  • (Array<(GetTimezone200Response, Integer, Hash)>)

    GetTimezone200Response data, response status code and response headers



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/timelogic-api/api/time_api.rb', line 1268

def get_timezone_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TimeApi.get_timezone ...'
  end
  if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
    fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_timezone, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_timezone, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
    fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_timezone, must be greater than or equal to -90.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_timezone, must be smaller than or equal to 180.'
  end

  if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
    fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_timezone, must be greater than or equal to -180.'
  end

  pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_timezone, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/timezone'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
  query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
  query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetTimezone200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']

  new_options = opts.merge(
    :operation => :"TimeApi.get_timezone",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TimeApi#get_timezone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end