timelogic-api 1.0.2 → 1.1.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +293 -133
  3. data/docs/BulkError.md +1 -1
  4. data/docs/CalendarResponse.md +2 -2
  5. data/docs/DstResponse.md +2 -2
  6. data/docs/ElapsedResponse.md +1 -1
  7. data/docs/ErrorResponse.md +1 -1
  8. data/docs/TimeApi.md +151 -151
  9. data/docs/TimePayload.md +1 -1
  10. data/docs/TimezoneMatch.md +1 -1
  11. data/docs/TimezoneOffsetResponse.md +2 -2
  12. data/docs/TimezoneResolvedResponse.md +1 -1
  13. data/lib/timelogic-api/api/time_api.rb +169 -159
  14. data/lib/timelogic-api/api/utility_api.rb +1 -1
  15. data/lib/timelogic-api/api_client.rb +3 -1
  16. data/lib/timelogic-api/api_error.rb +1 -1
  17. data/lib/timelogic-api/configuration.rb +1 -1
  18. data/lib/timelogic-api/models/api_error.rb +1 -1
  19. data/lib/timelogic-api/models/bulk_error.rb +2 -2
  20. data/lib/timelogic-api/models/calendar_response.rb +3 -1
  21. data/lib/timelogic-api/models/diff_endpoint_ref.rb +1 -1
  22. data/lib/timelogic-api/models/diff_response.rb +1 -1
  23. data/lib/timelogic-api/models/dst_response.rb +3 -1
  24. data/lib/timelogic-api/models/elapsed_response.rb +2 -2
  25. data/lib/timelogic-api/models/error_response.rb +2 -2
  26. data/lib/timelogic-api/models/get_current_time200_response.rb +1 -1
  27. data/lib/timelogic-api/models/get_timezone200_response.rb +1 -1
  28. data/lib/timelogic-api/models/jwk_key.rb +1 -1
  29. data/lib/timelogic-api/models/jwks_response.rb +1 -1
  30. data/lib/timelogic-api/models/time_payload.rb +2 -1
  31. data/lib/timelogic-api/models/time_payload_bulk_item.rb +1 -1
  32. data/lib/timelogic-api/models/time_payload_bulk_response.rb +1 -1
  33. data/lib/timelogic-api/models/timezone_match.rb +2 -1
  34. data/lib/timelogic-api/models/timezone_offset_response.rb +3 -1
  35. data/lib/timelogic-api/models/timezone_resolved_response.rb +2 -1
  36. data/lib/timelogic-api/version.rb +1 -1
  37. data/lib/timelogic-api/world_time_api.rb +192 -0
  38. data/lib/timelogic-api.rb +2 -1
  39. metadata +3 -2
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -309,6 +309,8 @@ module TimeLogic::Api
309
309
  Array(auth_names).each do |auth_name|
310
310
  auth_setting = @config.auth_settings[auth_name]
311
311
  next unless auth_setting
312
+ value = auth_setting[:value].to_s.strip
313
+ next if value.empty? || value == 'Bearer'
312
314
  case auth_setting[:in]
313
315
  when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
314
316
  when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -20,7 +20,7 @@ module TimeLogic::Api
20
20
 
21
21
  attr_accessor :request_id
22
22
 
23
- # Intentionally omitted from public API error responses to avoid exposing request timing; use request_id for support correlation.
23
+ # Intentionally omitted from public API error responses, including per-item errors inside bulk arrays, to avoid exposing request timing; use request_id for support correlation.
24
24
  attr_accessor :timestamp
25
25
 
26
26
  attr_accessor :item
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -27,6 +27,7 @@ module TimeLogic::Api
27
27
 
28
28
  attr_accessor :human
29
29
 
30
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
30
31
  attr_accessor :day_number
31
32
 
32
33
  attr_accessor :day_short
@@ -45,6 +46,7 @@ module TimeLogic::Api
45
46
 
46
47
  attr_accessor :day
47
48
 
49
+ # ISO 8601 week number (present with `week=true`). It belongs to the ISO week-year, which is not returned and can differ from `year` near January 1 (2027-01-01 is week 53 of 2026).
48
50
  attr_accessor :week_number
49
51
 
50
52
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -27,6 +27,7 @@ module TimeLogic::Api
27
27
 
28
28
  attr_accessor :human
29
29
 
30
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
30
31
  attr_accessor :day_number
31
32
 
32
33
  attr_accessor :day_short
@@ -39,6 +40,7 @@ module TimeLogic::Api
39
40
 
40
41
  attr_accessor :dst_active
41
42
 
43
+ # Present only with `next=true`. The instant of the next UTC offset change, written in the offset in force before it (e.g. `2026-11-01T02:00:00-04:00`); the new offset is not returned. `null` when no change is scheduled, for offset targets and with no selector. Tracks offset changes only, so `dst_active` can change without one.
42
44
  attr_accessor :next_transition
43
45
 
44
46
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -25,7 +25,7 @@ module TimeLogic::Api
25
25
 
26
26
  attr_accessor :human
27
27
 
28
- # `left` means the target instant is still in the future. `passed` means the target instant is already in the past.
28
+ # `left` means the reference instant is after the compared instant (now, or `compare_*`). `passed` means it is before it, or equal to it.
29
29
  attr_accessor :direction
30
30
 
31
31
  attr_accessor :formatted
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -19,7 +19,7 @@ module TimeLogic::Api
19
19
 
20
20
  attr_accessor :request_id
21
21
 
22
- # Intentionally omitted from public API error responses to avoid exposing request timing; use request_id for support correlation.
22
+ # Intentionally omitted from public API error responses, including per-item errors inside bulk arrays, to avoid exposing request timing; use request_id for support correlation.
23
23
  attr_accessor :timestamp
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -28,6 +28,7 @@ module TimeLogic::Api
28
28
 
29
29
  attr_accessor :human
30
30
 
31
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
31
32
  attr_accessor :day_number
32
33
 
33
34
  attr_accessor :day_short
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -27,6 +27,7 @@ module TimeLogic::Api
27
27
 
28
28
  attr_accessor :human
29
29
 
30
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
30
31
  attr_accessor :day_number
31
32
 
32
33
  attr_accessor :day_short
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -28,6 +28,7 @@ module TimeLogic::Api
28
28
 
29
29
  attr_accessor :human
30
30
 
31
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
31
32
  attr_accessor :day_number
32
33
 
33
34
  attr_accessor :day_short
@@ -42,6 +43,7 @@ module TimeLogic::Api
42
43
 
43
44
  attr_accessor :dst
44
45
 
46
+ # For `offset=` lookups, the geographic zones whose current offset equals the requested one. `UTC` and `Etc/*` zones are intentionally excluded; use `tz=UTC` for UTC.
45
47
  attr_accessor :matching_zones
46
48
 
47
49
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #TimeLogic API | A World Time API
3
3
 
4
- # Official public API contract for TimeLogic API.
4
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -28,6 +28,7 @@ module TimeLogic::Api
28
28
 
29
29
  attr_accessor :human
30
30
 
31
+ # Day of the week counted from Sunday (1 = Sunday, 2 = Monday ... 7 = Saturday).
31
32
  attr_accessor :day_number
32
33
 
33
34
  attr_accessor :day_short
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TimeLogic
4
4
  module Api
5
- VERSION = '1.0.2'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
@@ -0,0 +1,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WorldTimeAPI-compatible client for the TimeLogic API /api/* routes.
4
+ #
5
+ # Contract: openapi/openapi-worldtimeapi.yaml. The routes answer the same paths, field
6
+ # names and plain-text variants as worldtimeapi.org; a TimeLogic API key is required and
7
+ # is sent as the X-API-Key header. This module uses Ruby's standard library only and does
8
+ # not use or change the generated /v1 ApiClient, Configuration or TransportConfiguration.
9
+ #
10
+ # client = TimeLogic::Api::WorldTimeApi::Client.new(api_key: ENV.fetch('TIMELOGIC_API_KEY'))
11
+ # now = client.get_timezone('Europe/London')
12
+ # puts now.datetime
13
+
14
+ require 'json'
15
+ require 'net/http'
16
+ require 'uri'
17
+
18
+ module TimeLogic
19
+ module Api
20
+ module WorldTimeApi
21
+ DEFAULT_BASE_URL = 'https://api.timelogicapi.com'
22
+
23
+ FIELDS = %i[
24
+ abbreviation client_ip datetime day_of_week day_of_year dst dst_from dst_offset
25
+ dst_until raw_offset timezone unixtime utc_datetime utc_offset week_number
26
+ ].freeze
27
+
28
+ # Time object with the worldtimeapi.org field names and types.
29
+ DateTime = Struct.new(*FIELDS, keyword_init: true) do
30
+ def self.from_hash(hash)
31
+ new(**FIELDS.to_h { |field| [field, hash[field.to_s]] })
32
+ end
33
+ end
34
+
35
+ # HTTP answer, including the X-TimeLogic-Signature* headers when signing is enabled.
36
+ RawResponse = Struct.new(:status, :headers, :body, keyword_init: true)
37
+
38
+ # Raised for any non-2xx answer. +error+ is the worldtimeapi.org-style message (for
39
+ # example "unknown location") or the TimeLogic message for authentication and quota errors.
40
+ class Error < StandardError
41
+ attr_reader :status, :error, :code, :body
42
+
43
+ def initialize(status, error, code, body)
44
+ super("WorldTimeAPI-compatible request failed (#{status}): #{error}")
45
+ @status = status
46
+ @error = error
47
+ @code = code
48
+ @body = body
49
+ end
50
+
51
+ def unknown_location?
52
+ status == 404 && error == 'unknown location'
53
+ end
54
+
55
+ def malformed_ip?
56
+ status == 404 && error == 'malformed ip'
57
+ end
58
+ end
59
+
60
+ # The 404 {"error":"unknown location"} answer.
61
+ class UnknownLocationError < Error; end
62
+
63
+ def self.error_from_response(status, body)
64
+ message = body.to_s.strip
65
+ code = nil
66
+ if message.start_with?('Error:')
67
+ message = message.delete_prefix('Error:').strip
68
+ else
69
+ begin
70
+ parsed = JSON.parse(body.to_s)
71
+ if parsed.is_a?(Hash) && parsed.key?('error')
72
+ if parsed['error'].is_a?(String)
73
+ message = parsed['error']
74
+ elsif parsed['error'].is_a?(Hash)
75
+ message = parsed['error']['message'].to_s
76
+ code = parsed['error']['code']&.to_s
77
+ end
78
+ end
79
+ rescue JSON::ParserError
80
+ # keep the raw body as the message
81
+ end
82
+ end
83
+ klass = status == 404 && message == 'unknown location' ? UnknownLocationError : Error
84
+ klass.new(status, message, code, body.to_s)
85
+ end
86
+
87
+ # Path for "Europe/London", "America/Argentina/Salta" or a one-word zone such as "UTC".
88
+ def self.zone_path(timezone, text = false)
89
+ segments = timezone.to_s.split('/').reject(&:empty?)
90
+ unless (1..3).cover?(segments.length)
91
+ raise ArgumentError, 'timezone must have one to three segments, for example "Europe/London"'
92
+ end
93
+
94
+ "/api/timezone/#{segments.map { |s| URI.encode_www_form_component(s).gsub('+', '%20') }.join('/')}#{text ? '.txt' : ''}"
95
+ end
96
+
97
+ def self.ip_path(ip = nil, text = false)
98
+ base = ip.nil? || ip.to_s.empty? ? '/api/ip' : "/api/ip/#{URI.encode_www_form_component(ip.to_s)}"
99
+ "#{base}#{text ? '.txt' : ''}"
100
+ end
101
+
102
+ # Client for the WorldTimeAPI-compatible routes.
103
+ class Client
104
+ # transport: optional callable (url, headers) -> RawResponse, used by tests.
105
+ def initialize(api_key:, base_url: DEFAULT_BASE_URL, sign: false, timeout: 30, transport: nil)
106
+ raise ArgumentError, 'api_key is required' if api_key.nil? || api_key.to_s.empty?
107
+
108
+ @api_key = api_key.to_s
109
+ @base_url = base_url.to_s.sub(%r{/+\z}, '')
110
+ @sign = sign
111
+ @timeout = timeout
112
+ @transport = transport
113
+ end
114
+
115
+ # GET /api/timezone
116
+ def list_timezones
117
+ get_json('/api/timezone')
118
+ end
119
+
120
+ # GET /api/timezone.txt
121
+ def list_timezones_text
122
+ get_text('/api/timezone.txt')
123
+ end
124
+
125
+ # GET /api/timezone/{area}
126
+ def list_timezones_in_area(area)
127
+ value = get_json(WorldTimeApi.zone_path(area))
128
+ raise Error.new(200, "#{area} is a timezone, not an area; use get_timezone", nil, JSON.generate(value)) unless value.is_a?(Array)
129
+
130
+ value
131
+ end
132
+
133
+ # GET /api/timezone/{area}.txt
134
+ def list_timezones_in_area_text(area)
135
+ get_text(WorldTimeApi.zone_path(area, true))
136
+ end
137
+
138
+ # GET /api/timezone/{area}/{location}[/{region}], or a one-word zone such as UTC.
139
+ def get_timezone(timezone)
140
+ DateTime.from_hash(get_json(WorldTimeApi.zone_path(timezone)))
141
+ end
142
+
143
+ def get_timezone_text(timezone)
144
+ get_text(WorldTimeApi.zone_path(timezone, true))
145
+ end
146
+
147
+ # GET /api/ip (the caller's address) or /api/ip/{ip}.
148
+ def get_ip(ip = nil)
149
+ DateTime.from_hash(get_json(WorldTimeApi.ip_path(ip)))
150
+ end
151
+
152
+ def get_ip_text(ip = nil)
153
+ get_text(WorldTimeApi.ip_path(ip, true))
154
+ end
155
+
156
+ # GET any /api/* path and return status, headers and body without raising.
157
+ def request_raw(path)
158
+ url = "#{@base_url}#{path}#{@sign ? '?sign=true' : ''}"
159
+ headers = { 'X-API-Key' => @api_key, 'Accept' => path.end_with?('.txt') ? 'text/plain' : 'application/json' }
160
+ return @transport.call(url, headers) if @transport
161
+
162
+ uri = URI.parse(url)
163
+ http = Net::HTTP.new(uri.host, uri.port)
164
+ http.use_ssl = uri.scheme == 'https'
165
+ http.open_timeout = @timeout
166
+ http.read_timeout = @timeout
167
+ request = Net::HTTP::Get.new(uri.request_uri)
168
+ headers.each { |name, value| request[name] = value }
169
+ response = http.request(request)
170
+ RawResponse.new(
171
+ status: response.code.to_i,
172
+ headers: response.each_header.to_h { |name, value| [name.downcase, value] },
173
+ body: response.body.to_s.dup.force_encoding('UTF-8')
174
+ )
175
+ end
176
+
177
+ private
178
+
179
+ def get_text(path)
180
+ raw = request_raw(path)
181
+ raise WorldTimeApi.error_from_response(raw.status, raw.body) unless (200..299).cover?(raw.status)
182
+
183
+ raw.body
184
+ end
185
+
186
+ def get_json(path)
187
+ JSON.parse(get_text(path))
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
data/lib/timelogic-api.rb CHANGED
@@ -4,7 +4,7 @@ end
4
4
  =begin
5
5
  #TimeLogic API | A World Time API
6
6
 
7
- # Official public API contract for TimeLogic API.
7
+ #Direct API contract for client integrations. It documents authentication, endpoint parameters, response shapes, public signing keys, and signed JSON controls. Authentication: - the API supports `Authorization: Bearer <token>`, `X-API-Key`, and `api_key` query credentials - RapidAPI access uses `X-RapidAPI-Key` and `X-RapidAPI-Host`; the SDKs expose this as a `rapidApi` transport option that accepts only the RapidAPI key Behavioral notes: - all documented operations are `GET` - only one selector family may be used at a time - current and convert support bulk only through one comma-separated `tz`, `ip`, or `offset` selector - bulk selectors accept at most 10 values, and every request URL is limited to 8192 characters - add, diff, calendar, dst, elapsed, timezone, and clock are single-target routes - credentials are extracted in Authorization, X-API-Key, then api_key query order; conflicting values are rejected - the first server is the default API host. The second server is the RapidAPI gateway and can be selected or overridden by SDK configuration - `sign` is available on supported JSON routes and is not supported on `/v1/time/clock`
8
8
 
9
9
  The version of the OpenAPI document: 1.0.0
10
10
 
@@ -61,3 +61,4 @@ module TimeLogic::Api
61
61
  end
62
62
  end
63
63
  end
64
+ require 'timelogic-api/world_time_api'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timelogic-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TimeLogic API LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-29 00:00:00.000000000 Z
11
+ date: 2026-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -105,6 +105,7 @@ files:
105
105
  - lib/timelogic-api/models/timezone_resolved_response.rb
106
106
  - lib/timelogic-api/transport_configuration.rb
107
107
  - lib/timelogic-api/version.rb
108
+ - lib/timelogic-api/world_time_api.rb
108
109
  homepage: https://github.com/TimeLogic-API-LLC/timelogic-api-sdks
109
110
  licenses:
110
111
  - Unlicense