module Redd::Clients::Base::Wikiread

Methods that require the “wikiread” scope. @note This method is not limited to {Objects::Subreddit} because there

are also top-level wiki pages.

Public Instance Methods

get_wikipages(subreddit = nil) click to toggle source

Get a list of pages in the subreddit wiki. @param subreddit [Objects::Subreddit, String] The subreddit to

look in.

@return [Array<String>] An array of wikipage titles.

# File lib/redd/clients/base/wikiread.rb, line 12
def get_wikipages(subreddit = nil)
  path = '/wiki/pages.json'
  name = property(subreddit, :display_name)
  path.prepend("/r/#{name}") if subreddit
  get(path).body[:data]
end
wikipage(page, subreddit = nil) click to toggle source

Get a wiki page. @param page [String] The title of the wiki page. @param subreddit [Objects::Subreddit, String] The subreddit to

look in.

@return [Objects::WikiPage] A wiki page.

# File lib/redd/clients/base/wikiread.rb, line 24
def wikipage(page, subreddit = nil)
  path = "/wiki/#{page}.json"
  name = property(subreddit, :display_name)
  path.prepend("/r/#{name}") if subreddit
  request_object(:get, path)
end