Sha256: bbc0cb326e5e24e03857375741a7f9e0b6e450d7daabeead36dfcd9c361be7d0

Contents?: true

Size: 1021 Bytes

Versions: 6

Compression:

Stored size: 1021 Bytes

Contents

module GreenButtonData
  module Parser
    class MainAddress
      include SAXMachine

      def town_detail_info
         [town, state, zipcode].join(',')
      end

      def town
        town_detail.name
      end

      def state
        town_detail.state_or_province
      end

      def zipcode
        town_detail.code.gsub(/\s+/, "")
      end

      def address_general
        street_detail.address_general
      end

      def to_s
        address_general + ',' + town_detail_info
      end

      element :town_detail, class: TownDetail, as: :town_detail
      element :street_detail, class: StreetDetail, as: :town_detail


      # ESPI Namespacing
      element :'espi:townDetail', class: TownDetail, as: :town_detail
      element :'espi:streetDetail', class: StreetDetail, as: :street_detail

      # Special case for PG&E generic namespacing
      element :'ns0:townDetail', class: TownDetail, as: :town_detail
      element :'ns0:streetDetail', class: StreetDetail, as: :street_detail
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
green-button-data-0.7.4 lib/green-button-data/parser/main_address.rb
green-button-data-0.7.3 lib/green-button-data/parser/main_address.rb
green-button-data-0.7.2 lib/green-button-data/parser/main_address.rb
green-button-data-0.7.1 lib/green-button-data/parser/main_address.rb
green-button-data-0.7.0 lib/green-button-data/parser/main_address.rb
green-button-data-0.6.0 lib/green-button-data/parser/main_address.rb