Sha256: 0fc3da7a25718bbe1412453a0110fca92a95c1c0409fb11782315f1c979ef5be

Contents?: true

Size: 1.41 KB

Versions: 20

Compression:

Stored size: 1.41 KB

Contents

module GreenButtonData
  module Parser
    class SummaryMeasurement
      include SAXMachine
      include Enumerations

      element :powerOfTenMultiplier, class: Integer,
              as: :power_of_ten_multiplier
      element :timeStamp, as: :time_stamp
      element :uom, class: Integer
      element :value, class: Integer
      element :readingTypeRef, as: :reading_type_ref

      def power_of_ten_multiplier
        UNIT_MULTIPLIER[@power_of_ten_multiplier]
      end

      def uom
        UNIT_SYMBOL[@uom]
      end

      def raw_value
        @value
      end

      def value
        @value * 10.0 ** @power_of_ten_multiplier
      end

      def to_s
        "#{value} #{uom.to_s}"
      end

      # ESPI Namespacing
      element :'espi:powerOfTenMultiplier', class: Integer,
              as: :power_of_ten_multiplier
      element :'espi:timeStamp', as: :time_stamp
      element :'espi:uom', class: Integer, as: :uom
      element :'espi:value', class: Integer, as: :value
      element :'espi:readingTypeRef', as: :reading_type_ref

      # Special case for PG&E generic namespacing
      element :'ns0:powerOfTenMultiplier', class: Integer,
              as: :power_of_ten_multiplier
      element :'ns0:timeStamp', as: :time_stamp
      element :'ns0:uom', class: Integer, as: :uom
      element :'ns0:value', class: Integer, as: :value
      element :'ns0:readingTypeRef', as: :reading_type_ref
    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/summary_measurement.rb
green-button-data-2.0.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-1.0.3 lib/green-button-data/parser/summary_measurement.rb
green-button-data-1.0.1 lib/green-button-data/parser/summary_measurement.rb
green-button-data-1.0.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.5 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.4 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.3 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.2 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.1 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.7.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.6.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.5.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.4.2 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.4.1 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.3.2 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.4.0 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.4.0.alpha.pre.1 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.3.1 lib/green-button-data/parser/summary_measurement.rb
green-button-data-0.3.0 lib/green-button-data/parser/summary_measurement.rb