Class: Porteo::Twitter_gateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/gateways/twitter_gateway.rb

Overview

Gateway to use Twitter service with Twitter gem. In Porteo this class acts as a link between any twitter protocol and Twitter gem.

This class inherits from Gateway and just overwrite the send_message method.

Instance Method Summary collapse

Methods inherited from Gateway

connection_argument, #connection_arguments, #init_send, #initialize

Constructor Details

This class inherits a constructor from Porteo::Gateway

Instance Method Details

#send_message(msg) ⇒ nil

Send the twitt using Twitter gem.

Parameters:

  • msg (Hash)

    The message sections to send

Returns:

  • (nil)


44
45
46
47
48
49
50
51
52
53
# File 'lib/gateways/twitter_gateway.rb', line 44

def send_message( msg )
  Twitter.configure do |config|
    config.consumer_key = @config[:consumer_key]
    config.consumer_secret = @config[:consumer_secret]
    config.oauth_token = @config[:oauth_token]
    config.oauth_token_secret = @config[:oauth_token_secret]
  end

 Twitter.update( msg[:body] ) 
end