Module: Genability::Client::Calculate
- Included in:
- Genability::Client
- Defined in:
- lib/genability/client/calculate.rb
Overview
The Calculate service basically calculates the cost of electricity for a given rate/pricing plan. This can be used to calculate a bill, "what-if" different rates, levels of usage, energy efficiency measures or any other electrical activity. It gives a total cost for a period of time. (Note that if you want a price/rate for a specific point in time, then look at the Price service.)
Instance Method Summary collapse
-
#calculate(tariff_id, from_date_time, to_date_time, tariff_inputs, options = {}) ⇒ Object
Calculate the cost of electricity for a given rate/pricing plan.
-
#calculate_metadata(tariff_id, from_date_time, to_date_time, options = {}) ⇒ Array
Calling the URL as a HTTP GET will return the "inputs" required to accurately calculate the cost for a given period.
Instance Method Details
#calculate(tariff_id, from_date_time, to_date_time, tariff_inputs, options = {}) ⇒ Object
Calculate the cost of electricity for a given rate/pricing plan.
68 69 70 71 72 |
# File 'lib/genability/client/calculate.rb', line 68 def calculate(tariff_id, from, to, tariff_inputs, = {}) post( "beta/calculate/#{tariff_id}?appId=#{application_id}&appKey=#{application_key}", calculate_params(from, to, tariff_inputs, ) ).results.first end |
#calculate_metadata(tariff_id, from_date_time, to_date_time, options = {}) ⇒ Array
39 40 41 |
# File 'lib/genability/client/calculate.rb', line 39 def (tariff_id, from, to, = {}) get("beta/calculate/#{tariff_id}", (from, to, )).results end |