Class: Fastlane::Actions::TwitterAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/twitter.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, output, return_value, sh, step_text

Class Method Details

.authorsObject



64
65
66
# File 'lib/fastlane/actions/twitter.rb', line 64

def self.authors
  ["hjanuschka"]
end

.available_optionsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fastlane/actions/twitter.rb', line 28

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :consumer_key,
                                 env_name: "FL_TW_CONSUMER_KEY",
                                 description: "Consumer Key",
                                 is_string: true,
                                 optional: false
                                ),
    FastlaneCore::ConfigItem.new(key: :consumer_secret,
                                 env_name: "FL_TW_CONSUMER_SECRET",
                                 description: "Consumer Secret",
                                 is_string: true,
                                 optional: false
                                ),
    FastlaneCore::ConfigItem.new(key: :access_token,
                                 env_name: "FL_TW_ACCESS_TOKEN",
                                 description: "Access Token",
                                 is_string: true,
                                 optional: false
                                ),
    FastlaneCore::ConfigItem.new(key: :access_token_secret,
                                 env_name: "FL_TW_ACCESS_TOKEN_SECRET",
                                 description: "Access Token Secret",
                                 is_string: true,
                                 optional: false
                                ),
    FastlaneCore::ConfigItem.new(key: :message,
                                 env_name: "FL_TW_MESSAGE",
                                 description: "The tweet",
                                 is_string: true,
                                 optional: false
                                )

  ]
end

.descriptionObject



21
22
23
# File 'lib/fastlane/actions/twitter.rb', line 21

def self.description
  "Post on twitter"
end

.detailsObject



25
26
# File 'lib/fastlane/actions/twitter.rb', line 25

def self.details
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/fastlane/actions/twitter.rb', line 68

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/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