Module: Genability::Client::TimeOfUse

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

Overview

Many tariffs have pricing that depends on the time of day the energy is being used. We call these times the Time of Use for a tariff. The most common examples are On Peak and Off Peak. Some examples here may help:

  1. Within a single Time of Use, e.g. On Peak, the price for a tariff will always be the same.
  2. Within a single Time of Use, e.g. On Peak, you may have multiple Periods. A Period is a range of days and times that this TOU applies to.

Instance Method Summary collapse

Instance Method Details

#time_of_use_intervals(load_serving_entity_id, time_of_use_group_id, options = {}) ⇒ Array Also known as: tou_intervals, intervals, toui

Returns all the Intervals for a Time of Use Group for an optionally specified from and to date and time range. Defaults to current time if fromDateTime is not specified and to a one week look ahead window if toDateTime is not specified.

Examples:

Return the intervals for the time of use group for Georgia Power Co

Genability.time_of_use_intervals(2756, 1)

Parameters:

  • load_serving_entity_id (Integer)

    Unique Genability ID (primary key) for a Load Serving Entity.

  • time_of_use_group_id (Integer)

    Genability ID (primary key) for this Time of Use Group. This is unique within the LSE, not across LSE's so you will always need to specify the LSE ID when requested a TOU Group.

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

    A customizable set of options.

Options Hash (options):

  • :from (DateTime)

    ISO 8601 format for the starting date and time of the requested Intervals. Defaults to current day and time if not specified. (Optional)

  • :to (DateTime)

    ISO 8601 format for the ending date and time of the requested Intervals. Defaults to one week after the fromDateTime. (Optional)

Returns:

  • (Array)

    Returns all the Intervals for a Time of Use Group.

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



87
88
89
# File 'lib/genability/client/time_of_use.rb', line 87

def time_of_use_intervals(load_serving_entity_id, time_of_use_group_id, options = {})
  get("public/timeofuses/#{load_serving_entity_id}/#{time_of_use_group_id}/intervals", interval_params(options)).results
end

#time_of_uses(load_serving_entity_id, time_of_use_group_id, options = {}) ⇒ Hashie::Mash Also known as: tou

Returns a particular time of use group using its time of use group ID and the load serving entity ID.

Examples:

Return the time of use group for Georgia Power Co

Genability.time_of_uses(2756, 1)

Parameters:

  • load_serving_entity_id (Integer)

    Unique Genability ID (primary key) for a Load Serving Entity.

  • time_of_use_group_id (Integer)

    Genability ID (primary key) for this Time of Use Group. This is unique within the LSE, not across LSE's so you will always need to specify the LSE ID when requested a TOU Group.

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

    A customizable set of options.

Options Hash (options):

  • :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:

  • (Hashie::Mash)

    Return the time of uses for a load serving entity.

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



58
59
60
# File 'lib/genability/client/time_of_use.rb', line 58

def time_of_uses(load_serving_entity_id, time_of_use_group_id, options = {})
  get("public/timeofuses/#{load_serving_entity_id}/#{time_of_use_group_id}", tou_params(options)).results.first
end