Sha256: aaf8178adde472c736d3e3bd8760288d12ec4a3b1d8aa9e5e128045e0233dc2b

Contents?: true

Size: 853 Bytes

Versions: 8

Compression:

Stored size: 853 Bytes

Contents

module Redd
  module Clients
    class Base
      # Methods that don't require any scope.
      module None
        # @return [Boolean] Whether a captcha is required for some API methods.
        def needs_captcha?
          get("/api/needs_captcha.json").body
        end

        # Create a new captcha identifier.
        # @return [String] The identifier.
        # @todo Maybe create some kind of set_captcha!(...) method for the
        #   client to send automatically with the next response.
        def new_captcha
          post("/api/new_captcha").body[:json][:data][:iden]
        end

        # @param iden [String] The captcha identifier.
        # @return The url for the captcha image.
        def captcha_url(iden)
          "http://www.reddit.com/captcha/#{iden}.png"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
redd-0.7.8 lib/redd/clients/base/none.rb
redd-0.7.7 lib/redd/clients/base/none.rb
redd-0.7.6 lib/redd/clients/base/none.rb
redd-0.7.5 lib/redd/clients/base/none.rb
redd-0.7.4 lib/redd/clients/base/none.rb
redd-0.7.3 lib/redd/clients/base/none.rb
redd-0.7.2 lib/redd/clients/base/none.rb
redd-0.7.1 lib/redd/clients/base/none.rb