lightwaverf 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/lightwaverf +1 -1
  2. data/lib/lightwaverf.rb +7 -7
  3. metadata +2 -2
@@ -14,7 +14,7 @@ case ARGV[0]
14
14
  when 'timer'
15
15
  puts LightWaveRF.new.timer ARGV[1], ARGV[2]
16
16
  when 'update'
17
- puts LightWaveRF.new.update_config ARGV[1], ARGV[2]
17
+ puts LightWaveRF.new.update_config ARGV[1], ARGV[2], ARGV[3]
18
18
  else
19
19
  LightWaveRF.new.send ARGV[0], ARGV[1], ARGV[2], ARGV[3]
20
20
  end
@@ -107,7 +107,7 @@ class LightWaveRF
107
107
  # Update the LightWaveRF Gem config file from the LightWaveRF Host server
108
108
  #
109
109
  # Example:
110
- # >> LightWaveRF.new.update_config 'name@example.com', '1234'
110
+ # >> LightWaveRF.new.update_config name@example.com, 1234
111
111
  #
112
112
  # Arguments:
113
113
  # email: (String)
@@ -121,15 +121,15 @@ class LightWaveRF
121
121
  # Login to LightWaveRF Host server
122
122
  require 'net/http'
123
123
  require 'uri'
124
- uri = URI.parse('https://lightwaverfhost.co.uk/manager/index.php')
125
- http = Net::HTTP.new(uri.host, uri.port)
124
+ uri = URI.parse 'https://lightwaverfhost.co.uk/manager/index.php'
125
+ http = Net::HTTP.new uri.host, uri.port
126
126
  if uri.scheme == 'https'
127
127
  require 'net/https'
128
128
  http.use_ssl = true
129
129
  end
130
130
  data = 'pin=' + pin + '&email=' + email
131
- headers = {'Content-Type'=> 'application/x-www-form-urlencoded'}
132
- resp, data = http.post(uri.request_uri, data, headers)
131
+ headers = { 'Content-Type'=> 'application/x-www-form-urlencoded '}
132
+ resp, data = http.post uri.request_uri, data, headers
133
133
 
134
134
  if resp and resp.body
135
135
  # Extract JavaScript variables from the page
@@ -144,7 +144,7 @@ class LightWaveRF
144
144
  end
145
145
  debug and (p '[Info - LightWaveRF Gem] Javascript variables ' + variables.to_s)
146
146
 
147
- rooms = Array.new
147
+ rooms = [ ]
148
148
  # Rooms - gRoomNames is a collection of 8 values, or room names
149
149
  variables['gRoomNames'].each_with_index do |(roomName), roomIndex|
150
150
  # Room Status - gRoomStatus is a collection of 8 values indicating the status of the corresponding room in gRoomNames
@@ -400,7 +400,7 @@ class LightWaveRF
400
400
  begin
401
401
  http.use_ssl = true
402
402
  rescue
403
- debug && ( p 'cannot use ssl' )
403
+ debug and ( p 'cannot use ssl' )
404
404
  end
405
405
  request = Net::HTTP::Get.new parsed_url.request_uri
406
406
  response = http.request request
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightwaverf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-09 00:00:00.000000000 Z
13
+ date: 2013-04-17 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Interact with lightwaverf wifi link from code or the command line. Control
16
16
  your lights, heating, sockets etc. Also set up timers using a google calendar and