Sha256: 5c275630556bb590e67969276ed6c0ee86f711317383efc6eca02853682b21f0

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 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'
          http_method :head
          path '/riding/<%= @postal_code %>'

        private

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

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

        StrategySet.register NDPCa
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govkit-ca-0.0.4 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.3 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb