Sha256: ad9c698a0307b53f5908806e3c45888fa18bc90cab10c63b471f1bd21c8773cd

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

module Redd
  module Client
    class Unauthenticated
      # Methods that deal with subreddit styles
      module Moderation
        # @param subreddit [Redd::Object::Subreddit, String] The subreddit to
        #   query.
        # @return [String] The url for the subreddit's css stylesheet.
        def stylesheet_url(subreddit = nil)
          name = extract_attribute(subreddit, :display_name)
          path = "/stylesheet"
          path = path.prepend("/r/#{name}") if subreddit

          get(path).headers[:location]
        end

        # @param subreddit [Redd::Object::Subreddit, String] The subreddit to
        #   query.
        # @return [String] The css stylesheet for the subreddit.
        def stylesheet(subreddit = nil)
          get stylesheet_url(subreddit)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redd-0.6.0 lib/redd/client/unauthenticated/moderation.rb
redd-0.5.0 lib/redd/client/unauthenticated/moderation.rb