Sha256: cadcc3261c4b22c07e9d440a7450ee482245a5af5d209996c33d76f4ddeb95ee

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

module GreenButtonData
  module Parser
    class Authorization
      include SAXMachine
      include Utilities

      element :authorizedPeriod, class: Interval, as: :authorized_period
      element :publishedPeriod, class: Interval, as: :published_period

      element :expires_at, class: Integer do |epoch|
        Time.at(normalize_epoch(epoch)).utc.to_datetime
      end

      element :status, class: Integer

      # TODO: Add scope parser
      element :scope

      element :resourceURI, as: :resource_uri
      element :authorizationURI, as: :authorization_uri

      # ESPI Namespacing
      element :'espi:authorizedPeriod', class: Interval, as: :authorized_period
      element :'espi:publishedPeriod', class: Interval, as: :published_period
      element :'espi:expires_at', class: Integer, as: :expires_at
      element :'espi:status', class: Integer, as: :status
      element :'espi:scope', as: :scope
      element :'espi:resourceURI', as: :resource_uri
      element :'espi:authorizationURI', as: :authorization_uri

      # Special case for PG&E which uses generic namespacing
      element :'ns0:authorizedPeriod', class: Interval, as: :authorized_period
      element :'ns0:publishedPeriod', class: Interval, as: :published_period
      element :'ns0:expires_at', class: Integer, as: :expires_at
      element :'ns0:status', class: Integer, as: :status
      element :'ns0:scope', as: :scope
      element :'ns0:resourceURI', as: :resource_uri
      element :'ns0:authorizationURI', as: :authorization_uri
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
green-button-data-2.0.1 lib/green-button-data/parser/authorization.rb
green-button-data-2.0.0 lib/green-button-data/parser/authorization.rb
green-button-data-1.0.3 lib/green-button-data/parser/authorization.rb
green-button-data-1.0.1 lib/green-button-data/parser/authorization.rb
green-button-data-1.0.0 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.5 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.4 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.3 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.2 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.1 lib/green-button-data/parser/authorization.rb
green-button-data-0.7.0 lib/green-button-data/parser/authorization.rb
green-button-data-0.6.0 lib/green-button-data/parser/authorization.rb
green-button-data-0.5.0 lib/green-button-data/parser/authorization.rb
green-button-data-0.4.2 lib/green-button-data/parser/authorization.rb
green-button-data-0.4.1 lib/green-button-data/parser/authorization.rb
green-button-data-0.3.2 lib/green-button-data/parser/authorization.rb
green-button-data-0.4.0 lib/green-button-data/parser/authorization.rb
green-button-data-0.4.0.alpha.pre.1 lib/green-button-data/parser/authorization.rb
green-button-data-0.3.1 lib/green-button-data/parser/authorization.rb
green-button-data-0.3.0 lib/green-button-data/parser/authorization.rb