Module: Redd::Clients::Base::None

Included in:
Redd::Clients::Base
Defined in:
lib/redd/clients/base/none.rb

Overview

Methods that don’t require any scope.

Instance Method Summary collapse

Instance Method Details

#captcha_url(iden) ⇒ Object

Returns The url for the captcha image.

Parameters:

  • iden (String)

    The captcha identifier.

Returns:

  • The url for the captcha image.



21
22
23
# File 'lib/redd/clients/base/none.rb', line 21

def captcha_url(iden)
  "http://www.reddit.com/captcha/#{iden}.png"
end

#needs_captcha?Boolean

Returns Whether a captcha is required for some API methods.

Returns:

  • (Boolean)

    Whether a captcha is required for some API methods.



7
8
9
# File 'lib/redd/clients/base/none.rb', line 7

def needs_captcha?
  get('/api/needs_captcha.json').body
end

#new_captchaString

TODO:

Maybe create some kind of set_captcha!(…) method for the client to send automatically with the next response.

Create a new captcha identifier.

Returns:

  • (String)

    The identifier.



15
16
17
# File 'lib/redd/clients/base/none.rb', line 15

def new_captcha
  post('/api/new_captcha').body[:json][:data][:iden]
end