Sha256: e8555cdd17629d8aa668650f3f35a2cb18aa9f29a060f7462985f47d090535f7

Contents?: true

Size: 633 Bytes

Versions: 4

Compression:

Stored size: 633 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class LiberalCa < Base
          follow_redirects true
          base_uri 'www.liberal.ca'
          http_method :get
          path '/riding/postal/<%= @postal_code %>/'

        private

          def electoral_districts!
            Nokogiri::HTML(response.parsed_response, nil, 'utf-8').css('img.RidingListImage').map{|img| img[:src][/\d{5}/]}
          end

          def valid?
            !response.parsed_response["Sorry we couldn't find your riding."]
          end
        end

        StrategySet.register LiberalCa
      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/liberal_ca.rb
govkit-ca-0.0.9 lib/gov_kit-ca/postal_code/strategy/liberal_ca.rb
govkit-ca-0.0.8 lib/gov_kit-ca/postal_code/strategy/liberal_ca.rb
govkit-ca-0.0.7 lib/gov_kit-ca/postal_code/strategy/liberal_ca.rb