helium-ruby 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +85 -0
- data/docs/Helium.html +4 -4
- data/docs/Helium/Client.html +43 -21
- data/docs/Helium/Client/Elements.html +335 -0
- data/docs/Helium/Client/Http.html +1 -1
- data/docs/Helium/Client/Labels.html +637 -0
- data/docs/Helium/Client/Organizations.html +1 -1
- data/docs/Helium/Client/Sensors.html +1 -1
- data/docs/Helium/Client/Users.html +1 -1
- data/docs/Helium/Cursor.html +53 -1
- data/docs/Helium/DataPoint.html +152 -90
- data/docs/Helium/Element.html +589 -0
- data/docs/Helium/Label.html +658 -0
- data/docs/Helium/Organization.html +75 -203
- data/docs/Helium/Resource.html +869 -0
- data/docs/Helium/Sensor.html +102 -215
- data/docs/Helium/User.html +68 -179
- data/docs/Helium/Utils.html +1 -1
- data/docs/_index.html +63 -1
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +107 -1
- data/docs/index.html +107 -1
- data/docs/method_list.html +267 -43
- data/docs/top-level-namespace.html +1 -1
- data/lib/helium.rb +3 -0
- data/lib/helium/client.rb +4 -0
- data/lib/helium/client/elements.rb +42 -0
- data/lib/helium/client/labels.rb +105 -0
- data/lib/helium/cursor.rb +4 -0
- data/lib/helium/data_point.rb +28 -8
- data/lib/helium/element.rb +27 -0
- data/lib/helium/label.rb +44 -0
- data/lib/helium/organization.rb +12 -15
- data/lib/helium/resource.rb +58 -0
- data/lib/helium/sensor.rb +16 -17
- data/lib/helium/user.rb +11 -13
- data/lib/helium/version.rb +1 -1
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdbf674c33496abc4e68e2b22315c4cb3624d67
|
4
|
+
data.tar.gz: b1bba384d866d1db0655c6e9bd563d19986c8bc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac81899c675e3e37c7218ba34d70245e258f85d77a28de1e1f589de5b1b6404dfbd7c167197aed18cb65064b5fc5d43d05e38c49627c4fce97dce9a8fcb5f693
|
7
|
+
data.tar.gz: 6533650c473ed52c0e0f51cc9c7861e83152ac8518faf64405fd1d3a0d4b52a5218a5ce845898abbfbd443de2d511fd84d1d95791631e4d353b670881e087e4a
|
data/README.md
CHANGED
@@ -173,6 +173,91 @@ data_points.first.avg
|
|
173
173
|
|
174
174
|
A full list of aggregation types and sizes can be found here: https://docs.helium.com/docs/timeseries#aggregations.
|
175
175
|
|
176
|
+
### Elements
|
177
|
+
|
178
|
+
#### Get all Elements
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
client.elements
|
182
|
+
# => [#<Helium::Element:0x007faf732c11e8 @id="78b6a9f4-9c39-4673-9946-72a16c35a422", @name="SF Office", @mac="6081f9fffe0002a8", @created_at="2015-08-12T23:10:40.537762Z", @updated_at="2015-08-12T23:10:40.536644Z", @versions={"element"=>"3050900"}>,...]
|
183
|
+
```
|
184
|
+
|
185
|
+
#### Get an Element by id
|
186
|
+
```ruby
|
187
|
+
client.element("1b686e82-bd4a-4aac-9d7b-9bdbe1e9a7de")
|
188
|
+
# => #<Helium::Element:0x007faf732c2548 @id="1b686e82-bd4a-4aac-9d7b-9bdbe1e9a7de", @name="SF Office", @mac="6081f9fffe00033f", @created_at="2015-08-12T23:19:34.175932Z", @updated_at="2015-08-12T23:19:34.174828Z", @versions=nil>
|
189
|
+
```
|
190
|
+
|
191
|
+
#### Update an Element
|
192
|
+
```ruby
|
193
|
+
element.update(name: "A New Name")
|
194
|
+
# => #<Helium::Element:0x007faf732c2548 @id="1b686e82-bd4a-4aac-9d7b-9bdbe1e9a7de", @name="A New Name", @mac="6081f9fffe00033f", @created_at="2015-08-12T23:19:34.175932Z", @updated_at="2015-08-12T23:19:34.174828Z", @versions=nil>
|
195
|
+
```
|
196
|
+
|
197
|
+
### Labels
|
198
|
+
|
199
|
+
Sensors can be grouped together under a named label.
|
200
|
+
|
201
|
+
#### Create a Label
|
202
|
+
```ruby
|
203
|
+
client.new_label(name: 'A New Label')
|
204
|
+
# => #<Helium::Label:0x007ffd80f2be28 @id="409d9394-60d5-436a-b8cb-7160d466fc5a", @name="A New Label", @created_at="2016-08-22T18:58:34.415862Z", @updated_at="2016-08-22T18:58:34.415862Z">
|
205
|
+
```
|
206
|
+
|
207
|
+
#### List all Labels
|
208
|
+
```ruby
|
209
|
+
client.labels
|
210
|
+
# => [#<Helium::Label:0x007ffd80f2be28 @id="409d9394-60d5-436a-b8cb-7160d466fc5a", @name="A New Label", @created_at="2016-08-22T18:58:34.415862Z", @updated_at="2016-08-22T18:58:34.415862Z">, ...]
|
211
|
+
```
|
212
|
+
|
213
|
+
#### Find a Label by id
|
214
|
+
```ruby
|
215
|
+
label = client.label("409d9394-60d5-436a-b8cb-7160d466fc5a")
|
216
|
+
# => #<Helium::Label:0x007ffd80f2be28 @id="409d9394-60d5-436a-b8cb-7160d466fc5a", @name="A New Label", @created_at="2016-08-22T18:58:34.415862Z", @updated_at="2016-08-22T18:58:34.415862Z">
|
217
|
+
```
|
218
|
+
|
219
|
+
#### Update a Label
|
220
|
+
```ruby
|
221
|
+
label.update(name: 'An Updated Label')
|
222
|
+
# => #<Helium::Label:0x007ffd80d41680 @id="409d9394-60d5-436a-b8cb-7160d466fc5a", @name="An Updated Label", @created_at="2016-08-22T18:58:34.415862Z", @updated_at="2016-08-22T18:58:34.415862Z">
|
223
|
+
```
|
224
|
+
|
225
|
+
#### Add Sensors to a Label
|
226
|
+
```ruby
|
227
|
+
label.add_sensors(a_sensor)
|
228
|
+
# Or
|
229
|
+
label.add_sensors([sensor_1, sensor_2])
|
230
|
+
```
|
231
|
+
|
232
|
+
#### View a Label's Sensors
|
233
|
+
```ruby
|
234
|
+
label.sensors
|
235
|
+
# => [
|
236
|
+
# [0] #<Helium::Sensor:0x007ffd81147450 @id="08bab58b-d095-4c7c-912c-1f8024d91d95", @name="Marc's Isotope", @mac="6081f9fffe00019b", @ports=["b", "t"], @created_at="2015-08-06T17:28:11.614107Z", @updated_at="2016-05-30T22:36:50.810716Z">
|
237
|
+
# ]
|
238
|
+
```
|
239
|
+
|
240
|
+
#### Remove Sensors from a Label
|
241
|
+
```ruby
|
242
|
+
label.remove_sensors(a_sensor)
|
243
|
+
# Or
|
244
|
+
label.remove_sensors([sensor_1, sensor_2])
|
245
|
+
```
|
246
|
+
|
247
|
+
#### Destroy a Label
|
248
|
+
```ruby
|
249
|
+
label.destroy
|
250
|
+
# => true
|
251
|
+
```
|
252
|
+
|
253
|
+
### JSON
|
254
|
+
All objects and collections of objects have a JSON representation. Simply call `.to_json`:
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
client.sensors.first.to_json
|
258
|
+
# => "{\"id\":\"08bab58b-d095-4c7c-912c-1f8024d91d95\",\"created_at\":\"2015-08-06T17:28:11+00:00\",\"updated_at\":\"2016-05-30T22:36:50+00:00\",\"name\":\"Marc's Isotope\",\"mac\":\"6081f9fffe00019b\",\"ports\":[\"b\",\"t\"]}"
|
259
|
+
```
|
260
|
+
|
176
261
|
## Source Documentation
|
177
262
|
Documentation for the gem's source can be found here: https://helium.github.io/helium-ruby/
|
178
263
|
|
data/docs/Helium.html
CHANGED
@@ -81,7 +81,7 @@
|
|
81
81
|
<dl>
|
82
82
|
<dt>Defined in:</dt>
|
83
83
|
<dd>lib/helium.rb<span class="defines">,<br />
|
84
|
-
lib/helium/user.rb,<br /> lib/helium/utils.rb,<br /> lib/helium/sensor.rb,<br /> lib/helium/client.rb,<br /> lib/helium/
|
84
|
+
lib/helium/user.rb,<br /> lib/helium/utils.rb,<br /> lib/helium/label.rb,<br /> lib/helium/cursor.rb,<br /> lib/helium/sensor.rb,<br /> lib/helium/client.rb,<br /> lib/helium/element.rb,<br /> lib/helium/version.rb,<br /> lib/helium/resource.rb,<br /> lib/helium/data_point.rb,<br /> lib/helium/client/http.rb,<br /> lib/helium/client/users.rb,<br /> lib/helium/organization.rb,<br /> lib/helium/client/labels.rb,<br /> lib/helium/client/sensors.rb,<br /> lib/helium/client/elements.rb,<br /> lib/helium/client/organizations.rb</span>
|
85
85
|
</dd>
|
86
86
|
</dl>
|
87
87
|
|
@@ -95,7 +95,7 @@
|
|
95
95
|
|
96
96
|
|
97
97
|
|
98
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Helium/Client.html" title="Helium::Client (class)">Client</a></span>, <span class='object_link'><a href="Helium/Cursor.html" title="Helium::Cursor (class)">Cursor</a></span>, <span class='object_link'><a href="Helium/DataPoint.html" title="Helium::DataPoint (class)">DataPoint</a></span>, <span class='object_link'><a href="Helium/Organization.html" title="Helium::Organization (class)">Organization</a></span>, <span class='object_link'><a href="Helium/Sensor.html" title="Helium::Sensor (class)">Sensor</a></span>, <span class='object_link'><a href="Helium/User.html" title="Helium::User (class)">User</a></span>
|
98
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Helium/Client.html" title="Helium::Client (class)">Client</a></span>, <span class='object_link'><a href="Helium/Cursor.html" title="Helium::Cursor (class)">Cursor</a></span>, <span class='object_link'><a href="Helium/DataPoint.html" title="Helium::DataPoint (class)">DataPoint</a></span>, <span class='object_link'><a href="Helium/Element.html" title="Helium::Element (class)">Element</a></span>, <span class='object_link'><a href="Helium/Label.html" title="Helium::Label (class)">Label</a></span>, <span class='object_link'><a href="Helium/Organization.html" title="Helium::Organization (class)">Organization</a></span>, <span class='object_link'><a href="Helium/Resource.html" title="Helium::Resource (class)">Resource</a></span>, <span class='object_link'><a href="Helium/Sensor.html" title="Helium::Sensor (class)">Sensor</a></span>, <span class='object_link'><a href="Helium/User.html" title="Helium::User (class)">User</a></span>
|
99
99
|
|
100
100
|
|
101
101
|
</p>
|
@@ -106,7 +106,7 @@
|
|
106
106
|
<dt id="VERSION-constant" class="">VERSION =
|
107
107
|
|
108
108
|
</dt>
|
109
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.3.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
110
110
|
|
111
111
|
</dl>
|
112
112
|
|
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Mon Aug 22 15:52:19 2016 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.9.3 (ruby-2.3.1).
|
127
127
|
</div>
|
data/docs/Helium/Client.html
CHANGED
@@ -91,7 +91,7 @@
|
|
91
91
|
|
92
92
|
<dl>
|
93
93
|
<dt>Includes:</dt>
|
94
|
-
<dd><span class='object_link'><a href="Client/Http.html" title="Helium::Client::Http (module)">Http</a></span>, <span class='object_link'><a href="Client/Organizations.html" title="Helium::Client::Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span>, <span class='object_link'><a href="Client/Users.html" title="Helium::Client::Users (module)">Users</a></span>, <span class='object_link'><a href="Utils.html" title="Helium::Utils (module)">Utils</a></span></dd>
|
94
|
+
<dd><span class='object_link'><a href="Client/Elements.html" title="Helium::Client::Elements (module)">Elements</a></span>, <span class='object_link'><a href="Client/Http.html" title="Helium::Client::Http (module)">Http</a></span>, <span class='object_link'><a href="Client/Labels.html" title="Helium::Client::Labels (module)">Labels</a></span>, <span class='object_link'><a href="Client/Organizations.html" title="Helium::Client::Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span>, <span class='object_link'><a href="Client/Users.html" title="Helium::Client::Users (module)">Users</a></span>, <span class='object_link'><a href="Utils.html" title="Helium::Utils (module)">Utils</a></span></dd>
|
95
95
|
</dl>
|
96
96
|
|
97
97
|
|
@@ -102,7 +102,7 @@
|
|
102
102
|
<dl>
|
103
103
|
<dt>Defined in:</dt>
|
104
104
|
<dd>lib/helium/client.rb<span class="defines">,<br />
|
105
|
-
lib/helium/client/http.rb,<br /> lib/helium/client/users.rb,<br /> lib/helium/client/sensors.rb,<br /> lib/helium/client/organizations.rb</span>
|
105
|
+
lib/helium/client/http.rb,<br /> lib/helium/client/users.rb,<br /> lib/helium/client/labels.rb,<br /> lib/helium/client/sensors.rb,<br /> lib/helium/client/elements.rb,<br /> lib/helium/client/organizations.rb</span>
|
106
106
|
</dd>
|
107
107
|
</dl>
|
108
108
|
|
@@ -112,7 +112,7 @@
|
|
112
112
|
<p class="children">
|
113
113
|
|
114
114
|
|
115
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Client/Http.html" title="Helium::Client::Http (module)">Http</a></span>, <span class='object_link'><a href="Client/Organizations.html" title="Helium::Client::Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span>, <span class='object_link'><a href="Client/Users.html" title="Helium::Client::Users (module)">Users</a></span>
|
115
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Client/Elements.html" title="Helium::Client::Elements (module)">Elements</a></span>, <span class='object_link'><a href="Client/Http.html" title="Helium::Client::Http (module)">Http</a></span>, <span class='object_link'><a href="Client/Labels.html" title="Helium::Client::Labels (module)">Labels</a></span>, <span class='object_link'><a href="Client/Organizations.html" title="Helium::Client::Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span>, <span class='object_link'><a href="Client/Users.html" title="Helium::Client::Users (module)">Users</a></span>
|
116
116
|
|
117
117
|
|
118
118
|
|
@@ -251,6 +251,28 @@
|
|
251
251
|
|
252
252
|
|
253
253
|
|
254
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Client/Elements.html" title="Helium::Client::Elements (module)">Elements</a></span></h3>
|
255
|
+
<p class="inherited"><span class='object_link'><a href="Client/Elements.html#element-instance_method" title="Helium::Client::Elements#element (method)">#element</a></span>, <span class='object_link'><a href="Client/Elements.html#elements-instance_method" title="Helium::Client::Elements#elements (method)">#elements</a></span>, <span class='object_link'><a href="Client/Elements.html#update_element-instance_method" title="Helium::Client::Elements#update_element (method)">#update_element</a></span></p>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Client/Labels.html" title="Helium::Client::Labels (module)">Labels</a></span></h3>
|
266
|
+
<p class="inherited"><span class='object_link'><a href="Client/Labels.html#delete_label-instance_method" title="Helium::Client::Labels#delete_label (method)">#delete_label</a></span>, <span class='object_link'><a href="Client/Labels.html#label-instance_method" title="Helium::Client::Labels#label (method)">#label</a></span>, <span class='object_link'><a href="Client/Labels.html#label_sensors-instance_method" title="Helium::Client::Labels#label_sensors (method)">#label_sensors</a></span>, <span class='object_link'><a href="Client/Labels.html#labels-instance_method" title="Helium::Client::Labels#labels (method)">#labels</a></span>, <span class='object_link'><a href="Client/Labels.html#new_label-instance_method" title="Helium::Client::Labels#new_label (method)">#new_label</a></span>, <span class='object_link'><a href="Client/Labels.html#update_label-instance_method" title="Helium::Client::Labels#update_label (method)">#update_label</a></span>, <span class='object_link'><a href="Client/Labels.html#update_label_sensors-instance_method" title="Helium::Client::Labels#update_label_sensors (method)">#update_label_sensors</a></span></p>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
254
276
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span></h3>
|
255
277
|
<p class="inherited"><span class='object_link'><a href="Client/Sensors.html#delete_sensor-instance_method" title="Helium::Client::Sensors#delete_sensor (method)">#delete_sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#new_sensor-instance_method" title="Helium::Client::Sensors#new_sensor (method)">#new_sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor-instance_method" title="Helium::Client::Sensors#sensor (method)">#sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_timeseries-instance_method" title="Helium::Client::Sensors#sensor_timeseries (method)">#sensor_timeseries</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensors-instance_method" title="Helium::Client::Sensors#sensors (method)">#sensors</a></span>, <span class='object_link'><a href="Client/Sensors.html#update_sensor-instance_method" title="Helium::Client::Sensors#update_sensor (method)">#update_sensor</a></span></p>
|
256
278
|
|
@@ -325,13 +347,13 @@
|
|
325
347
|
<pre class="lines">
|
326
348
|
|
327
349
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
350
|
+
20
|
351
|
+
21
|
352
|
+
22
|
353
|
+
23</pre>
|
332
354
|
</td>
|
333
355
|
<td>
|
334
|
-
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line
|
356
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line 20</span>
|
335
357
|
|
336
358
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>api_key:</span><span class='comma'>,</span> <span class='label'>debug:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
337
359
|
<span class='ivar'>@api_key</span> <span class='op'>=</span> <span class='id identifier rubyid_api_key'>api_key</span>
|
@@ -374,12 +396,12 @@
|
|
374
396
|
<pre class="lines">
|
375
397
|
|
376
398
|
|
377
|
-
|
378
|
-
|
379
|
-
|
399
|
+
18
|
400
|
+
19
|
401
|
+
20</pre>
|
380
402
|
</td>
|
381
403
|
<td>
|
382
|
-
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line
|
404
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line 18</span>
|
383
405
|
|
384
406
|
<span class='kw'>def</span> <span class='id identifier rubyid_api_key'>api_key</span>
|
385
407
|
<span class='ivar'>@api_key</span>
|
@@ -433,12 +455,12 @@
|
|
433
455
|
<pre class="lines">
|
434
456
|
|
435
457
|
|
436
|
-
|
437
|
-
|
438
|
-
|
458
|
+
29
|
459
|
+
30
|
460
|
+
31</pre>
|
439
461
|
</td>
|
440
462
|
<td>
|
441
|
-
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line
|
463
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line 29</span>
|
442
464
|
|
443
465
|
<span class='kw'>def</span> <span class='id identifier rubyid_debug?'>debug?</span>
|
444
466
|
<span class='ivar'>@debug</span> <span class='op'>==</span> <span class='kw'>true</span>
|
@@ -463,12 +485,12 @@
|
|
463
485
|
<pre class="lines">
|
464
486
|
|
465
487
|
|
466
|
-
|
467
|
-
|
468
|
-
|
488
|
+
25
|
489
|
+
26
|
490
|
+
27</pre>
|
469
491
|
</td>
|
470
492
|
<td>
|
471
|
-
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line
|
493
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client.rb', line 25</span>
|
472
494
|
|
473
495
|
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
474
496
|
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><Helium::Client @debug=</span><span class='embexpr_beg'>#{</span><span class='ivar'>@debug</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
@@ -483,7 +505,7 @@
|
|
483
505
|
</div>
|
484
506
|
|
485
507
|
<div id="footer">
|
486
|
-
Generated on
|
508
|
+
Generated on Mon Aug 22 15:52:20 2016 by
|
487
509
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
488
510
|
0.9.3 (ruby-2.3.1).
|
489
511
|
</div>
|
@@ -0,0 +1,335 @@
|
|
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: Helium::Client::Elements
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Helium::Client::Elements";
|
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"></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 (E)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Helium.html" title="Helium (module)">Helium</a></span></span> » <span class='title'><span class='object_link'><a href="../Client.html" title="Helium::Client (class)">Client</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Elements</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
|
+
<iframe id="search_frame" src="../../class_list.html"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><h1>Module: Helium::Client::Elements
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Included in:</dt>
|
81
|
+
<dd><span class='object_link'><a href="../Client.html" title="Helium::Client (class)">Helium::Client</a></span></dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<dl>
|
87
|
+
<dt>Defined in:</dt>
|
88
|
+
<dd>lib/helium/client/elements.rb</dd>
|
89
|
+
</dl>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<h2>
|
102
|
+
Instance Method Summary
|
103
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
104
|
+
</h2>
|
105
|
+
|
106
|
+
<ul class="summary">
|
107
|
+
|
108
|
+
<li class="public ">
|
109
|
+
<span class="summary_signature">
|
110
|
+
|
111
|
+
<a href="#element-instance_method" title="#element (instance method)">#<strong>element</strong>(id) ⇒ Object </a>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
</span>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
126
|
+
|
127
|
+
</li>
|
128
|
+
|
129
|
+
|
130
|
+
<li class="public ">
|
131
|
+
<span class="summary_signature">
|
132
|
+
|
133
|
+
<a href="#elements-instance_method" title="#elements (instance method)">#<strong>elements</strong> ⇒ Object </a>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
<li class="public ">
|
153
|
+
<span class="summary_signature">
|
154
|
+
|
155
|
+
<a href="#update_element-instance_method" title="#update_element (instance method)">#<strong>update_element</strong>(element, name:) ⇒ Object </a>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</span>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
</ul>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<div id="instance_method_details" class="method_details_list">
|
180
|
+
<h2>Instance Method Details</h2>
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method_details first">
|
184
|
+
<h3 class="signature first" id="element-instance_method">
|
185
|
+
|
186
|
+
#<strong>element</strong>(id) ⇒ <tt>Object</tt>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</h3><table class="source_code">
|
193
|
+
<tr>
|
194
|
+
<td>
|
195
|
+
<pre class="lines">
|
196
|
+
|
197
|
+
|
198
|
+
15
|
199
|
+
16
|
200
|
+
17
|
201
|
+
18
|
202
|
+
19
|
203
|
+
20</pre>
|
204
|
+
</td>
|
205
|
+
<td>
|
206
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client/elements.rb', line 15</span>
|
207
|
+
|
208
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_element'>element</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
|
209
|
+
<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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/element/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
210
|
+
<span class='id identifier rubyid_element_data'>element_data</span> <span class='op'>=</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='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>data</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
211
|
+
|
212
|
+
<span class='kw'>return</span> <span class='const'>Element</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>client:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_element_data'>element_data</span><span class='rparen'>)</span>
|
213
|
+
<span class='kw'>end</span></pre>
|
214
|
+
</td>
|
215
|
+
</tr>
|
216
|
+
</table>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method_details ">
|
220
|
+
<h3 class="signature " id="elements-instance_method">
|
221
|
+
|
222
|
+
#<strong>elements</strong> ⇒ <tt>Object</tt>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</h3><table class="source_code">
|
229
|
+
<tr>
|
230
|
+
<td>
|
231
|
+
<pre class="lines">
|
232
|
+
|
233
|
+
|
234
|
+
4
|
235
|
+
5
|
236
|
+
6
|
237
|
+
7
|
238
|
+
8
|
239
|
+
9
|
240
|
+
10
|
241
|
+
11
|
242
|
+
12
|
243
|
+
13</pre>
|
244
|
+
</td>
|
245
|
+
<td>
|
246
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client/elements.rb', line 4</span>
|
247
|
+
|
248
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_elements'>elements</span>
|
249
|
+
<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='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/element</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
250
|
+
<span class='id identifier rubyid_elements_data'>elements_data</span> <span class='op'>=</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='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>data</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
251
|
+
|
252
|
+
<span class='id identifier rubyid_elements'>elements</span> <span class='op'>=</span> <span class='id identifier rubyid_elements_data'>elements_data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_element_data'>element_data</span><span class='op'>|</span>
|
253
|
+
<span class='const'>Element</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>client:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_element_data'>element_data</span><span class='rparen'>)</span>
|
254
|
+
<span class='kw'>end</span>
|
255
|
+
|
256
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_elements'>elements</span>
|
257
|
+
<span class='kw'>end</span></pre>
|
258
|
+
</td>
|
259
|
+
</tr>
|
260
|
+
</table>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div class="method_details ">
|
264
|
+
<h3 class="signature " id="update_element-instance_method">
|
265
|
+
|
266
|
+
#<strong>update_element</strong>(element, name:) ⇒ <tt>Object</tt>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
</h3><table class="source_code">
|
273
|
+
<tr>
|
274
|
+
<td>
|
275
|
+
<pre class="lines">
|
276
|
+
|
277
|
+
|
278
|
+
22
|
279
|
+
23
|
280
|
+
24
|
281
|
+
25
|
282
|
+
26
|
283
|
+
27
|
284
|
+
28
|
285
|
+
29
|
286
|
+
30
|
287
|
+
31
|
288
|
+
32
|
289
|
+
33
|
290
|
+
34
|
291
|
+
35
|
292
|
+
36
|
293
|
+
37
|
294
|
+
38
|
295
|
+
39</pre>
|
296
|
+
</td>
|
297
|
+
<td>
|
298
|
+
<pre class="code"><span class="info file"># File 'lib/helium/client/elements.rb', line 22</span>
|
299
|
+
|
300
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_update_element'>update_element</span><span class='lparen'>(</span><span class='id identifier rubyid_element'>element</span><span class='comma'>,</span> <span class='label'>name:</span><span class='rparen'>)</span>
|
301
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/element/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
302
|
+
|
303
|
+
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
304
|
+
<span class='label'>data:</span> <span class='lbrace'>{</span>
|
305
|
+
<span class='label'>attributes:</span> <span class='lbrace'>{</span>
|
306
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span>
|
307
|
+
<span class='rbrace'>}</span><span class='comma'>,</span>
|
308
|
+
<span class='label'>id:</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span>
|
309
|
+
<span class='label'>type:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>element</span><span class='tstring_end'>"</span></span>
|
310
|
+
<span class='rbrace'>}</span>
|
311
|
+
<span class='rbrace'>}</span>
|
312
|
+
|
313
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_patch'>patch</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='label'>body:</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
314
|
+
<span class='id identifier rubyid_element_data'>element_data</span> <span class='op'>=</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='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>data</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
315
|
+
|
316
|
+
<span class='kw'>return</span> <span class='const'>Element</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>client:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_element_data'>element_data</span><span class='rparen'>)</span>
|
317
|
+
<span class='kw'>end</span></pre>
|
318
|
+
</td>
|
319
|
+
</tr>
|
320
|
+
</table>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div id="footer">
|
328
|
+
Generated on Mon Aug 22 15:52:20 2016 by
|
329
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
330
|
+
0.9.3 (ruby-2.3.1).
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
</body>
|
335
|
+
</html>
|