timelogic-api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +188 -0
- data/docs/ApiError.md +22 -0
- data/docs/BulkError.md +24 -0
- data/docs/CalendarResponse.md +48 -0
- data/docs/DiffEndpointRef.md +18 -0
- data/docs/DiffResponse.md +36 -0
- data/docs/DstResponse.md +42 -0
- data/docs/ElapsedResponse.md +32 -0
- data/docs/ErrorResponse.md +22 -0
- data/docs/GetCurrentTime200Response.md +49 -0
- data/docs/GetTimezone200Response.md +49 -0
- data/docs/JwkKey.md +28 -0
- data/docs/JwksResponse.md +18 -0
- data/docs/TimeApi.md +1093 -0
- data/docs/TimePayload.md +38 -0
- data/docs/TimePayloadBulkItem.md +49 -0
- data/docs/TimePayloadBulkResponse.md +15 -0
- data/docs/TimezoneMatch.md +42 -0
- data/docs/TimezoneOffsetResponse.md +44 -0
- data/docs/TimezoneResolvedResponse.md +42 -0
- data/docs/UtilityApi.md +74 -0
- data/lib/timelogic-api/api/time_api.rb +1344 -0
- data/lib/timelogic-api/api/utility_api.rb +82 -0
- data/lib/timelogic-api/api_client.rb +394 -0
- data/lib/timelogic-api/api_error.rb +58 -0
- data/lib/timelogic-api/configuration.rb +353 -0
- data/lib/timelogic-api/models/api_error.rb +282 -0
- data/lib/timelogic-api/models/bulk_error.rb +271 -0
- data/lib/timelogic-api/models/calendar_response.rb +474 -0
- data/lib/timelogic-api/models/diff_endpoint_ref.rb +222 -0
- data/lib/timelogic-api/models/diff_response.rb +386 -0
- data/lib/timelogic-api/models/dst_response.rb +427 -0
- data/lib/timelogic-api/models/elapsed_response.rb +354 -0
- data/lib/timelogic-api/models/error_response.rb +247 -0
- data/lib/timelogic-api/models/get_current_time200_response.rb +105 -0
- data/lib/timelogic-api/models/get_timezone200_response.rb +105 -0
- data/lib/timelogic-api/models/jwk_key.rb +371 -0
- data/lib/timelogic-api/models/jwks_response.rb +223 -0
- data/lib/timelogic-api/models/time_payload.rb +395 -0
- data/lib/timelogic-api/models/time_payload_bulk_item.rb +106 -0
- data/lib/timelogic-api/models/time_payload_bulk_response.rb +210 -0
- data/lib/timelogic-api/models/timezone_match.rb +437 -0
- data/lib/timelogic-api/models/timezone_offset_response.rb +452 -0
- data/lib/timelogic-api/models/timezone_resolved_response.rb +434 -0
- data/lib/timelogic-api/transport_configuration.rb +34 -0
- data/lib/timelogic-api/version.rb +7 -0
- data/lib/timelogic-api.rb +63 -0
- metadata +134 -0
data/docs/TimeApi.md
ADDED
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
# TimeLogic::Api::TimeApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.timelogicapi.com*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**add_time**](TimeApi.md#add_time) | **GET** /v1/time/add | Add modifiers to a timestamp |
|
|
8
|
+
| [**convert_time**](TimeApi.md#convert_time) | **GET** /v1/time/convert | Convert a timestamp into a target timezone or offset |
|
|
9
|
+
| [**diff_time**](TimeApi.md#diff_time) | **GET** /v1/time/diff | Difference between two instants |
|
|
10
|
+
| [**get_calendar**](TimeApi.md#get_calendar) | **GET** /v1/time/calendar | Calendar projection for a target instant |
|
|
11
|
+
| [**get_clock**](TimeApi.md#get_clock) | **GET** /v1/time/clock | Render a live HTML clock |
|
|
12
|
+
| [**get_current_time**](TimeApi.md#get_current_time) | **GET** /v1/time/current | Get the current time for a target |
|
|
13
|
+
| [**get_dst**](TimeApi.md#get_dst) | **GET** /v1/time/dst | Daylight-saving status for a target |
|
|
14
|
+
| [**get_elapsed**](TimeApi.md#get_elapsed) | **GET** /v1/time/elapsed | Time elapsed since or remaining until a reference instant |
|
|
15
|
+
| [**get_timezone**](TimeApi.md#get_timezone) | **GET** /v1/timezone | Resolve timezone information for a target |
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## add_time
|
|
19
|
+
|
|
20
|
+
> <TimePayload> add_time(opts)
|
|
21
|
+
|
|
22
|
+
Add modifiers to a timestamp
|
|
23
|
+
|
|
24
|
+
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`
|
|
25
|
+
|
|
26
|
+
### Examples
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'time'
|
|
30
|
+
require 'timelogic-api'
|
|
31
|
+
# setup authorization
|
|
32
|
+
TimeLogic::Api.configure do |config|
|
|
33
|
+
# Configure API key authorization: directApiKeyHeader
|
|
34
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
35
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
36
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
37
|
+
|
|
38
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
39
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
40
|
+
|
|
41
|
+
# Configure API key authorization: directApiKeyQuery
|
|
42
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
43
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
44
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
45
|
+
|
|
46
|
+
# Configure API key authorization: rapidApiKey
|
|
47
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
48
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
49
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
50
|
+
|
|
51
|
+
# Configure API key authorization: rapidApiHost
|
|
52
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
53
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
54
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
58
|
+
opts = {
|
|
59
|
+
unix: 1711300000, # Integer |
|
|
60
|
+
unix_ms: 1711300000000, # Integer |
|
|
61
|
+
iso: '2024-03-24T15:00:00', # 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`.
|
|
62
|
+
source_tz: 'America/New_York', # String | Used only with `iso=...` when the ISO value has no explicit offset.
|
|
63
|
+
source_ip: '8.8.8.8', # 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.
|
|
64
|
+
source_lat: 40.7128, # 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.
|
|
65
|
+
source_lon: -74.006, # Float | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
66
|
+
source_offset: '-05:00', # String | Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
67
|
+
seconds: 30, # Integer |
|
|
68
|
+
minutes: 15, # Integer |
|
|
69
|
+
hours: 2, # Integer |
|
|
70
|
+
days: 7, # Integer |
|
|
71
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
72
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
73
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
74
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
75
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
76
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
77
|
+
utc: true, # Boolean | Set to `true` to force UTC on routes that support it.
|
|
78
|
+
format: '%Y-%m-%d %H:%M:%S', # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
79
|
+
sign: true # 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`.
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
begin
|
|
83
|
+
# Add modifiers to a timestamp
|
|
84
|
+
result = api_instance.add_time(opts)
|
|
85
|
+
p result
|
|
86
|
+
rescue TimeLogic::Api::ApiError => e
|
|
87
|
+
puts "Error when calling TimeApi->add_time: #{e}"
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Using the add_time_with_http_info variant
|
|
92
|
+
|
|
93
|
+
This returns an Array which contains the response data, status code and headers.
|
|
94
|
+
|
|
95
|
+
> <Array(<TimePayload>, Integer, Hash)> add_time_with_http_info(opts)
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
begin
|
|
99
|
+
# Add modifiers to a timestamp
|
|
100
|
+
data, status_code, headers = api_instance.add_time_with_http_info(opts)
|
|
101
|
+
p status_code # => 2xx
|
|
102
|
+
p headers # => { ... }
|
|
103
|
+
p data # => <TimePayload>
|
|
104
|
+
rescue TimeLogic::Api::ApiError => e
|
|
105
|
+
puts "Error when calling TimeApi->add_time_with_http_info: #{e}"
|
|
106
|
+
end
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Parameters
|
|
110
|
+
|
|
111
|
+
| Name | Type | Description | Notes |
|
|
112
|
+
| ---- | ---- | ----------- | ----- |
|
|
113
|
+
| **unix** | **Integer** | | [optional] |
|
|
114
|
+
| **unix_ms** | **Integer** | | [optional] |
|
|
115
|
+
| **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`. | [optional] |
|
|
116
|
+
| **source_tz** | **String** | Used only with `iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
117
|
+
| **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. | [optional] |
|
|
118
|
+
| **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. | [optional] |
|
|
119
|
+
| **source_lon** | **Float** | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`. | [optional] |
|
|
120
|
+
| **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. | [optional] |
|
|
121
|
+
| **seconds** | **Integer** | | [optional] |
|
|
122
|
+
| **minutes** | **Integer** | | [optional] |
|
|
123
|
+
| **hours** | **Integer** | | [optional] |
|
|
124
|
+
| **days** | **Integer** | | [optional] |
|
|
125
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
126
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
127
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
128
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
129
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
130
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
131
|
+
| **utc** | **Boolean** | Set to `true` to force UTC on routes that support it. | [optional] |
|
|
132
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
133
|
+
| **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`. | [optional] |
|
|
134
|
+
|
|
135
|
+
### Return type
|
|
136
|
+
|
|
137
|
+
[**TimePayload**](TimePayload.md)
|
|
138
|
+
|
|
139
|
+
### Authorization
|
|
140
|
+
|
|
141
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
142
|
+
|
|
143
|
+
### HTTP request headers
|
|
144
|
+
|
|
145
|
+
- **Content-Type**: Not defined
|
|
146
|
+
- **Accept**: application/json
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## convert_time
|
|
150
|
+
|
|
151
|
+
> <GetCurrentTime200Response> convert_time(opts)
|
|
152
|
+
|
|
153
|
+
Convert a timestamp into a target timezone or offset
|
|
154
|
+
|
|
155
|
+
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`
|
|
156
|
+
|
|
157
|
+
### Examples
|
|
158
|
+
|
|
159
|
+
```ruby
|
|
160
|
+
require 'time'
|
|
161
|
+
require 'timelogic-api'
|
|
162
|
+
# setup authorization
|
|
163
|
+
TimeLogic::Api.configure do |config|
|
|
164
|
+
# Configure API key authorization: directApiKeyHeader
|
|
165
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
166
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
167
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
168
|
+
|
|
169
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
170
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
171
|
+
|
|
172
|
+
# Configure API key authorization: directApiKeyQuery
|
|
173
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
174
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
175
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
176
|
+
|
|
177
|
+
# Configure API key authorization: rapidApiKey
|
|
178
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
179
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
180
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
181
|
+
|
|
182
|
+
# Configure API key authorization: rapidApiHost
|
|
183
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
184
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
185
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
189
|
+
opts = {
|
|
190
|
+
unix: 1711300000, # Integer |
|
|
191
|
+
unix_ms: 1711300000000, # Integer |
|
|
192
|
+
iso: '2024-03-24T15:00:00', # 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`.
|
|
193
|
+
source_tz: 'America/New_York', # String | Used only with `iso=...` when the ISO value has no explicit offset.
|
|
194
|
+
source_ip: '8.8.8.8', # 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.
|
|
195
|
+
source_lat: 40.7128, # 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.
|
|
196
|
+
source_lon: -74.006, # Float | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
197
|
+
source_offset: '-05:00', # String | Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
198
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
199
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
200
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
201
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
202
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
203
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
204
|
+
utc: true, # Boolean | Set to `true` to force UTC on routes that support it.
|
|
205
|
+
format: '%Y-%m-%d %H:%M:%S', # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
206
|
+
sign: true # 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`.
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
begin
|
|
210
|
+
# Convert a timestamp into a target timezone or offset
|
|
211
|
+
result = api_instance.convert_time(opts)
|
|
212
|
+
p result
|
|
213
|
+
rescue TimeLogic::Api::ApiError => e
|
|
214
|
+
puts "Error when calling TimeApi->convert_time: #{e}"
|
|
215
|
+
end
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### Using the convert_time_with_http_info variant
|
|
219
|
+
|
|
220
|
+
This returns an Array which contains the response data, status code and headers.
|
|
221
|
+
|
|
222
|
+
> <Array(<GetCurrentTime200Response>, Integer, Hash)> convert_time_with_http_info(opts)
|
|
223
|
+
|
|
224
|
+
```ruby
|
|
225
|
+
begin
|
|
226
|
+
# Convert a timestamp into a target timezone or offset
|
|
227
|
+
data, status_code, headers = api_instance.convert_time_with_http_info(opts)
|
|
228
|
+
p status_code # => 2xx
|
|
229
|
+
p headers # => { ... }
|
|
230
|
+
p data # => <GetCurrentTime200Response>
|
|
231
|
+
rescue TimeLogic::Api::ApiError => e
|
|
232
|
+
puts "Error when calling TimeApi->convert_time_with_http_info: #{e}"
|
|
233
|
+
end
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Parameters
|
|
237
|
+
|
|
238
|
+
| Name | Type | Description | Notes |
|
|
239
|
+
| ---- | ---- | ----------- | ----- |
|
|
240
|
+
| **unix** | **Integer** | | [optional] |
|
|
241
|
+
| **unix_ms** | **Integer** | | [optional] |
|
|
242
|
+
| **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`. | [optional] |
|
|
243
|
+
| **source_tz** | **String** | Used only with `iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
244
|
+
| **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. | [optional] |
|
|
245
|
+
| **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. | [optional] |
|
|
246
|
+
| **source_lon** | **Float** | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`. | [optional] |
|
|
247
|
+
| **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. | [optional] |
|
|
248
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
249
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
250
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
251
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
252
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
253
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
254
|
+
| **utc** | **Boolean** | Set to `true` to force UTC on routes that support it. | [optional] |
|
|
255
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
256
|
+
| **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`. | [optional] |
|
|
257
|
+
|
|
258
|
+
### Return type
|
|
259
|
+
|
|
260
|
+
[**GetCurrentTime200Response**](GetCurrentTime200Response.md)
|
|
261
|
+
|
|
262
|
+
### Authorization
|
|
263
|
+
|
|
264
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
265
|
+
|
|
266
|
+
### HTTP request headers
|
|
267
|
+
|
|
268
|
+
- **Content-Type**: Not defined
|
|
269
|
+
- **Accept**: application/json
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
## diff_time
|
|
273
|
+
|
|
274
|
+
> <DiffResponse> diff_time(from, to, opts)
|
|
275
|
+
|
|
276
|
+
Difference between two instants
|
|
277
|
+
|
|
278
|
+
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`
|
|
279
|
+
|
|
280
|
+
### Examples
|
|
281
|
+
|
|
282
|
+
```ruby
|
|
283
|
+
require 'time'
|
|
284
|
+
require 'timelogic-api'
|
|
285
|
+
# setup authorization
|
|
286
|
+
TimeLogic::Api.configure do |config|
|
|
287
|
+
# Configure API key authorization: directApiKeyHeader
|
|
288
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
289
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
290
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
291
|
+
|
|
292
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
293
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
294
|
+
|
|
295
|
+
# Configure API key authorization: directApiKeyQuery
|
|
296
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
297
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
298
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
299
|
+
|
|
300
|
+
# Configure API key authorization: rapidApiKey
|
|
301
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
302
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
303
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
304
|
+
|
|
305
|
+
# Configure API key authorization: rapidApiHost
|
|
306
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
307
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
308
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
312
|
+
from = 'from_example' # 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`.
|
|
313
|
+
to = 'to_example' # 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`.
|
|
314
|
+
opts = {
|
|
315
|
+
from_tz: 'from_tz_example', # String | Used only with `from=iso=...` when the ISO value has no explicit offset.
|
|
316
|
+
from_ip: '8.8.8.8', # 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.
|
|
317
|
+
from_lat: 40.7128, # 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.
|
|
318
|
+
from_lon: -74.006, # Float | Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`.
|
|
319
|
+
from_offset: '-05:00', # 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.
|
|
320
|
+
to_tz: 'to_tz_example', # String | Used only with `to=iso=...` when the ISO value has no explicit offset.
|
|
321
|
+
to_ip: '8.8.8.8', # 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.
|
|
322
|
+
to_lat: 40.7128, # 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.
|
|
323
|
+
to_lon: -74.006, # Float | Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`.
|
|
324
|
+
to_offset: '-05:00', # 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.
|
|
325
|
+
format: '%daysd %hoursh %minutesm %secondss', # String | Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
326
|
+
business_days: true, # Boolean | Set to `true` to enable weekday/business-day counting.
|
|
327
|
+
holiday_country: 'US', # String | ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
328
|
+
holiday_subdivision: 'CA', # String | Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
329
|
+
sign: true # 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`.
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
begin
|
|
333
|
+
# Difference between two instants
|
|
334
|
+
result = api_instance.diff_time(from, to, opts)
|
|
335
|
+
p result
|
|
336
|
+
rescue TimeLogic::Api::ApiError => e
|
|
337
|
+
puts "Error when calling TimeApi->diff_time: #{e}"
|
|
338
|
+
end
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### Using the diff_time_with_http_info variant
|
|
342
|
+
|
|
343
|
+
This returns an Array which contains the response data, status code and headers.
|
|
344
|
+
|
|
345
|
+
> <Array(<DiffResponse>, Integer, Hash)> diff_time_with_http_info(from, to, opts)
|
|
346
|
+
|
|
347
|
+
```ruby
|
|
348
|
+
begin
|
|
349
|
+
# Difference between two instants
|
|
350
|
+
data, status_code, headers = api_instance.diff_time_with_http_info(from, to, opts)
|
|
351
|
+
p status_code # => 2xx
|
|
352
|
+
p headers # => { ... }
|
|
353
|
+
p data # => <DiffResponse>
|
|
354
|
+
rescue TimeLogic::Api::ApiError => e
|
|
355
|
+
puts "Error when calling TimeApi->diff_time_with_http_info: #{e}"
|
|
356
|
+
end
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Parameters
|
|
360
|
+
|
|
361
|
+
| Name | Type | Description | Notes |
|
|
362
|
+
| ---- | ---- | ----------- | ----- |
|
|
363
|
+
| **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`. | |
|
|
364
|
+
| **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`. | |
|
|
365
|
+
| **from_tz** | **String** | Used only with `from=iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
366
|
+
| **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. | [optional] |
|
|
367
|
+
| **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. | [optional] |
|
|
368
|
+
| **from_lon** | **Float** | Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`. | [optional] |
|
|
369
|
+
| **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. | [optional] |
|
|
370
|
+
| **to_tz** | **String** | Used only with `to=iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
371
|
+
| **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. | [optional] |
|
|
372
|
+
| **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. | [optional] |
|
|
373
|
+
| **to_lon** | **Float** | Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`. | [optional] |
|
|
374
|
+
| **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. | [optional] |
|
|
375
|
+
| **format** | **String** | Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`. | [optional] |
|
|
376
|
+
| **business_days** | **Boolean** | Set to `true` to enable weekday/business-day counting. | [optional] |
|
|
377
|
+
| **holiday_country** | **String** | ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`. | [optional] |
|
|
378
|
+
| **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`. | [optional] |
|
|
379
|
+
| **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`. | [optional] |
|
|
380
|
+
|
|
381
|
+
### Return type
|
|
382
|
+
|
|
383
|
+
[**DiffResponse**](DiffResponse.md)
|
|
384
|
+
|
|
385
|
+
### Authorization
|
|
386
|
+
|
|
387
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
388
|
+
|
|
389
|
+
### HTTP request headers
|
|
390
|
+
|
|
391
|
+
- **Content-Type**: Not defined
|
|
392
|
+
- **Accept**: application/json
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
## get_calendar
|
|
396
|
+
|
|
397
|
+
> <CalendarResponse> get_calendar(opts)
|
|
398
|
+
|
|
399
|
+
Calendar projection for a target instant
|
|
400
|
+
|
|
401
|
+
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`
|
|
402
|
+
|
|
403
|
+
### Examples
|
|
404
|
+
|
|
405
|
+
```ruby
|
|
406
|
+
require 'time'
|
|
407
|
+
require 'timelogic-api'
|
|
408
|
+
# setup authorization
|
|
409
|
+
TimeLogic::Api.configure do |config|
|
|
410
|
+
# Configure API key authorization: directApiKeyHeader
|
|
411
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
412
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
413
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
414
|
+
|
|
415
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
416
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
417
|
+
|
|
418
|
+
# Configure API key authorization: directApiKeyQuery
|
|
419
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
420
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
421
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
422
|
+
|
|
423
|
+
# Configure API key authorization: rapidApiKey
|
|
424
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
425
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
426
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
427
|
+
|
|
428
|
+
# Configure API key authorization: rapidApiHost
|
|
429
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
430
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
431
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
435
|
+
opts = {
|
|
436
|
+
unix: 1711300000, # Integer |
|
|
437
|
+
unix_ms: 1711300000000, # Integer |
|
|
438
|
+
iso: '2024-03-24T15:00:00', # 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`.
|
|
439
|
+
source_tz: 'America/New_York', # String | Used only with `iso=...` when the ISO value has no explicit offset.
|
|
440
|
+
source_ip: '8.8.8.8', # 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.
|
|
441
|
+
source_lat: 40.7128, # 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.
|
|
442
|
+
source_lon: -74.006, # Float | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
443
|
+
source_offset: '-05:00', # String | Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
444
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
445
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
446
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
447
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
448
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
449
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
450
|
+
format: '%Y-%m-%d %H:%M:%S', # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
451
|
+
week: true, # Boolean |
|
|
452
|
+
sign: true # 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`.
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
begin
|
|
456
|
+
# Calendar projection for a target instant
|
|
457
|
+
result = api_instance.get_calendar(opts)
|
|
458
|
+
p result
|
|
459
|
+
rescue TimeLogic::Api::ApiError => e
|
|
460
|
+
puts "Error when calling TimeApi->get_calendar: #{e}"
|
|
461
|
+
end
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
#### Using the get_calendar_with_http_info variant
|
|
465
|
+
|
|
466
|
+
This returns an Array which contains the response data, status code and headers.
|
|
467
|
+
|
|
468
|
+
> <Array(<CalendarResponse>, Integer, Hash)> get_calendar_with_http_info(opts)
|
|
469
|
+
|
|
470
|
+
```ruby
|
|
471
|
+
begin
|
|
472
|
+
# Calendar projection for a target instant
|
|
473
|
+
data, status_code, headers = api_instance.get_calendar_with_http_info(opts)
|
|
474
|
+
p status_code # => 2xx
|
|
475
|
+
p headers # => { ... }
|
|
476
|
+
p data # => <CalendarResponse>
|
|
477
|
+
rescue TimeLogic::Api::ApiError => e
|
|
478
|
+
puts "Error when calling TimeApi->get_calendar_with_http_info: #{e}"
|
|
479
|
+
end
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Parameters
|
|
483
|
+
|
|
484
|
+
| Name | Type | Description | Notes |
|
|
485
|
+
| ---- | ---- | ----------- | ----- |
|
|
486
|
+
| **unix** | **Integer** | | [optional] |
|
|
487
|
+
| **unix_ms** | **Integer** | | [optional] |
|
|
488
|
+
| **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`. | [optional] |
|
|
489
|
+
| **source_tz** | **String** | Used only with `iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
490
|
+
| **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. | [optional] |
|
|
491
|
+
| **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. | [optional] |
|
|
492
|
+
| **source_lon** | **Float** | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`. | [optional] |
|
|
493
|
+
| **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. | [optional] |
|
|
494
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
495
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
496
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
497
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
498
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
499
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
500
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
501
|
+
| **week** | **Boolean** | | [optional] |
|
|
502
|
+
| **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`. | [optional] |
|
|
503
|
+
|
|
504
|
+
### Return type
|
|
505
|
+
|
|
506
|
+
[**CalendarResponse**](CalendarResponse.md)
|
|
507
|
+
|
|
508
|
+
### Authorization
|
|
509
|
+
|
|
510
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
511
|
+
|
|
512
|
+
### HTTP request headers
|
|
513
|
+
|
|
514
|
+
- **Content-Type**: Not defined
|
|
515
|
+
- **Accept**: application/json
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
## get_clock
|
|
519
|
+
|
|
520
|
+
> String get_clock(style, opts)
|
|
521
|
+
|
|
522
|
+
Render a live HTML clock
|
|
523
|
+
|
|
524
|
+
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`
|
|
525
|
+
|
|
526
|
+
### Examples
|
|
527
|
+
|
|
528
|
+
```ruby
|
|
529
|
+
require 'time'
|
|
530
|
+
require 'timelogic-api'
|
|
531
|
+
# setup authorization
|
|
532
|
+
TimeLogic::Api.configure do |config|
|
|
533
|
+
# Configure API key authorization: directApiKeyHeader
|
|
534
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
535
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
536
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
537
|
+
|
|
538
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
539
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
540
|
+
|
|
541
|
+
# Configure API key authorization: directApiKeyQuery
|
|
542
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
543
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
544
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
545
|
+
|
|
546
|
+
# Configure API key authorization: rapidApiKey
|
|
547
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
548
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
549
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
550
|
+
|
|
551
|
+
# Configure API key authorization: rapidApiHost
|
|
552
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
553
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
554
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
555
|
+
end
|
|
556
|
+
|
|
557
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
558
|
+
style = 'analog-station' # String | Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint.
|
|
559
|
+
opts = {
|
|
560
|
+
unix: 1711300000, # Integer |
|
|
561
|
+
unix_ms: 1711300000000, # Integer |
|
|
562
|
+
iso: '2024-03-24T15:00:00', # 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`.
|
|
563
|
+
source_tz: 'America/New_York', # String | Used only with `iso=...` when the ISO value has no explicit offset.
|
|
564
|
+
source_ip: '8.8.8.8', # 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.
|
|
565
|
+
source_lat: 40.7128, # 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.
|
|
566
|
+
source_lon: -74.006, # Float | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
567
|
+
source_offset: '-05:00', # String | Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
568
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
569
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
570
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
571
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
572
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
573
|
+
format: '%Y-%m-%d %H:%M:%S' # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
begin
|
|
577
|
+
# Render a live HTML clock
|
|
578
|
+
result = api_instance.get_clock(style, opts)
|
|
579
|
+
p result
|
|
580
|
+
rescue TimeLogic::Api::ApiError => e
|
|
581
|
+
puts "Error when calling TimeApi->get_clock: #{e}"
|
|
582
|
+
end
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
#### Using the get_clock_with_http_info variant
|
|
586
|
+
|
|
587
|
+
This returns an Array which contains the response data, status code and headers.
|
|
588
|
+
|
|
589
|
+
> <Array(String, Integer, Hash)> get_clock_with_http_info(style, opts)
|
|
590
|
+
|
|
591
|
+
```ruby
|
|
592
|
+
begin
|
|
593
|
+
# Render a live HTML clock
|
|
594
|
+
data, status_code, headers = api_instance.get_clock_with_http_info(style, opts)
|
|
595
|
+
p status_code # => 2xx
|
|
596
|
+
p headers # => { ... }
|
|
597
|
+
p data # => String
|
|
598
|
+
rescue TimeLogic::Api::ApiError => e
|
|
599
|
+
puts "Error when calling TimeApi->get_clock_with_http_info: #{e}"
|
|
600
|
+
end
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Parameters
|
|
604
|
+
|
|
605
|
+
| Name | Type | Description | Notes |
|
|
606
|
+
| ---- | ---- | ----------- | ----- |
|
|
607
|
+
| **style** | **String** | Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint. | |
|
|
608
|
+
| **unix** | **Integer** | | [optional] |
|
|
609
|
+
| **unix_ms** | **Integer** | | [optional] |
|
|
610
|
+
| **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`. | [optional] |
|
|
611
|
+
| **source_tz** | **String** | Used only with `iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
612
|
+
| **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. | [optional] |
|
|
613
|
+
| **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. | [optional] |
|
|
614
|
+
| **source_lon** | **Float** | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`. | [optional] |
|
|
615
|
+
| **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. | [optional] |
|
|
616
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
617
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
618
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
619
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
620
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
621
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
622
|
+
|
|
623
|
+
### Return type
|
|
624
|
+
|
|
625
|
+
**String**
|
|
626
|
+
|
|
627
|
+
### Authorization
|
|
628
|
+
|
|
629
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
630
|
+
|
|
631
|
+
### HTTP request headers
|
|
632
|
+
|
|
633
|
+
- **Content-Type**: Not defined
|
|
634
|
+
- **Accept**: text/html, application/json
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
## get_current_time
|
|
638
|
+
|
|
639
|
+
> <GetCurrentTime200Response> get_current_time(opts)
|
|
640
|
+
|
|
641
|
+
Get the current time for a target
|
|
642
|
+
|
|
643
|
+
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`.
|
|
644
|
+
|
|
645
|
+
### Examples
|
|
646
|
+
|
|
647
|
+
```ruby
|
|
648
|
+
require 'time'
|
|
649
|
+
require 'timelogic-api'
|
|
650
|
+
# setup authorization
|
|
651
|
+
TimeLogic::Api.configure do |config|
|
|
652
|
+
# Configure API key authorization: directApiKeyHeader
|
|
653
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
654
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
655
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
656
|
+
|
|
657
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
658
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
659
|
+
|
|
660
|
+
# Configure API key authorization: directApiKeyQuery
|
|
661
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
662
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
663
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
664
|
+
|
|
665
|
+
# Configure API key authorization: rapidApiKey
|
|
666
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
667
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
668
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
669
|
+
|
|
670
|
+
# Configure API key authorization: rapidApiHost
|
|
671
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
672
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
673
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
677
|
+
opts = {
|
|
678
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
679
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
680
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
681
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
682
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
683
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
684
|
+
format: '%Y-%m-%d %H:%M:%S', # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
685
|
+
sign: true # 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`.
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
begin
|
|
689
|
+
# Get the current time for a target
|
|
690
|
+
result = api_instance.get_current_time(opts)
|
|
691
|
+
p result
|
|
692
|
+
rescue TimeLogic::Api::ApiError => e
|
|
693
|
+
puts "Error when calling TimeApi->get_current_time: #{e}"
|
|
694
|
+
end
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### Using the get_current_time_with_http_info variant
|
|
698
|
+
|
|
699
|
+
This returns an Array which contains the response data, status code and headers.
|
|
700
|
+
|
|
701
|
+
> <Array(<GetCurrentTime200Response>, Integer, Hash)> get_current_time_with_http_info(opts)
|
|
702
|
+
|
|
703
|
+
```ruby
|
|
704
|
+
begin
|
|
705
|
+
# Get the current time for a target
|
|
706
|
+
data, status_code, headers = api_instance.get_current_time_with_http_info(opts)
|
|
707
|
+
p status_code # => 2xx
|
|
708
|
+
p headers # => { ... }
|
|
709
|
+
p data # => <GetCurrentTime200Response>
|
|
710
|
+
rescue TimeLogic::Api::ApiError => e
|
|
711
|
+
puts "Error when calling TimeApi->get_current_time_with_http_info: #{e}"
|
|
712
|
+
end
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### Parameters
|
|
716
|
+
|
|
717
|
+
| Name | Type | Description | Notes |
|
|
718
|
+
| ---- | ---- | ----------- | ----- |
|
|
719
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
720
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
721
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
722
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
723
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
724
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
725
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
726
|
+
| **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`. | [optional] |
|
|
727
|
+
|
|
728
|
+
### Return type
|
|
729
|
+
|
|
730
|
+
[**GetCurrentTime200Response**](GetCurrentTime200Response.md)
|
|
731
|
+
|
|
732
|
+
### Authorization
|
|
733
|
+
|
|
734
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
735
|
+
|
|
736
|
+
### HTTP request headers
|
|
737
|
+
|
|
738
|
+
- **Content-Type**: Not defined
|
|
739
|
+
- **Accept**: application/json
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
## get_dst
|
|
743
|
+
|
|
744
|
+
> <DstResponse> get_dst(opts)
|
|
745
|
+
|
|
746
|
+
Daylight-saving status for a target
|
|
747
|
+
|
|
748
|
+
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`
|
|
749
|
+
|
|
750
|
+
### Examples
|
|
751
|
+
|
|
752
|
+
```ruby
|
|
753
|
+
require 'time'
|
|
754
|
+
require 'timelogic-api'
|
|
755
|
+
# setup authorization
|
|
756
|
+
TimeLogic::Api.configure do |config|
|
|
757
|
+
# Configure API key authorization: directApiKeyHeader
|
|
758
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
759
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
760
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
761
|
+
|
|
762
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
763
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
764
|
+
|
|
765
|
+
# Configure API key authorization: directApiKeyQuery
|
|
766
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
767
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
768
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
769
|
+
|
|
770
|
+
# Configure API key authorization: rapidApiKey
|
|
771
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
772
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
773
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
774
|
+
|
|
775
|
+
# Configure API key authorization: rapidApiHost
|
|
776
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
777
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
778
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
782
|
+
opts = {
|
|
783
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
784
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
785
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
786
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
787
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
788
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
789
|
+
format: '%Y-%m-%d %H:%M:%S', # String | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
790
|
+
_next: true, # Boolean |
|
|
791
|
+
sign: true # 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`.
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
begin
|
|
795
|
+
# Daylight-saving status for a target
|
|
796
|
+
result = api_instance.get_dst(opts)
|
|
797
|
+
p result
|
|
798
|
+
rescue TimeLogic::Api::ApiError => e
|
|
799
|
+
puts "Error when calling TimeApi->get_dst: #{e}"
|
|
800
|
+
end
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
#### Using the get_dst_with_http_info variant
|
|
804
|
+
|
|
805
|
+
This returns an Array which contains the response data, status code and headers.
|
|
806
|
+
|
|
807
|
+
> <Array(<DstResponse>, Integer, Hash)> get_dst_with_http_info(opts)
|
|
808
|
+
|
|
809
|
+
```ruby
|
|
810
|
+
begin
|
|
811
|
+
# Daylight-saving status for a target
|
|
812
|
+
data, status_code, headers = api_instance.get_dst_with_http_info(opts)
|
|
813
|
+
p status_code # => 2xx
|
|
814
|
+
p headers # => { ... }
|
|
815
|
+
p data # => <DstResponse>
|
|
816
|
+
rescue TimeLogic::Api::ApiError => e
|
|
817
|
+
puts "Error when calling TimeApi->get_dst_with_http_info: #{e}"
|
|
818
|
+
end
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
### Parameters
|
|
822
|
+
|
|
823
|
+
| Name | Type | Description | Notes |
|
|
824
|
+
| ---- | ---- | ----------- | ----- |
|
|
825
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
826
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
827
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
828
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
829
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
830
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
831
|
+
| **format** | **String** | Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/). | [optional] |
|
|
832
|
+
| **_next** | **Boolean** | | [optional] |
|
|
833
|
+
| **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`. | [optional] |
|
|
834
|
+
|
|
835
|
+
### Return type
|
|
836
|
+
|
|
837
|
+
[**DstResponse**](DstResponse.md)
|
|
838
|
+
|
|
839
|
+
### Authorization
|
|
840
|
+
|
|
841
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
842
|
+
|
|
843
|
+
### HTTP request headers
|
|
844
|
+
|
|
845
|
+
- **Content-Type**: Not defined
|
|
846
|
+
- **Accept**: application/json
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
## get_elapsed
|
|
850
|
+
|
|
851
|
+
> <ElapsedResponse> get_elapsed(opts)
|
|
852
|
+
|
|
853
|
+
Time elapsed since or remaining until a reference instant
|
|
854
|
+
|
|
855
|
+
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`
|
|
856
|
+
|
|
857
|
+
### Examples
|
|
858
|
+
|
|
859
|
+
```ruby
|
|
860
|
+
require 'time'
|
|
861
|
+
require 'timelogic-api'
|
|
862
|
+
# setup authorization
|
|
863
|
+
TimeLogic::Api.configure do |config|
|
|
864
|
+
# Configure API key authorization: directApiKeyHeader
|
|
865
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
866
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
867
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
868
|
+
|
|
869
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
870
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
871
|
+
|
|
872
|
+
# Configure API key authorization: directApiKeyQuery
|
|
873
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
874
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
875
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
876
|
+
|
|
877
|
+
# Configure API key authorization: rapidApiKey
|
|
878
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
879
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
880
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
881
|
+
|
|
882
|
+
# Configure API key authorization: rapidApiHost
|
|
883
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
884
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
885
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
889
|
+
opts = {
|
|
890
|
+
unix: 1711300000, # Integer |
|
|
891
|
+
unix_ms: 1711300000000, # Integer |
|
|
892
|
+
iso: '2024-03-24T15:00:00', # 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`.
|
|
893
|
+
source_tz: 'America/New_York', # String | Used only with `iso=...` when the ISO value has no explicit offset.
|
|
894
|
+
source_ip: '8.8.8.8', # 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.
|
|
895
|
+
source_lat: 40.7128, # 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.
|
|
896
|
+
source_lon: -74.006, # Float | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
897
|
+
source_offset: '-05:00', # String | Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
898
|
+
compare_unix: 1711213600, # Integer |
|
|
899
|
+
compare_unix_ms: 1711213600000, # Integer |
|
|
900
|
+
compare_iso: '2024-03-23T15:00:00', # 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`.
|
|
901
|
+
compare_source_tz: 'America/New_York', # String | Used only with `compare_iso=...` when the ISO value has no explicit offset.
|
|
902
|
+
compare_source_ip: '8.8.8.8', # 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.
|
|
903
|
+
compare_source_lat: 40.7128, # 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.
|
|
904
|
+
compare_source_lon: -74.006, # Float | Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`.
|
|
905
|
+
compare_source_offset: '-05:00', # 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.
|
|
906
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
907
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
908
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
909
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
910
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
911
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
912
|
+
format: '%daysd %hoursh %minutesm %secondss', # String | Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
913
|
+
business_days: true, # Boolean | Set to `true` to enable weekday/business-day counting.
|
|
914
|
+
holiday_country: 'US', # String | ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
915
|
+
holiday_subdivision: 'CA', # String | Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
916
|
+
sign: true # 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`.
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
begin
|
|
920
|
+
# Time elapsed since or remaining until a reference instant
|
|
921
|
+
result = api_instance.get_elapsed(opts)
|
|
922
|
+
p result
|
|
923
|
+
rescue TimeLogic::Api::ApiError => e
|
|
924
|
+
puts "Error when calling TimeApi->get_elapsed: #{e}"
|
|
925
|
+
end
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
#### Using the get_elapsed_with_http_info variant
|
|
929
|
+
|
|
930
|
+
This returns an Array which contains the response data, status code and headers.
|
|
931
|
+
|
|
932
|
+
> <Array(<ElapsedResponse>, Integer, Hash)> get_elapsed_with_http_info(opts)
|
|
933
|
+
|
|
934
|
+
```ruby
|
|
935
|
+
begin
|
|
936
|
+
# Time elapsed since or remaining until a reference instant
|
|
937
|
+
data, status_code, headers = api_instance.get_elapsed_with_http_info(opts)
|
|
938
|
+
p status_code # => 2xx
|
|
939
|
+
p headers # => { ... }
|
|
940
|
+
p data # => <ElapsedResponse>
|
|
941
|
+
rescue TimeLogic::Api::ApiError => e
|
|
942
|
+
puts "Error when calling TimeApi->get_elapsed_with_http_info: #{e}"
|
|
943
|
+
end
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
### Parameters
|
|
947
|
+
|
|
948
|
+
| Name | Type | Description | Notes |
|
|
949
|
+
| ---- | ---- | ----------- | ----- |
|
|
950
|
+
| **unix** | **Integer** | | [optional] |
|
|
951
|
+
| **unix_ms** | **Integer** | | [optional] |
|
|
952
|
+
| **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`. | [optional] |
|
|
953
|
+
| **source_tz** | **String** | Used only with `iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
954
|
+
| **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. | [optional] |
|
|
955
|
+
| **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. | [optional] |
|
|
956
|
+
| **source_lon** | **Float** | Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`. | [optional] |
|
|
957
|
+
| **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. | [optional] |
|
|
958
|
+
| **compare_unix** | **Integer** | | [optional] |
|
|
959
|
+
| **compare_unix_ms** | **Integer** | | [optional] |
|
|
960
|
+
| **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`. | [optional] |
|
|
961
|
+
| **compare_source_tz** | **String** | Used only with `compare_iso=...` when the ISO value has no explicit offset. | [optional] |
|
|
962
|
+
| **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. | [optional] |
|
|
963
|
+
| **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. | [optional] |
|
|
964
|
+
| **compare_source_lon** | **Float** | Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`. | [optional] |
|
|
965
|
+
| **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. | [optional] |
|
|
966
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
967
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
968
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
969
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
970
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
971
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
972
|
+
| **format** | **String** | Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`. | [optional] |
|
|
973
|
+
| **business_days** | **Boolean** | Set to `true` to enable weekday/business-day counting. | [optional] |
|
|
974
|
+
| **holiday_country** | **String** | ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`. | [optional] |
|
|
975
|
+
| **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`. | [optional] |
|
|
976
|
+
| **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`. | [optional] |
|
|
977
|
+
|
|
978
|
+
### Return type
|
|
979
|
+
|
|
980
|
+
[**ElapsedResponse**](ElapsedResponse.md)
|
|
981
|
+
|
|
982
|
+
### Authorization
|
|
983
|
+
|
|
984
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
985
|
+
|
|
986
|
+
### HTTP request headers
|
|
987
|
+
|
|
988
|
+
- **Content-Type**: Not defined
|
|
989
|
+
- **Accept**: application/json
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
## get_timezone
|
|
993
|
+
|
|
994
|
+
> <GetTimezone200Response> get_timezone(opts)
|
|
995
|
+
|
|
996
|
+
Resolve timezone information for a target
|
|
997
|
+
|
|
998
|
+
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`
|
|
999
|
+
|
|
1000
|
+
### Examples
|
|
1001
|
+
|
|
1002
|
+
```ruby
|
|
1003
|
+
require 'time'
|
|
1004
|
+
require 'timelogic-api'
|
|
1005
|
+
# setup authorization
|
|
1006
|
+
TimeLogic::Api.configure do |config|
|
|
1007
|
+
# Configure API key authorization: directApiKeyHeader
|
|
1008
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
1009
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1010
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
1011
|
+
|
|
1012
|
+
# Configure Bearer authorization (TimeLogic API key): directBearerAuth
|
|
1013
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
1014
|
+
|
|
1015
|
+
# Configure API key authorization: directApiKeyQuery
|
|
1016
|
+
config.api_key['api_key'] = 'YOUR API KEY'
|
|
1017
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1018
|
+
# config.api_key_prefix['api_key'] = 'Bearer'
|
|
1019
|
+
|
|
1020
|
+
# Configure API key authorization: rapidApiKey
|
|
1021
|
+
config.api_key['X-RapidAPI-Key'] = 'YOUR API KEY'
|
|
1022
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1023
|
+
# config.api_key_prefix['X-RapidAPI-Key'] = 'Bearer'
|
|
1024
|
+
|
|
1025
|
+
# Configure API key authorization: rapidApiHost
|
|
1026
|
+
config.api_key['X-RapidAPI-Host'] = 'YOUR API KEY'
|
|
1027
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1028
|
+
# config.api_key_prefix['X-RapidAPI-Host'] = 'Bearer'
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
api_instance = TimeLogic::Api::TimeApi.new
|
|
1032
|
+
opts = {
|
|
1033
|
+
tz: 'America/New_York', # String | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1034
|
+
ip: '8.8.8.8', # String | IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1035
|
+
lat: 40.7128, # Float | Latitude. Must be provided together with `lon`.
|
|
1036
|
+
lon: -74.006, # Float | Longitude. Must be provided together with `lat`.
|
|
1037
|
+
offset: '-04:00', # String | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1038
|
+
auto_tz: true, # Boolean | Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
1039
|
+
sign: true # 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`.
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
begin
|
|
1043
|
+
# Resolve timezone information for a target
|
|
1044
|
+
result = api_instance.get_timezone(opts)
|
|
1045
|
+
p result
|
|
1046
|
+
rescue TimeLogic::Api::ApiError => e
|
|
1047
|
+
puts "Error when calling TimeApi->get_timezone: #{e}"
|
|
1048
|
+
end
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
#### Using the get_timezone_with_http_info variant
|
|
1052
|
+
|
|
1053
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1054
|
+
|
|
1055
|
+
> <Array(<GetTimezone200Response>, Integer, Hash)> get_timezone_with_http_info(opts)
|
|
1056
|
+
|
|
1057
|
+
```ruby
|
|
1058
|
+
begin
|
|
1059
|
+
# Resolve timezone information for a target
|
|
1060
|
+
data, status_code, headers = api_instance.get_timezone_with_http_info(opts)
|
|
1061
|
+
p status_code # => 2xx
|
|
1062
|
+
p headers # => { ... }
|
|
1063
|
+
p data # => <GetTimezone200Response>
|
|
1064
|
+
rescue TimeLogic::Api::ApiError => e
|
|
1065
|
+
puts "Error when calling TimeApi->get_timezone_with_http_info: #{e}"
|
|
1066
|
+
end
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
### Parameters
|
|
1070
|
+
|
|
1071
|
+
| Name | Type | Description | Notes |
|
|
1072
|
+
| ---- | ---- | ----------- | ----- |
|
|
1073
|
+
| **tz** | **String** | IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
1074
|
+
| **ip** | **String** | IP address. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
1075
|
+
| **lat** | **Float** | Latitude. Must be provided together with `lon`. | [optional] |
|
|
1076
|
+
| **lon** | **Float** | Longitude. Must be provided together with `lat`. | [optional] |
|
|
1077
|
+
| **offset** | **String** | Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode. | [optional] |
|
|
1078
|
+
| **auto_tz** | **Boolean** | Set to `true` to resolve using the caller IP from Cloudflare headers. | [optional] |
|
|
1079
|
+
| **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`. | [optional] |
|
|
1080
|
+
|
|
1081
|
+
### Return type
|
|
1082
|
+
|
|
1083
|
+
[**GetTimezone200Response**](GetTimezone200Response.md)
|
|
1084
|
+
|
|
1085
|
+
### Authorization
|
|
1086
|
+
|
|
1087
|
+
[directApiKeyHeader](../README.md#directApiKeyHeader), [directBearerAuth](../README.md#directBearerAuth), [directApiKeyQuery](../README.md#directApiKeyQuery), [rapidApiKey](../README.md#rapidApiKey), [rapidApiHost](../README.md#rapidApiHost)
|
|
1088
|
+
|
|
1089
|
+
### HTTP request headers
|
|
1090
|
+
|
|
1091
|
+
- **Content-Type**: Not defined
|
|
1092
|
+
- **Accept**: application/json
|
|
1093
|
+
|