Sha256: 6b2406346953593498e03e25a76fa6c6d063a118dc683b3e7e98614e38f3bcf9

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 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 "/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.2 lib/gov_kit-ca/postal_code/strategy/ndp-ca.rb