Sha256: f0215fa5b9cd2a94119e33ce3315da32be7707deea55380f60da83424c9b3750

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'httparty'

%w{version exceptions utilities account flair links_comments listings moderation pms subreddits users}.each do |local|
  require "snoo/#{local}"
end
# Snoo reddit API wrapper
#
# @author Jeff Sandberg <paradox460@gmail.com>
module Snoo
  # Snoo reddit API wrapper
  #
  # @author (see Snoo)
  class Client
    include HTTParty
    [Account, Flair, LinksComments, Listings, Moderation, PM, Utilities, User, Subreddit].each do |inc|
      include inc
    end

    attr_reader(:modhash, :username, :userid, :cookie)


    # Creates a new instance of Snoo.
    #
    # Please change the useragent if you write your own program.
    #
    # @param url [String] url The base url of reddit.
    # @param useragent [String] The User-Agent this bot will use.
    def initialize( url = "http://www.reddit.com", useragent = "Snoo ruby reddit api wrapper v#{VERSION}" )
      @baseurl = url
      self.class.base_uri url
      @headers = {'User-Agent' => useragent }
      self.class.headers @headers
      @cookies = nil
      @modhash = nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
snoo-0.0.2 lib/snoo.rb