Sha256: 33f922bf5c247a13b5dc97d9e039708602794254b7f4df6a2a5b5de138c1b3c2

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        # ndp.ca does not return electoral districts for postal codes that
        # contain multiple electoral districts.
        class NDPCa < Base
          base_uri 'www.ndp.ca'

        private

          def electoral_districts!
            [ response.headers['location'][/\d+\Z/] ]
          end

          def valid?
            response.headers['location'] != 'http://www.ndp.ca/'
          end

          def response
            @response ||= self.class.head "http://www.ndp.ca/riding/#{@postal_code}"
          end
        end

        StrategySet.register NDPCa
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
govkit-ca-0.0.1 lib/gov_kit-ca/postal_code/strategy/ndp-ca.rb