Sha256: e9454ebc2c06b53e141ebf5464256018433a174bdc3953759c89ce6d02631132

Contents?: true

Size: 636 Bytes

Versions: 6

Compression:

Stored size: 636 Bytes

Contents

module GovKit
  module CA
    module PostalCode
      module Strategy
        class DigitalCopyrightCa < Base
          base_uri 'www.digital-copyright.ca'
          http_method :get
          path '/edid/postal?postalcode=<%= @postal_code %>'

        private

          def electoral_districts!
            Nokogiri::HTML(response.parsed_response, nil, 'utf-8').css('.node .content a').map{|a| a[:href][/\d+\z/]}
          end

          def valid?
            !response.parsed_response.match /\b(invalid postal code|not found)\b/
          end
        end

        StrategySet.register DigitalCopyrightCa
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govkit-ca-0.0.10 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb
govkit-ca-0.0.9 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb
govkit-ca-0.0.8 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb
govkit-ca-0.0.7 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb
govkit-ca-0.0.6 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb
govkit-ca-0.0.5 lib/gov_kit-ca/postal_code/strategy/digital-copyright_ca.rb