particlerb 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/particle/device.rb +17 -3
- data/lib/particle/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36320de615ce1f9bdabfa1686e7f163b29dc433d
|
4
|
+
data.tar.gz: 8229fe325204e7fe260d4e5cc27a5d96c9e65ab2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d80dbcba6469ea94aa6d1e39982e8d916c1fbc0755b421445fb4903fe2cbf3d6ab54462c6187487d424c562b9f20ff829a7a926f75c38d341d965d92b36c22
|
7
|
+
data.tar.gz: 2226d7017c1e44d0af6a58ca1054fa1c8aaa98c7e1234ea03b0a2c9fc53711ce1386b26eaef834b7d57ff26bdeaa7d7840fd12828f29a7073cfbcb6816445fe3
|
data/lib/particle/device.rb
CHANGED
@@ -19,6 +19,10 @@ module Particle
|
|
19
19
|
else
|
20
20
|
@attributes = { name: attributes }
|
21
21
|
end
|
22
|
+
else
|
23
|
+
# Listing all devices returns partial attributes so check if the
|
24
|
+
# device was fully loaded or not
|
25
|
+
@fully_loaded = true if attributes.key?(:variables)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -36,17 +40,27 @@ module Particle
|
|
36
40
|
@attributes[:id] || @attributes[:name]
|
37
41
|
end
|
38
42
|
|
39
|
-
attribute_reader :connected, :
|
40
|
-
:
|
43
|
+
attribute_reader :connected, :product_id, :last_heard, :last_app,
|
44
|
+
:last_ip_address
|
41
45
|
|
42
46
|
alias_method :connected?, :connected
|
43
47
|
|
48
|
+
def functions
|
49
|
+
get_attributes unless @fully_loaded
|
50
|
+
@attributes[:functions]
|
51
|
+
end
|
52
|
+
|
53
|
+
def variables
|
54
|
+
get_attributes unless @fully_loaded
|
55
|
+
@attributes[:variables]
|
56
|
+
end
|
57
|
+
|
44
58
|
def product
|
45
59
|
PRODUCT_IDS[product_id]
|
46
60
|
end
|
47
61
|
|
48
62
|
def get_attributes
|
49
|
-
@loaded = true
|
63
|
+
@loaded = @fully_loaded = true
|
50
64
|
@attributes = @client.device_attributes(self)
|
51
65
|
end
|
52
66
|
|
data/lib/particle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: particlerb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Vanier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|