Sha256: 162c93c63569e551dec4a09679376015847e5f2481ac065c3103e9fc653550a8

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        # liberal.ca is unreliable during elections.
        class LiberalCa < Base
          base_uri 'www.liberal.ca'

        private

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

          def valid?
            !response.parsed_response.match /\bOopsies!/
          end

          def response
            @response ||= self.class.get "/riding/postal/#{@postal_code}/"
          end
        end

        StrategySet.register LiberalCa
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
govkit-ca-0.0.2 lib/gov_kit-ca/postal_code/strategy/liberal-ca.rb