Sha256: 3e70fcc29a79ea9602895620f783777af89d02eaf40d8a9054ba8a313d2efcf1

Contents?: true

Size: 668 Bytes

Versions: 4

Compression:

Stored size: 668 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class ConservativeCa < Base
          base_uri 'www.conservative.ca'
          http_method :get
          path '/wp-content/themes/conservative/functions-process.php?x=vldpc&fpc=<%= @postal_code %>'

        private

          def electoral_districts!
            images.map{|a| a[:src][/\d+\.jpg\z/]}
          end

          def valid?
            !images.empty?
          end

          def images
            @images ||= Nokogiri::HTML(response.parsed_response, nil, 'utf-8').css('img')
          end
        end

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