Sha256: fa59677c4f16de3d5490bf1c65182520bef5489bd88b57391270d76c6fc20c25

Contents?: true

Size: 650 Bytes

Versions: 9

Compression:

Stored size: 650 Bytes

Contents

module Redd
  module Clients
    class Base
      # Methods that require the "identity" scope
      module Identity
        # @return [Objects::User] The logged-in user.
        def me
          response = get("/api/v1/me")
          object_from_body(kind: "t2", data: response.body)
        end

        # @return [Objects::Base] Your current preferences.
        # @see https://www.reddit.com/dev/api/oauth#GET_api_v1_me_prefs
        def my_prefs
          response = get("/api/v1/me/prefs")
          # Basically an uneditable mashie.
          Objects::Base.new(self, response.body)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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