Sha256: f4875965cebbfbad77edfbe40d05eb7a7638271a941a506d607bd16449a9cc6e
Contents?: true
Size: 908 Bytes
Versions: 7
Compression:
Stored size: 908 Bytes
Contents
require 'snooby' require 'usaidwat/service' module USaidWat module Client class ReachabilityError < RuntimeError; end class NoSuchUserError < StandardError; end class BaseRedditor attr_reader :username def initialize(username) @username = username end def comments @service.user(username).comments(100) rescue NoMethodError raise NoSuchUserError, username rescue TypeError raise ReachabilityError, "Reddit unreachable" end def to_s "#{username}" end end class Redditor < BaseRedditor def initialize(username) @service = Snooby::Client.new("usaidwat v#{USaidWat::VERSION}") super end end class TestRedditor < BaseRedditor def initialize(username) @service = USaidWat::Service::MockService.new super end end end end
Version data entries
7 entries across 7 versions & 1 rubygems