Sha256: 089f0d36892d3dffbe868f64ebcd89efe9d8aeae23f3d7c2a4dbc5361de37e7a

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 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.
        class GreenPartyCa < Base
          base_uri 'greenparty.ca'

        private

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

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

          def response
            @response ||= self.class.head "/search/civicrm_lookup/#{@postal_code}"
          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.2 lib/gov_kit-ca/postal_code/strategy/greenparty-ca.rb