smart_energy_group 0.0.2 → 0.0.3

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: 916b9c68eb2bb0b97c6036198da6bf6817c82e0f
4
- data.tar.gz: 7184f9cf619b63a72abf313f6e683dec1df1a2d0
3
+ metadata.gz: 4cb0a88958822979df67e495f49f7c041bf80617
4
+ data.tar.gz: 3383031983ae53cbdb2e1ce5ba9b45eb36126e0b
5
5
  SHA512:
6
- metadata.gz: 8456d64e7c1416169fb342eab88cb933d3c545ddd8d28590a80d24dc2891d3426bbe84707862278e42cce776e81cfb67c0f1fd5bf39e141cfcb5bf2c71e2557a
7
- data.tar.gz: d7541be7bcbabec500e99b26095238deede6451d19befce353be0e092dda4699ec2fbcbdf4452f9224a8972942e943f1b2f5af6abbb34959be326531b742fdaa
6
+ metadata.gz: 780933a577b9fab66308cd566209ef5b6be274bf24e240cf104609db3c1effb6b0ff8c18cf402b57b65d25f5070cc07553440e9ad817678a733bebc16795b5c0
7
+ data.tar.gz: e8d639d06f1be21b6fcbfda1089f13720662095074fc4356d3c318bdae980a81750851887d43a5b75d8e3f4420845e66cfafd5e94dfde24450c7383dfff3e3aa
data/.rubocop.yml CHANGED
@@ -12,6 +12,9 @@ Style/Lambda:
12
12
  Style/TrailingCommaInLiteral:
13
13
  EnforcedStyleForMultiline: comma
14
14
 
15
+ Metrics/MethodLength:
16
+ Max: 15
17
+
15
18
  Metrics/LineLength:
16
19
  Max: 120
17
20
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.3 (2016-05-16)
4
+
5
+ * Add support for sending gappy data (@johnf)
6
+
3
7
  ## 0.0.2 (2016-05-15)
4
8
 
5
9
  * Send UTC time (@johnf)
data/README.md CHANGED
@@ -47,6 +47,16 @@ seg.send_data(
47
47
  )
48
48
  ```
49
49
 
50
+ If you don't have consecutive channels that you want to send you can pass an
51
+ array like so
52
+
53
+ ``` ruby
54
+ seg.send_data(
55
+ 'home',
56
+ :power => { 1 => 1023.6, 5 => 500.9 }
57
+ )
58
+ ```
59
+
50
60
  The send_data operation accepts the following options
51
61
 
52
62
  | Option | Description |
@@ -38,9 +38,18 @@ module SmartEnergyGroup
38
38
 
39
39
  def generate_data(options)
40
40
  data = []
41
+
41
42
  DATA_TYPES.keys.each do |type|
42
- next unless options[type]
43
- data += options[type].map.with_index(1) { |value, i| "(#{DATA_TYPES[type]}_#{i} #{value})" }
43
+ case options[type]
44
+ when Array
45
+ data += options[type].map.with_index(1) { |value, i| "(#{DATA_TYPES[type]}_#{i} #{value})" }
46
+ when Hash
47
+ data += options[type].map { |i, value| "(#{DATA_TYPES[type]}_#{i} #{value})" }
48
+ when NilClass
49
+ next
50
+ else
51
+ raise('Unsupported object type')
52
+ end
44
53
  end
45
54
 
46
55
  data.join('')
@@ -1,3 +1,3 @@
1
1
  module SmartEnergyGroup
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_energy_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ferlito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-15 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty