Class: Redd::Objects::User

Inherits:
Thing
  • Object
show all
Includes:
Thing::Messageable
Defined in:
lib/redd/objects/user.rb

Overview

The model for a reddit user

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods included from Thing::Messageable

#send_message

Methods inherited from Thing

#==, #fullname

Methods inherited from Base

alias_property, #initialize

Constructor Details

This class inherits a constructor from Redd::Objects::Base

Instance Method Details

#get_comments(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_disliked(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_gilded(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_gildings_given(**params) ⇒ Object

Get posts that the user has gilded.

See Also:



47
48
49
# File 'lib/redd/objects/user.rb', line 47

def get_gildings_given(**params)
  get_gilded(**params.merge(show: "given"))
end

#get_hidden(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_liked(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_overview(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_saved(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end

#get_submitted(**params) ⇒ Listing<Submission>

Note:

The option :t only applies to the top and controversial sorts.

Get the appropriate listing.

Options Hash (**params):

  • :after (String)

    Return results after the given fullname.

  • :before (String)

    Return results before the given fullname.

  • :count (Integer)

    The number of items already seen in the listing.

  • :limit (1..1000)

    The maximum number of things to return.

  • :sort (:hot, :new, :top, :controversial)

    The type of sort to use.

  • :t (:hour, :day, :week, :month, :year, :all)

    The time period to consider when sorting.

  • :show (:given)

    For #get_gilded, whether to show the gildings given.

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/redd/objects/user.rb', line 35

%w(
  overview submitted comments liked disliked hidden saved gilded
).each do |type|
  define_method :"get_#{type}" do |**params|
    client.request_object(
      :get, "/user/#{name}/#{type}.json", **params
    )
  end
end