Sha256: b0881f3755b9b3ba39509d0ace41b35f386f91ea385550cc0e40c2e9d52f2228

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

require 'httparty'
require 'nokogiri'

%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, :cookies)


    # 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

7 entries across 7 versions & 1 rubygems

Version Path
snoo-0.1.0.pre.3 lib/snoo.rb
snoo-0.1.0.pre.2 lib/snoo.rb
snoo-0.1.0.pre.1 lib/snoo.rb
snoo-0.0.7 lib/snoo.rb
snoo-0.0.6 lib/snoo.rb
snoo-0.0.5 lib/snoo.rb
snoo-0.0.4 lib/snoo.rb