Class: Superfeedee::Client
- Inherits:
-
Object
- Object
- Superfeedee::Client
- Includes:
- HTTParty
- Defined in:
- lib/superfeedee.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(mode, options = {}) ⇒ Object
- #subscribe(options) ⇒ Object
- #unsubscribe(options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 |
# File 'lib/superfeedee.rb', line 8 def initialize ={} @auth = { :username => [:user], :password => [:pass] } unless [:user].nil? self.class.headers [:headers] unless [:headers].nil? self.class.base_uri [:hub] || 'https://superfeedr.com/hubbub' end |
Instance Method Details
#post(mode, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/superfeedee.rb', line 14 def post(mode, ={}) = { :query => { 'hub.verify' => [:verify_mode] || 'sync', 'hub.mode' => mode, 'hub.callback' => [:callback_url], 'hub.topic' => [:topic_url], 'hub.verify_token' => [:verify_token] || '' } } [:basic_auth] = @auth if @auth self.class.post('/', ) end |
#subscribe(options) ⇒ Object
26 27 28 |
# File 'lib/superfeedee.rb', line 26 def subscribe post('subscribe', ) end |
#unsubscribe(options) ⇒ Object
30 31 32 |
# File 'lib/superfeedee.rb', line 30 def unsubscribe post('unsubscribe', ) end |