Sha256: 20e2c113a29b23e3224b0895d8711cf794b4d1655e7b98ca8af4f38924626922

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class ElectionsCa < Base
          base_uri 'elections.ca'
          http_method :post
          path '/Scripts/vis/FindED'
          post_data 'CommonSearchTxt=<%= @postal_code %>'

        private

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

          def valid?
            !response.headers['location'][/EDNotFound|MultipleEDs/]
          end
        end

        StrategySet.register ElectionsCa
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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