Sha256: 3cfbd84aa79acc02471b4b1d4f18e738cee6866b7dfaec375e1db6f4af1aff5b

Contents?: true

Size: 597 Bytes

Versions: 6

Compression:

Stored size: 597 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

        StrategySet.register NDPCa
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govkit-ca-0.0.10 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.9 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.8 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.7 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.6 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb
govkit-ca-0.0.5 lib/gov_kit-ca/postal_code/strategy/ndp_ca.rb