Sha256: 7ff3fa8a7193f651d8859eadc5ef562f46c12220d5b3cd0119efa9886fdaf99a

Contents?: true

Size: 563 Bytes

Versions: 5

Compression:

Stored size: 563 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class ElectionsCa < Base
          base_uri 'elections.ca'
          http_method :post
          path '/Scripts/vis/FindED?L=e&QID=-1&PAGEID=20'
          post_data 'CommonSearchTxt=<%= @postal_code %>&CivicSearchTxt=1'

        private

          def electoral_districts!
            [response.headers['location'][/\bED=(\d{5})&/, 1]]
          end

          def valid?
            !response.headers['location']['/ShowStreets?']
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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