itacher 0.0.1 → 0.0.2

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: 3c98873fd0bbc2dfebb93c1b6ac04b29d1fee9ad
4
- data.tar.gz: 9df74a0e75d3531bf0a85cc775072f2b0d3b1188
3
+ metadata.gz: 0ccbffbe0420f3e9d1fe0c9db5ba6ab15c193c4d
4
+ data.tar.gz: 8573c9c4bdf2455cba3ac74b1245742e2c598ee1
5
5
  SHA512:
6
- metadata.gz: 6f33d8c362d09788423c832bcf3feec0dddede7dfff58b326c8ec9043d8ffbe82dfa001005ed77472132c37417480250204b4a666dc07991e021fc30a066a4be
7
- data.tar.gz: 0bddc3217cff6f69f69fee3c1109b2e581891b0327291a5a463dc7c5adc9119b1821a2ceb42f81694015a6c4551e8bda9978499a4bbb28fe5f13077aa1b4aed7
6
+ metadata.gz: fa4aab14b68be26b1e3d60eed5a43e73e2618f042f6031d9f7ed31da92c5cd90a18272a6f02bd0ea8de7fa799e5d51cabe3b67cd3128b44bab8c6b452067c18d
7
+ data.tar.gz: 7bd91eeb35844ab5179b6720fc72c3155b9fe3b6ac232cb3baacaa321dbde825079684c500368600434a9f17be8814f94ac0b90a886eccdbaac1833c7c794c57
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Itacher
2
2
 
3
- TODO: Write a gem description
3
+ This gem can be used to control http://www.globalcache.com/products/itach/ip2ir-pspecs/ devices
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,13 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ ```
24
+ require "itacher"
25
+
26
+ device = Device.new("192.168.1.XXX", 4998)
27
+ command = device.learn_command
28
+ puts device.send_command(command)
29
+ ```
24
30
 
25
31
  ## Contributing
26
32
 
@@ -1,6 +1,14 @@
1
1
  require "socket"
2
2
 
3
3
  class Device
4
+ def self.send_commands(ip, port, *commands)
5
+ device = Device.new(ip, port)
6
+ commands.each do |command|
7
+ device.send_command(command)
8
+ end
9
+ device.close
10
+ end
11
+
4
12
  def initialize(ip, port)
5
13
  @socket = TCPSocket.new(ip, port)
6
14
  end
@@ -17,6 +25,10 @@ class Device
17
25
  command
18
26
  end
19
27
 
28
+ def close
29
+ @socket.close
30
+ end
31
+
20
32
  private
21
33
  def write(command)
22
34
  @socket << command
@@ -1,3 +1,3 @@
1
1
  module Itacher
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itacher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hurley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler