helium-ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +4 -26
- data/CONTRIBUTORS.md +4 -0
- data/README.md +12 -19
- data/docs/Helium.html +2 -2
- data/docs/Helium/Client.html +2 -2
- data/docs/Helium/Client/Elements.html +69 -1
- data/docs/Helium/Client/Http.html +1 -1
- data/docs/Helium/Client/Labels.html +1 -1
- 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/ClientError.html +1 -1
- data/docs/Helium/Cursor.html +1 -1
- data/docs/Helium/DataPoint.html +2 -2
- data/docs/Helium/Element.html +60 -8
- data/docs/Helium/Error.html +7 -9
- data/docs/Helium/InvalidApiKey.html +1 -1
- data/docs/Helium/Label.html +2 -2
- data/docs/Helium/Organization.html +2 -2
- data/docs/Helium/Resource.html +113 -39
- data/docs/Helium/Sensor.html +188 -21
- data/docs/Helium/User.html +2 -2
- data/docs/Helium/Utils.html +1 -1
- data/docs/_index.html +1 -1
- data/docs/file.README.html +9 -22
- data/docs/index.html +9 -22
- data/docs/method_list.html +87 -47
- data/docs/top-level-namespace.html +1 -1
- data/lib/helium/resource.rb +3 -1
- data/lib/helium/sensor.rb +16 -5
- data/lib/helium/version.rb +1 -1
- metadata +3 -3
- data/CODE_OF_CONDUCT.md +0 -49
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Tue Aug 30 08:16:47 2016 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.3 (ruby-2.3.1).
|
108
108
|
</div>
|
data/lib/helium/resource.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module Helium
|
2
2
|
# Abstract base class for Helium Resources returned by the API
|
3
3
|
class Resource
|
4
|
-
attr_reader :id
|
4
|
+
attr_reader :id, :type
|
5
5
|
|
6
6
|
def initialize(opts = {})
|
7
7
|
@client = opts.fetch(:client)
|
8
8
|
@params = opts.fetch(:params)
|
9
9
|
|
10
10
|
@id = @params["id"]
|
11
|
+
@type = @params.dig('type')
|
11
12
|
@created_at = @params.dig('meta', 'created')
|
12
13
|
@updated_at = @params.dig('meta', 'updated')
|
13
14
|
end
|
@@ -137,6 +138,7 @@ module Helium
|
|
137
138
|
def as_json
|
138
139
|
{
|
139
140
|
id: id,
|
141
|
+
type: type,
|
140
142
|
created_at: created_at,
|
141
143
|
updated_at: updated_at
|
142
144
|
}
|
data/lib/helium/sensor.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module Helium
|
2
2
|
class Sensor < Resource
|
3
|
-
attr_reader :name, :mac, :ports
|
3
|
+
attr_reader :name, :mac, :ports, :last_seen, :firmware
|
4
4
|
|
5
5
|
def initialize(opts = {})
|
6
6
|
super(opts)
|
7
7
|
|
8
|
-
@name
|
9
|
-
@mac
|
10
|
-
@ports
|
8
|
+
@name = @params.dig('attributes', 'name')
|
9
|
+
@mac = @params.dig('meta', 'mac')
|
10
|
+
@ports = @params.dig('meta', 'ports')
|
11
|
+
@last_seen = @params.dig('meta', 'last-seen')
|
12
|
+
@firmware = @params.dig('meta', 'versions', 'sensor')
|
13
|
+
|
11
14
|
end
|
12
15
|
|
13
16
|
def timeseries(opts = {})
|
@@ -28,12 +31,20 @@ module Helium
|
|
28
31
|
)
|
29
32
|
end
|
30
33
|
|
34
|
+
# @return [DateTime, nil] when the resource was last seen
|
35
|
+
def last_seen
|
36
|
+
return nil if @last_seen.nil?
|
37
|
+
@_last_seen ||= DateTime.parse(@last_seen)
|
38
|
+
end
|
39
|
+
|
31
40
|
# TODO can probably generalize this a bit more
|
32
41
|
def as_json
|
33
42
|
super.merge({
|
34
43
|
name: name,
|
35
44
|
mac: mac,
|
36
|
-
ports: ports
|
45
|
+
ports: ports,
|
46
|
+
last_seen: last_seen,
|
47
|
+
firmware: firmware
|
37
48
|
})
|
38
49
|
end
|
39
50
|
end
|
data/lib/helium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helium-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -235,8 +235,8 @@ files:
|
|
235
235
|
- ".rspec"
|
236
236
|
- ".rubocop.yml"
|
237
237
|
- ".travis.yml"
|
238
|
-
- CODE_OF_CONDUCT.md
|
239
238
|
- CONTRIBUTING.md
|
239
|
+
- CONTRIBUTORS.md
|
240
240
|
- Gemfile
|
241
241
|
- Guardfile
|
242
242
|
- LICENSE.txt
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at allenan@helium.com. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|