class Superfeedee::Client

Public Class Methods

new(options={}) click to toggle source
# File lib/superfeedee.rb, line 8
def initialize options={}
  @auth = { :username => options[:user], :password => options[:pass] } unless options[:user].nil?
  self.class.headers options[:headers] unless options[:headers].nil?
  self.class.base_uri options[:hub] || 'https://superfeedr.com/hubbub'
end

Public Instance Methods

post(mode, options={}) click to toggle source
# File lib/superfeedee.rb, line 14
def post(mode, options={})
  request_options = { :query => { 'hub.verify' => options[:verify_mode] || 'sync', 
                                  'hub.mode' => mode, 
                                  'hub.callback' => options[:callback_url], 
                                  'hub.topic' => options[:topic_url], 
                                  'hub.verify_token' => options[:verify_token] || '' } }
  
  request_options[:basic_auth] = @auth if @auth
  
  self.class.post('/', request_options)
end
subscribe(options) click to toggle source
# File lib/superfeedee.rb, line 26
def subscribe options
  post('subscribe', options)
end
unsubscribe(options) click to toggle source
# File lib/superfeedee.rb, line 30
def unsubscribe options
  post('unsubscribe', options)
end