Sha256: bb9feecec540a401c6d67d66c4767443709721379ba3abda5eb58b1abad92b9a

Contents?: true

Size: 561 Bytes

Versions: 6

Compression:

Stored size: 561 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class NDPCa < Base
          base_uri 'www.ndp.ca'
          http_method :get
          path '/your-riding/?search=<%= @postal_code %>'

        private

          def electoral_districts!
            Nokogiri::HTML(response.parsed_response, nil, 'utf-8').css('a.mp-riding-link,a.no-mp').map{|a| a[:href][/\d+\z/]}
          end

          def valid?
            !response.parsed_response['No ridings or MPs match this search.']
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govkit-ca-0.0.16 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.15 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.14 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.13 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.12 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.11 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb