<commit_before>module GovKit
  module CA
    module PostalCode
      module Strategy
        # @see https://github.com/danielharan/postal_code_to_edid_webservice
        class ElectionsCa < Base
          base_uri 'elections.ca'
          http_method :head
          path '/scripts/pss/FindED.aspx?PC=<%= @postal_code %>'

        private

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

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

        StrategySet.register ElectionsCa
      end
    end
  end
end
<commit_msg>fix elections.ca<commit_after>module GovKit
  module CA
    module PostalCode
      module Strategy
        # @see https://github.com/danielharan/postal_code_to_edid_webservice
        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

{'fraction_non_alphanumeric': 0.09527439024390244, 'fraction_numerical': 0.003048780487804878, 'mean_word_length': 1.8668122270742358, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4037735', 'n_tokens_mistral': 411, 'n_tokens_neox': 381, 'n_words': 77}