Module: Genability::Client::Tariff

Included in:
Genability::Client
Defined in:
lib/genability/client/tariff.rb

Overview

Tariffs are rate plans for electricity. They describe who the plan applies to (service and applicability), what the charges are, and other information about this electricity service:

  1. We have residential tariffs currently. General tariffs (commercial & industrial and speciality tariffs) are coming soon.
  2. You can specify whether you want the tariff fully populated, or whether you just want a sub section of the data (to avoid charges and to speed up your queries).

Instance Method Summary collapse

Instance Method Details

#tariff(tariff_id, options = {}) ⇒ Hashie::Mash

Returns one tariff.

Examples:

Return the residential serice tariff for Georgia Power Co

Genability.tariff(512)

Parameters:

  • tariff_id (Integer)

    Unique Genability ID (primary key) for a tariff.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :populate_rates (Boolean)

    Populates the rate details for the returned Tariff. (Optional)

  • :populate_properties (Boolean)

    Populates the properties for the returned Tariffs (Optional; defaults to false)

Returns:

  • (Hashie::Mash)

    A tariff.

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



99
100
101
# File 'lib/genability/client/tariff.rb', line 99

def tariff(tariff_id, options = {})
  get("public/tariffs/#{tariff_id}", tariff_params(options)).results.first
end

#tariffs(options = {}) ⇒ Array

Returns a list of tariffs.

Examples:

Return the first 25 tariffs

Genability.tariffs

Return the tariffs for Georgia Power Co

Genability.tariffs(:lse_id => 2756)

Return only residential tariffs

Genability.tariffs(:customer_classes => 'residential')

Return only default and alternative tariff types

Genability.tariffs(:tariff_types => ['default', 'alternative'])

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :lse_id (Integer)

    Filter tariffs for a specific Load Serving Entity. (Optional)

  • :effective_on (Date)

    Only tariffs that are effective on this date. (Optional)

  • :from (Date)

    Only include tariffs that are effective on or after this date (Optional)

  • :to (Date)

    Only include tariffs that are effective on or before this date (Optional)

  • :customer_classes (String, Array)

    Only include these customer classes. Choices are: RESIDENTIAL, GENERAL. (Optional)

  • :tariff_types (String, Array)

    Only include these tariff types. Choices are: DEFAULT, ALTERNATIVE, OPTIONAL_EXTRA, RIDER. (Optional)

  • :zip_code (String)

    Return tariffs for this zip or post code. (Optional)

  • :populate_rates (Boolean)

    Populates the rate details for the returned Tariff. (Optional)

  • :populate_properties (Boolean)

    Populates the properties for the returned Tariffs (Optional; defaults to false)

  • :page (Integer)

    The page number to begin the result set from. If not specified, this will begin with the first result set. (Optional)

  • :per_page (Integer)

    The number of results to return. If not specified, this will return 25 results. (Optional)

  • :search (String)

    The string of text to search on. This can also be a regular expression, in which case you should set the 'isRegex' flag to true. (Optional)

  • :search_on (String)

    Comma separated list of fields to query on. When searchOn is specified, the text provided in the search string field will be searched within these fields. The list of fields to search on depend on the entity being searched for. Read the documentation for the entity for more details on the fields that can be searched, and the default fields to be searched if searchOn is not specified. (Optional)

  • :starts_with (Boolean)

    When true, the search will only return results that begin with the specified search string. Otherwise, any match of the search string will be returned as a result. Default is false. (Optional)

  • :ends_with (Boolean)

    When true, the search will only return results that end with the specified search string. Otherwise, any match of the search string will be returned as a result. Default is false. (Optional)

  • :is_regex (Boolean)

    When true, the provided search string will be regarded as a regular expression and the search will return results matching the regular expression. Default is false. (Optional)

  • :sort_on (String)

    Comma separated list of fields to sort on. This can also be input via Array Inputs (see above). (Optional)

  • :sort_order (String)

    Comma separated list of ordering. Possible values are 'ASC' and 'DESC'. Default is 'ASC'. If your sortOn contains multiple fields and you would like to order fields individually, you can pass in a comma separated list here (or use Array Inputs, see above). For example, if your sortOn contained 5 fields, and your sortOrder contained 'ASC, DESC, DESC', these would be applied to the first three items in the sortOn field. The remaining two would default to ASC. (Optional)

Returns:

  • (Array)

    List of tariffs.

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



80
81
82
# File 'lib/genability/client/tariff.rb', line 80

def tariffs(options = {})
  get("public/tariffs", tariffs_params(options)).results
end