smartermeter 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.3 (August 18, 2012)
4
+ * Fixed an issue with downloading data from PG&E.
5
+
3
6
  ## 0.4.2 (February 9, 2012)
4
7
  * Fixed an issue with uploading data to pachube.
5
8
  * Fixed README to accurately reflect the new API.
data/bin/smartermeter CHANGED
@@ -6,6 +6,11 @@ begin
6
6
  rescue Exception
7
7
  end
8
8
  require 'smartermeter'
9
+ require 'trollop'
9
10
 
10
- interface = SmarterMeter::Interfaces::CLI.new
11
+ options = Trollop::options do
12
+ opt :debug, "Enable debugging statements", :default => false
13
+ end
14
+
15
+ interface = SmarterMeter::Interfaces::CLI.new(options)
11
16
  SmarterMeter::Daemon.new(interface).start
data/lib/smartermeter.rb CHANGED
@@ -7,5 +7,5 @@ require 'smartermeter/services/brighterplanet'
7
7
  require 'smartermeter/interfaces/cli'
8
8
 
9
9
  module SmarterMeter
10
- VERSION = "0.4.2"
10
+ VERSION = "0.4.3"
11
11
  end
@@ -208,7 +208,7 @@ module SmarterMeter
208
208
  case @config[:transport]
209
209
  when :pachube
210
210
  @ui.log.info("Uploading #{date} to Pachube")
211
- transport = SmarterMeter::Services::Pachube.new(@config[:pachube])
211
+ transport = SmarterMeter::Services::Pachube.new(@ui, @config[:pachube])
212
212
  if transport.upload(samples)
213
213
  @ui.log.info("Upload for #{date} complete")
214
214
  else
@@ -3,11 +3,21 @@ require 'logger'
3
3
  module SmarterMeter
4
4
  module Interfaces
5
5
  class CLI
6
+ def initialize(options)
7
+ @options = options
8
+ end
9
+
6
10
  # Returns a logger like interface to log errors and warnings to.
7
11
  def log
8
12
  return @logger if @logger
9
13
  @logger = Logger.new STDOUT
10
- @logger.level = Logger::INFO
14
+
15
+ if @options[:debug]
16
+ @logger.level = Logger::DEBUG
17
+ else
18
+ @logger.level = Logger::INFO
19
+ end
20
+
11
21
  @logger
12
22
  end
13
23
 
@@ -63,7 +63,7 @@ module SmarterMeter
63
63
 
64
64
  begin
65
65
  form = @data_page.forms.first
66
- form.radiobutton_with(:name => 'exportFormat', :value => 'ESPI_INTERVAL').check
66
+ form.radiobutton_with(:name => 'exportFormat', :value => 'ESPI_AMI').check
67
67
  form['from'] = date.strftime("%m/%d/%Y")
68
68
  form['to'] = date.strftime("%m/%d/%Y")
69
69
  espi_xml_zip = form.submit
@@ -3,7 +3,8 @@ require 'net/https'
3
3
  module SmarterMeter
4
4
  module Services
5
5
  class Pachube
6
- def initialize(config)
6
+ def initialize(ui, config)
7
+ @ui = ui
7
8
  @config = config
8
9
  raise "The Pachube token must be configured" unless @config[:api_key]
9
10
  raise "The Pachube feed id must be configured" unless @config[:feed_id]
@@ -22,6 +23,7 @@ module SmarterMeter
22
23
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
23
24
  http.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
24
25
  res, body = http.post(url.path, request_body(samples), {"X-PachubeApiKey" => @config[:api_key], "Content-Type" => "text/csv"})
26
+ @ui.log.debug("Pacube Response: #{res}")
25
27
  case res
26
28
  when Net::HTTPSuccess
27
29
  true
data/smartermeter.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'smartermeter'
16
- s.version = '0.4.2'
17
- s.date = '2012-02-09'
16
+ s.version = '0.4.3'
17
+ s.date = '2012-08-18'
18
18
  s.rubyforge_project = 'smartermeter'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
53
53
  s.add_dependency('rest-client', ["= 1.6.1"])
54
54
  s.add_dependency('json_pure', ["= 1.5.1"])
55
55
  s.add_dependency('rubyzip', ["= 0.9.5"])
56
+ s.add_dependency('trollop', ["= 1.16.2"])
56
57
 
57
58
  ## List your development dependencies here. Development dependencies are
58
59
  ## those that are only needed during development
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartermeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,66 +9,107 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-09 00:00:00.000000000 Z
12
+ date: 2012-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
- requirement: &70173616966840 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - =
19
+ - - '='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70173616966840
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: crypt19
27
- requirement: &70173616966100 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - =
35
+ - - '='
31
36
  - !ruby/object:Gem::Version
32
37
  version: 1.2.1
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70173616966100
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.1
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rest-client
38
- requirement: &70173616965140 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
- - - =
51
+ - - '='
42
52
  - !ruby/object:Gem::Version
43
53
  version: 1.6.1
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70173616965140
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.6.1
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: json_pure
49
- requirement: &70173616963860 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
- - - =
67
+ - - '='
53
68
  - !ruby/object:Gem::Version
54
69
  version: 1.5.1
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70173616963860
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.1
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rubyzip
60
- requirement: &70173616962780 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
- - - =
83
+ - - '='
64
84
  - !ruby/object:Gem::Version
65
85
  version: 0.9.5
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *70173616962780
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.5
94
+ - !ruby/object:Gem::Dependency
95
+ name: trollop
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - '='
100
+ - !ruby/object:Gem::Version
101
+ version: 1.16.2
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 1.16.2
69
110
  - !ruby/object:Gem::Dependency
70
111
  name: rspec
71
- requirement: &70173616961300 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
72
113
  none: false
73
114
  requirements:
74
115
  - - ~>
@@ -76,10 +117,15 @@ dependencies:
76
117
  version: 2.8.0
77
118
  type: :development
78
119
  prerelease: false
79
- version_requirements: *70173616961300
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 2.8.0
80
126
  - !ruby/object:Gem::Dependency
81
127
  name: vcr
82
- requirement: &70173616976880 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
83
129
  none: false
84
130
  requirements:
85
131
  - - ~>
@@ -87,10 +133,15 @@ dependencies:
87
133
  version: 1.11.3
88
134
  type: :development
89
135
  prerelease: false
90
- version_requirements: *70173616976880
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 1.11.3
91
142
  - !ruby/object:Gem::Dependency
92
143
  name: webmock
93
- requirement: &70173616976160 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
94
145
  none: false
95
146
  requirements:
96
147
  - - ~>
@@ -98,10 +149,15 @@ dependencies:
98
149
  version: 1.7.10
99
150
  type: :development
100
151
  prerelease: false
101
- version_requirements: *70173616976160
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.7.10
102
158
  - !ruby/object:Gem::Dependency
103
159
  name: minitar
104
- requirement: &70173616975180 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
105
161
  none: false
106
162
  requirements:
107
163
  - - ~>
@@ -109,7 +165,12 @@ dependencies:
109
165
  version: 0.5.2
110
166
  type: :development
111
167
  prerelease: false
112
- version_requirements: *70173616975180
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 0.5.2
113
174
  description: Fetches SmartMeter data from PG&E and can upload to Pachube
114
175
  email: matt.removethis@nospam.colyer.name
115
176
  executables:
@@ -162,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
223
  version: '0'
163
224
  requirements: []
164
225
  rubyforge_project: smartermeter
165
- rubygems_version: 1.8.11
226
+ rubygems_version: 1.8.23
166
227
  signing_key:
167
228
  specification_version: 2
168
229
  summary: Fetches SmartMeter data from PG&E