world_time_api 0.1.4 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +20 -6
- data/README.md +15 -5
- data/doc/WorldTimeApi/Request.html +185 -0
- data/doc/WorldTimeApi.html +365 -0
- data/doc/_index.html +122 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +503 -0
- data/doc/file.README.html +128 -0
- data/doc/file_list.html +59 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +128 -0
- data/doc/js/app.js +344 -0
- data/doc/js/full_list.js +242 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +54 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/world_time_api/error.rb +8 -1
- data/lib/world_time_api/request.rb +24 -6
- data/lib/world_time_api/response.rb +9 -2
- data/lib/world_time_api/version.rb +3 -1
- data/lib/world_time_api.rb +23 -6
- metadata +20 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bcf03c453c0813a9ed196465c727bb8b283abdfe662a898d1f4082b544945eb1
|
|
4
|
+
data.tar.gz: f9ed297008041b3a897435eaab3deea90a000e7e5f01ec34036ed7aaa3c0c704
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77544f929d9e513fab31fff312c9b5853d237348226e6c56df50ad5cbe7404ae87c90bfb9336188ab57b1a7f06f88585a170b1001fffbcde7afa3b134541953b
|
|
7
|
+
data.tar.gz: d89cbfae24e89e680fbf6142f04ff4fc3272813a5e36b09544fd82a01873e91db5bd4a3bf17d8aff438143b51cccc7d182c20fd0365708716728301410710814
|
data/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
## [WorldTimeAPi]
|
|
2
2
|
|
|
3
|
-
## [0.1.
|
|
3
|
+
## [0.1.6] - 2025-11-20
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
* Add automatic retry mechanism (up to 3 attempts) for failed requests
|
|
6
|
+
* Add exponential backoff between retry attempts
|
|
7
|
+
* Add configurable max_retries parameter
|
|
6
8
|
|
|
7
|
-
## [0.1.
|
|
9
|
+
## [0.1.5] - 2023-02-12
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
* Previous improvements
|
|
10
12
|
|
|
11
|
-
## [0.1.
|
|
13
|
+
## [0.1.4] - 2023-02-12
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
* Refactor code
|
|
14
16
|
|
|
15
17
|
## [0.1.3] - 2023-02-12
|
|
16
18
|
|
|
17
19
|
* add new method :client_ip
|
|
20
|
+
|
|
21
|
+
## [0.1.2] - 2023-02-06
|
|
22
|
+
|
|
23
|
+
* Fix response
|
|
24
|
+
|
|
25
|
+
## [0.1.1] - 2021-11-22
|
|
26
|
+
|
|
27
|
+
* add methods :time and :timezones
|
|
28
|
+
|
|
29
|
+
## [0.1.0] - 2021-11-22
|
|
30
|
+
|
|
31
|
+
* Initial release
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# WorldTimeApi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/world_time_api)
|
|
4
|
+
|
|
5
|
+
A Ruby wrapper for the World Time API.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -24,14 +26,22 @@ gem install world_time_api
|
|
|
24
26
|
|
|
25
27
|
## Usage
|
|
26
28
|
|
|
29
|
+
### List timezones
|
|
30
|
+
|
|
27
31
|
```ruby
|
|
28
|
-
WorldTimeApi::Timezones.call
|
|
32
|
+
WorldTimeApi::Timezones.call
|
|
33
|
+
```
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
### Get time by timezone
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
```ruby
|
|
38
|
+
WorldTimeApi::Time.call('Europe/London')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Get time by IP address
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
```ruby
|
|
44
|
+
WorldTimeApi::ClientIp.call('12.215.42.19')
|
|
35
45
|
```
|
|
36
46
|
|
|
37
47
|
## Development
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Module: WorldTimeApi::Request
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.37
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
pathId = "WorldTimeApi::Request";
|
|
19
|
+
relpath = '../';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="../_index.html">Index (R)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../WorldTimeApi.html" title="WorldTimeApi (module)">WorldTimeApi</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">Request</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="../class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Module: WorldTimeApi::Request
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<dl>
|
|
75
|
+
<dt>Includes:</dt>
|
|
76
|
+
<dd>HTTParty</dd>
|
|
77
|
+
</dl>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
<dl>
|
|
85
|
+
<dt>Defined in:</dt>
|
|
86
|
+
<dd>lib/world_time_api/request.rb</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
|
92
|
+
<div class="discussion">
|
|
93
|
+
|
|
94
|
+
<p>A module for making HTTP requests to the World Time API.</p>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="tags">
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<h2>
|
|
105
|
+
Constant Summary
|
|
106
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
|
107
|
+
</h2>
|
|
108
|
+
|
|
109
|
+
<dl class="constants">
|
|
110
|
+
|
|
111
|
+
<dt id="Call-constant" class="">Call =
|
|
112
|
+
<div class="docstring">
|
|
113
|
+
<div class="discussion">
|
|
114
|
+
|
|
115
|
+
<p>Makes an HTTP GET request to the specified URL and returns the response as a hash.</p>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="tags">
|
|
121
|
+
|
|
122
|
+
<div class="examples">
|
|
123
|
+
<h4 class="tag_title">Examples:</h4>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../WorldTimeApi.html" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="WorldTimeApi::Request (module)">Request</a></span></span><span class='op'>::</span><span class='const'>Call</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/timezone/Europe/London</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
|
127
|
+
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<p class="tag_title">Returns:</p>
|
|
131
|
+
<ul class="return">
|
|
132
|
+
|
|
133
|
+
<li>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
—
|
|
141
|
+
<div class='inline'>
|
|
142
|
+
<p>A hash representing the response body, or an error hash if there was a problem with the request.</p>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
</li>
|
|
146
|
+
|
|
147
|
+
</ul>
|
|
148
|
+
|
|
149
|
+
</div>
|
|
150
|
+
</dt>
|
|
151
|
+
<dd><pre class="code"><span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_url'>url</span><span class='op'>|</span>
|
|
152
|
+
<span class='kw'>begin</span>
|
|
153
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
|
|
154
|
+
|
|
155
|
+
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="../WorldTimeApi.html" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorldTimeApi.html#Error-constant" title="WorldTimeApi::Error (constant)">Error</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid timezone</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>!=</span> <span class='int'>200</span>
|
|
156
|
+
|
|
157
|
+
<span class='const'><span class='object_link'><a href="../WorldTimeApi.html" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorldTimeApi.html#Response-constant" title="WorldTimeApi::Response (constant)">Response</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_response'>response</span><span class='rbracket'>]</span>
|
|
158
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span>
|
|
159
|
+
<span class='const'><span class='object_link'><a href="../WorldTimeApi.html" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorldTimeApi.html#Error-constant" title="WorldTimeApi::Error (constant)">Error</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Connection error</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
|
160
|
+
<span class='kw'>end</span>
|
|
161
|
+
<span class='rbrace'>}</span></pre></dd>
|
|
162
|
+
|
|
163
|
+
</dl>
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<div id="footer">
|
|
178
|
+
Generated on Thu Nov 20 18:24:43 2025 by
|
|
179
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
180
|
+
0.9.37 (ruby-3.2.2).
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
</div>
|
|
184
|
+
</body>
|
|
185
|
+
</html>
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Module: WorldTimeApi
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.37
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
pathId = "WorldTimeApi";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index (W)</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">WorldTimeApi</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Module: WorldTimeApi
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<dl>
|
|
80
|
+
<dt>Defined in:</dt>
|
|
81
|
+
<dd>lib/world_time_api.rb<span class="defines">,<br />
|
|
82
|
+
lib/world_time_api/error.rb,<br /> lib/world_time_api/request.rb,<br /> lib/world_time_api/version.rb,<br /> lib/world_time_api/response.rb</span>
|
|
83
|
+
</dd>
|
|
84
|
+
</dl>
|
|
85
|
+
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
|
89
|
+
<div class="discussion">
|
|
90
|
+
|
|
91
|
+
<p>A Ruby wrapper for the World Time API.</p>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="tags">
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
|
100
|
+
<p class="children">
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="WorldTimeApi/Request.html" title="WorldTimeApi::Request (module)">Request</a></span>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
<h2>
|
|
112
|
+
Constant Summary
|
|
113
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
|
114
|
+
</h2>
|
|
115
|
+
|
|
116
|
+
<dl class="constants">
|
|
117
|
+
|
|
118
|
+
<dt id="Timezones-constant" class="">Timezones =
|
|
119
|
+
<div class="docstring">
|
|
120
|
+
<div class="discussion">
|
|
121
|
+
|
|
122
|
+
<p>Returns a list of all timezones supported by the World Time API.</p>
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="tags">
|
|
128
|
+
|
|
129
|
+
<div class="examples">
|
|
130
|
+
<h4 class="tag_title">Examples:</h4>
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'>Timezones</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span></code></pre>
|
|
134
|
+
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<p class="tag_title">Returns:</p>
|
|
138
|
+
<ul class="return">
|
|
139
|
+
|
|
140
|
+
<li>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
—
|
|
148
|
+
<div class='inline'>
|
|
149
|
+
<p>A hash representing the response body, or an error hash if there was a problem with the request.</p>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
</li>
|
|
153
|
+
|
|
154
|
+
</ul>
|
|
155
|
+
|
|
156
|
+
</div>
|
|
157
|
+
</dt>
|
|
158
|
+
<dd><pre class="code"><span class='tlambda'>-></span> <span class='tlambeg'>{</span> <span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html" title="WorldTimeApi::Request (module)">Request</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html#Call-constant" title="WorldTimeApi::Request::Call (constant)">Call</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/timezone</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='rbrace'>}</span></pre></dd>
|
|
159
|
+
|
|
160
|
+
<dt id="Time-constant" class="">Time =
|
|
161
|
+
<div class="docstring">
|
|
162
|
+
<div class="discussion">
|
|
163
|
+
|
|
164
|
+
<p>Returns the current time for the specified timezone.</p>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="tags">
|
|
170
|
+
|
|
171
|
+
<div class="examples">
|
|
172
|
+
<h4 class="tag_title">Examples:</h4>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Europe/London</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
|
176
|
+
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<p class="tag_title">Returns:</p>
|
|
180
|
+
<ul class="return">
|
|
181
|
+
|
|
182
|
+
<li>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
—
|
|
190
|
+
<div class='inline'>
|
|
191
|
+
<p>A hash representing the response body, or an error hash if there was a problem with the request.</p>
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
</li>
|
|
195
|
+
|
|
196
|
+
</ul>
|
|
197
|
+
|
|
198
|
+
</div>
|
|
199
|
+
</dt>
|
|
200
|
+
<dd><pre class="code"><span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_timezone'>timezone</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html" title="WorldTimeApi::Request (module)">Request</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html#Call-constant" title="WorldTimeApi::Request::Call (constant)">Call</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/timezone/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_timezone'>timezone</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='rbrace'>}</span></pre></dd>
|
|
201
|
+
|
|
202
|
+
<dt id="ClientIp-constant" class="">ClientIp =
|
|
203
|
+
<div class="docstring">
|
|
204
|
+
<div class="discussion">
|
|
205
|
+
|
|
206
|
+
<p>Returns the current time for the client’s IP address, or for the specified IP address if provided.</p>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="tags">
|
|
212
|
+
|
|
213
|
+
<div class="examples">
|
|
214
|
+
<h4 class="tag_title">Examples:</h4>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'>ClientIp</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
|
218
|
+
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<p class="tag_title">Returns:</p>
|
|
222
|
+
<ul class="return">
|
|
223
|
+
|
|
224
|
+
<li>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
—
|
|
232
|
+
<div class='inline'>
|
|
233
|
+
<p>A hash representing the response body, or an error hash if there was a problem with the request.</p>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
</li>
|
|
237
|
+
|
|
238
|
+
</ul>
|
|
239
|
+
|
|
240
|
+
</div>
|
|
241
|
+
</dt>
|
|
242
|
+
<dd><pre class="code"><span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_ip'>ip</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html" title="WorldTimeApi::Request (module)">Request</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorldTimeApi/Request.html#Call-constant" title="WorldTimeApi::Request::Call (constant)">Call</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/ip</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ip'>ip</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ip'>ip</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='rbrace'>}</span></pre></dd>
|
|
243
|
+
|
|
244
|
+
<dt id="Error-constant" class="">Error =
|
|
245
|
+
<div class="docstring">
|
|
246
|
+
<div class="discussion">
|
|
247
|
+
|
|
248
|
+
<p>Creates an error object with the specified message.</p>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
<div class="tags">
|
|
254
|
+
|
|
255
|
+
<div class="examples">
|
|
256
|
+
<h4 class="tag_title">Examples:</h4>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'>Error</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid timezone</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
|
260
|
+
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<p class="tag_title">Returns:</p>
|
|
264
|
+
<ul class="return">
|
|
265
|
+
|
|
266
|
+
<li>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
—
|
|
274
|
+
<div class='inline'>
|
|
275
|
+
<p>A hash with a single key ‘“error”` containing the error message.</p>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
</li>
|
|
279
|
+
|
|
280
|
+
</ul>
|
|
281
|
+
|
|
282
|
+
</div>
|
|
283
|
+
</dt>
|
|
284
|
+
<dd><pre class="code"><span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='lbrace'>{</span> <span class='label'>error:</span> <span class='id identifier rubyid_message'>message</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span></pre></dd>
|
|
285
|
+
|
|
286
|
+
<dt id="VERSION-constant" class="">VERSION =
|
|
287
|
+
<div class="docstring">
|
|
288
|
+
<div class="discussion">
|
|
289
|
+
|
|
290
|
+
<p>The current version number of the WorldTimeApi gem.</p>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
<div class="tags">
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
</div>
|
|
299
|
+
</dt>
|
|
300
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.5</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
301
|
+
|
|
302
|
+
<dt id="Response-constant" class="">Response =
|
|
303
|
+
<div class="docstring">
|
|
304
|
+
<div class="discussion">
|
|
305
|
+
|
|
306
|
+
<p>Converts the HTTParty response object into a hash.</p>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
<div class="tags">
|
|
312
|
+
|
|
313
|
+
<div class="examples">
|
|
314
|
+
<h4 class="tag_title">Examples:</h4>
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="WorldTimeApi (module)">WorldTimeApi</a></span></span><span class='op'>::</span><span class='const'>Response</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http://worldtimeapi.org/api/timezone/Europe/London</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span></code></pre>
|
|
318
|
+
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<p class="tag_title">Returns:</p>
|
|
322
|
+
<ul class="return">
|
|
323
|
+
|
|
324
|
+
<li>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
—
|
|
332
|
+
<div class='inline'>
|
|
333
|
+
<p>A hash representation of the response body.</p>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</li>
|
|
337
|
+
|
|
338
|
+
</ul>
|
|
339
|
+
|
|
340
|
+
</div>
|
|
341
|
+
</dt>
|
|
342
|
+
<dd><pre class="code"><span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> <span class='rbrace'>}</span></pre></dd>
|
|
343
|
+
|
|
344
|
+
</dl>
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
<div id="footer">
|
|
358
|
+
Generated on Thu Nov 20 18:24:43 2025 by
|
|
359
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
360
|
+
0.9.37 (ruby-3.2.2).
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
</div>
|
|
364
|
+
</body>
|
|
365
|
+
</html>
|