class Pantograph::Actions::TwitterAction
Public Class Methods
available_options()
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 29 def self.available_options [ PantographCore::ConfigItem.new(key: :consumer_key, env_name: 'TW_CONSUMER_KEY', description: 'Consumer Key', sensitive: true, type: String, optional: false), PantographCore::ConfigItem.new(key: :consumer_secret, env_name: 'TW_CONSUMER_SECRET', sensitive: true, description: 'Consumer Secret', type: String, optional: false), PantographCore::ConfigItem.new(key: :access_token, env_name: 'TW_ACCESS_TOKEN', sensitive: true, description: 'Access Token', type: String, optional: false), PantographCore::ConfigItem.new(key: :access_token_secret, env_name: 'TW_ACCESS_TOKEN_SECRET', sensitive: true, description: 'Access Token Secret', type: String, optional: false), PantographCore::ConfigItem.new(key: :message, env_name: 'TW_MESSAGE', description: 'The tweet', type: String, optional: false) ] end
category()
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 84 def self.category :notifications end
description()
click to toggle source
@!group Documentation
# File pantograph/lib/pantograph/actions/twitter.rb, line 21 def self.description 'Post a tweet on [Twitter.com](https://twitter.com)' end
details()
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 25 def self.details 'Post a tweet on Twitter. Requires you to setup an app on [twitter.com](https://twitter.com) and obtain `consumer` and `access_token`.' end
example_code()
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 72 def self.example_code [ 'twitter( access_token: "XXXX", access_token_secret: "xxx", consumer_key: "xxx", consumer_secret: "xxx", message: "You rock!" )' ] end
is_supported?(platform)
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 68 def self.is_supported?(platform) true end
run(params)
click to toggle source
# File pantograph/lib/pantograph/actions/twitter.rb, line 4 def self.run(params) Actions.verify_gem!("twitter") require 'twitter' client = Twitter::REST::Client.new do |config| config.consumer_key = params[:consumer_key] config.consumer_secret = params[:consumer_secret] config.access_token = params[:access_token] config.access_token_secret = params[:access_token_secret] end client.update(params[:message]) UI.message(['[TWITTER]', 'Successfully tweeted ', params[:message]].join(': ')) end