teletask 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bf110c899a56469721c423745f3ef5c733db49a
4
- data.tar.gz: 0eb0b4e397f907457ae01f881f94f4f4da9d5c93
3
+ metadata.gz: 3e61a169dc5d6902cedcee9792dfd3bbafc297d1
4
+ data.tar.gz: 89dc4834ac52e46ae058d63d1fadff6d06c62b5f
5
5
  SHA512:
6
- metadata.gz: 32ab75974fd417efb56248547e3e3ee2635ec7b00dfbe83e22d035a5d3f46e4b24b6ee7f318ac4a5437e295ed39f3f76e5a9f7469cfd61f8028c2d228fa9dd9e
7
- data.tar.gz: 615974b959e61ab11055b0f8c854e574553e0999575614eb75c409d69d37254795c21c04a8766bbd4bd5bdc64ad492b00c501708a1ccaaf1f039c159418122d8
6
+ metadata.gz: 1e65820ac75cb5432b429d0adc45ef7d6bfc9f56bbf33cc3e9ff5d80ee94c6b7a6083b5a6b704aecbdae83aa8a8c9641aacc0acbd2df468ff8dbeb3bdef5530b
7
+ data.tar.gz: 5aabb8df4e505bb6223be764f07f0c1699a203e4f7f9151af2bc215e8f48285da90d0bcfa44998d9f692dfd3f5296937f431bedfc870625a607ad2b880856db1
@@ -6,8 +6,8 @@ module TeletaskApi
6
6
  @parameters = Array.new
7
7
 
8
8
  case command
9
- when Teletask::Command::KEEPALIVE
10
- when Teletask::Command::LOG
9
+ when Command::KEEPALIVE
10
+ when Command::LOG
11
11
  @parameters = Array.new
12
12
  @parameters[0] = function
13
13
  @parameters[1] = number
@@ -20,12 +20,12 @@ module TeletaskApi
20
20
  calculatedChecksum = data[startindex..startindex+length-1].inject{|sum,x| sum + x } % 256
21
21
  checksum = data[startindex+length]
22
22
  raise "Checksum mismatch. Expecting #{checksum}, but calculated #{calculatedChecksum}" unless checksum == calculatedChecksum
23
- raise "Not an response." unless data[startindex+2] == Teletask::Command::EVENTREPORT
23
+ raise "Not an response." unless data[startindex+2] == Command::EVENTREPORT
24
24
  central = data[startindex+3]
25
25
  function = data[startindex+4]
26
26
  number = data[startindex+5..startindex+6].pack("c*").unpack("n").first
27
27
  case function
28
- when Teletask::Function::SENSOR
28
+ when Function::SENSOR
29
29
  parameters =data[startindex+8..startindex+9]
30
30
  else
31
31
  parameters =data[startindex+8]
@@ -42,15 +42,15 @@ module TeletaskApi
42
42
  def to_hash
43
43
  hash = Hash.new
44
44
  hash[:function] = function
45
- hash[:function_name] = Teletask::Function.name function
45
+ hash[:function_name] = Function.name function
46
46
  hash[:number] = number
47
47
  hash[:parameters] = parameters
48
48
  case function
49
- when Teletask::Function::SENSOR
50
- hash[:temperature] = TeletaskApi::Converter.short_to_temperature parameters
51
- when Teletask::Function::RELAY
49
+ when Function::SENSOR
50
+ hash[:temperature] = Converter.short_to_temperature parameters
51
+ when Function::RELAY
52
52
  hash[:state] = parameters
53
- hash[:state_name] = Teletask::Setting.name parameters
53
+ hash[:state_name] = Setting.name parameters
54
54
  end
55
55
  hash
56
56
  end
@@ -6,10 +6,8 @@ require_relative './constants'
6
6
  require_relative './request'
7
7
  require_relative './response'
8
8
 
9
- include TeletaskApi
10
9
 
11
10
  module TeletaskApi
12
-
13
11
  class Teletask
14
12
  include Observable
15
13
 
@@ -88,5 +86,3 @@ module TeletaskApi
88
86
  end
89
87
 
90
88
  end
91
-
92
- Teletask = TeletaskApi::Teletask
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teletask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sille Van Landschoot