Sha256: 73696705fcd62cbb19e8e9f25a5e38a70c5e1db20bc8a70a86fdef05f4f57bd2

Contents?: true

Size: 780 Bytes

Versions: 8

Compression:

Stored size: 780 Bytes

Contents

class OAuthPubSubJack
  def self.connect(switchboard, settings)
    require 'switchboard/helpers/oauth_pubsub'

    # TODO generalize this pattern for required settings
    unless settings["pubsub.server"]
      puts "A pubsub server must be specified."
      return false
    end

    switchboard.extend(Switchboard::Helpers::OAuthPubSubHelper)

    switchboard.on_startup do
      @pubsub = Jabber::PubSub::OAuthServiceHelper.new(client, settings["pubsub.server"])

      @oauth_consumer = OAuth::Consumer.new(settings["oauth.consumer_key"], settings["oauth.consumer_secret"])
      @oauth_token = OAuth::Token.new(settings["oauth.token"], settings["oauth.token_secret"])

      @pubsub.add_event_callback do |event|
        on(:pubsub_event, event)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mojodna-switchboard-0.0.10 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.11 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.12 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.13 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.7 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.8 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.0.9 lib/switchboard/jacks/oauth_pubsub.rb
mojodna-switchboard-0.1.0 lib/switchboard/jacks/oauth_pubsub.rb