class Redd::Clients::Userless

The client that doesn't need a user to function. @note Of course, that means many editing methods throw an error.

Attributes

client_id[R]

@!attribute [r] client_id

Public Class Methods

new(client_id, secret, **options) click to toggle source

@param [Hash] options The options to create the client with. @see Base#initialize @see Redd.it

Calls superclass method Redd::Clients::Base::new
# File lib/redd/clients/userless.rb, line 14
def initialize(client_id, secret, **options)
  @client_id = client_id
  @secret = secret
  super(**options)
end

Public Instance Methods

authorize!() click to toggle source

Authorize using the given data. @return [Access] The access given by reddit.

# File lib/redd/clients/userless.rb, line 22
def authorize!
  response = auth_connection.post(
    '/api/v1/access_token',
    grant_type: 'client_credentials'
  )

  @access = Access.new(response.body)
end