Sha256: 9ad998d2dfe2fa8a670c40ee096fe1b844df52f46718a578ea1f3da223dec4aa

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        # greenparty.ca does not return electoral districts for postal codes
        # that contain multiple electoral districts. It has no lookup service
        # between elections.
        class GreenPartyCa < Base
          base_uri 'greenparty.ca'
          http_method :head
          path '/search/civicrm_lookup/<%= @postal_code %>'

        private

          def electoral_districts!
            [ response.headers['location'][/\d+\z/] ]
          end

          def valid?
            response.headers['location'] != 'http://greenparty.ca/find_your_riding'
          end
        end

        StrategySet.register GreenPartyCa
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
govkit-ca-0.0.4 lib/gov_kit-ca/postal_code/strategy/greenparty_ca.rb