ruby_pvwatts 0.0.4 → 0.1.0

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: 5025823033db0fc76671192bd83c345e82e97bb8
4
- data.tar.gz: 2b9db1bb8921b25ca4f555625cbc3aceaa93ef4e
3
+ metadata.gz: 9356566afb36fd17a971eb4903b8fdfd508ed544
4
+ data.tar.gz: a5f4743b17aeaa78ad1b950160ba794053cd4ee8
5
5
  SHA512:
6
- metadata.gz: 99ab82a616ab970768edc5beebe1e10a7347b49b9e2867b038b59767e85be4dfebed55a503d00cea0ea0fd8616618b3f38d51b49378a0106648537aa4824df81
7
- data.tar.gz: b2929e579a0a5bf18d56aaddb51a1912b43ba259fb00f88296a9162d4d296f48e0949e7a224b36ac6c704c7d35973f28a7692a2cdcd6e9556ddfba75654572bc
6
+ metadata.gz: efeaa1e85c7c7c53a4463e814ca8820387c1fd4221c6e82e4a5a542595f79f4152821d1ad40938adb9b7c61902088fc2162a4a8a79b49957fc8f2b997174b869
7
+ data.tar.gz: 99e1299c6cfa31dd8abdcfb4344ae1145d3b46bf07da91e1056955ec554afb33fec1e92b381fb01cd87f05f39d7f03fb1de74878e63324be789298fb602c1230
data/README.md CHANGED
@@ -6,6 +6,23 @@ You need to pass in an API Key, which is obtained from the NREL.
6
6
  Additionally, you'll need to include a hash of at least the required parameters.
7
7
  See http://developer.nrel.gov/docs/solar/pvwatts-v5/ for more information.
8
8
 
9
- This is a work in progress and will have multiple updates coming soon.
9
+ Usage:
10
+
11
+ require 'ruby_pvwatts'
12
+
13
+ result = RubyPvWatts.new(
14
+ api_key: 'YOUR_API_KEY',
15
+ system_capacity: 5,
16
+ module_type: 1,
17
+ losses: 14,
18
+ array_type: 1,
19
+ tilt: 22,
20
+ azimuth: 143,
21
+ address: '123 Fake Street Anytown CO, 12345',
22
+ dataset: 'tmy3',
23
+ radius: 0
24
+ )
25
+
26
+ result.solrad_annual # => 5.63514852538037
10
27
 
11
28
  [Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)
data/lib/ruby_pvwatts.rb CHANGED
@@ -64,6 +64,54 @@ class RubyPvWatts
64
64
  @response = self.class.get('/api/pvwatts/v5.json', options)
65
65
  end
66
66
 
67
+ def version
68
+ @response['version']
69
+ end
70
+
71
+ def errors
72
+ @response['errors']
73
+ end
74
+
75
+ def warnings
76
+ @response['warnings']
77
+ end
78
+
79
+ def city
80
+ @response['station_info']['city']
81
+ end
82
+
83
+ def lat
84
+ @response['station_info']['lat']
85
+ end
86
+
87
+ def long
88
+ @response['station_info']['lon']
89
+ end
90
+
91
+ def elev
92
+ @response['station_info']['elev']
93
+ end
94
+
95
+ def timezone
96
+ @response['station_info']['tz']
97
+ end
98
+
99
+ def location
100
+ @response['station_info']['location']
101
+ end
102
+
103
+ def state
104
+ @response['station_info']['state']
105
+ end
106
+
107
+ def solar_resource_file
108
+ @response['station_info']['solar_resource_file']
109
+ end
110
+
111
+ def meters_from_station
112
+ @response['station_info']['distance']
113
+ end
114
+
67
115
  def poa_monthly
68
116
  @response['outputs']['poa_monthly']
69
117
  end
@@ -131,6 +179,7 @@ class RubyPvWatts
131
179
  alias_method :hourly_ambient_temperature, :tamb
132
180
  alias_method :hourly_module_temperature, :tcell
133
181
  alias_method :hourly_windspeed, :wspd
182
+ alias_method :distance, :meters_from_station
134
183
 
135
184
  private
136
185
 
@@ -1,3 +1,3 @@
1
1
  class RubyPvWatts
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -107,6 +107,20 @@ describe RubyPvWatts do
107
107
 
108
108
  subject { @ruby_pvwatts }
109
109
 
110
+ it { should respond_to :version }
111
+ it { should respond_to :errors }
112
+ it { should respond_to :warnings }
113
+ it { should respond_to :city }
114
+ it { should respond_to :state }
115
+ it { should respond_to :lat }
116
+ it { should respond_to :long }
117
+ it { should respond_to :elev }
118
+ it { should respond_to :location }
119
+ it { should respond_to :timezone }
120
+ it { should respond_to :solar_resource_file }
121
+ it { should respond_to :distance }
122
+ it { should respond_to :meters_from_station }
123
+
110
124
  it { should respond_to :poa_monthly }
111
125
  it { should respond_to :solrad_monthly }
112
126
  it { should respond_to :solrad_annual }
@@ -144,6 +158,14 @@ describe RubyPvWatts do
144
158
  it 'should not report hourly values' do
145
159
  expect(@ruby_pvwatts.wspd).to be_nil
146
160
  end
161
+
162
+ it 'should report the correct version' do
163
+ expect(@ruby_pvwatts.version).to eq('1.0.2')
164
+ end
165
+
166
+ it 'should have the right city' do
167
+ expect(@ruby_pvwatts.city).to eq('HONOLULU')
168
+ end
147
169
  end
148
170
 
149
171
  describe 'Invalid input' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_pvwatts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shad Self