Sha256: 2578e200171a08b9f915d94ebcd03c662dd7d8400c5ccc9eec2202e88fbf2546

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 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&PAGEID=20'
          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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
govkit-ca-0.0.11 lib/gov_kit-ca/postal_code/strategy/elections_ca.rb