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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 293150020c9be707c6a09737d8735b5dc5d234f1
4
- data.tar.gz: 6af2c264d32e019c7dfa68ad8ad3d3356a9dfb6b
3
+ metadata.gz: 36320de615ce1f9bdabfa1686e7f163b29dc433d
4
+ data.tar.gz: 8229fe325204e7fe260d4e5cc27a5d96c9e65ab2
5
5
  SHA512:
6
- metadata.gz: 0353b5354b550e2d25dd16a5d94bb9f08339f4ae53862ed5bb4468746eec4e1afb52b20a9c1dd1d928278599596f6363b78d6ac24af23ee8360754999e9e5862
7
- data.tar.gz: 752736bad1375878aa7a4960057311df6e28fca9074813869956fa24cdfdbc08ecb6efcf4e521ea12e806efa70e5ae62cb3fcaa067f5648a31334beea6a8c181
6
+ metadata.gz: f9d80dbcba6469ea94aa6d1e39982e8d916c1fbc0755b421445fb4903fe2cbf3d6ab54462c6187487d424c562b9f20ff829a7a926f75c38d341d965d92b36c22
7
+ data.tar.gz: 2226d7017c1e44d0af6a58ca1054fa1c8aaa98c7e1234ea03b0a2c9fc53711ce1386b26eaef834b7d57ff26bdeaa7d7840fd12828f29a7073cfbcb6816445fe3
@@ -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, :functions, :variables, :product_id,
40
- :last_heard, :last_app, :last_ip_address
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
 
@@ -1,3 +1,3 @@
1
1
  module Particle
2
- VERSION = "0.0.4".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
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
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-06 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday