Class: Fastlane::Actions::OutlookAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/outlook/actions/outlook_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



55
56
57
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 55

def self.authors
  ["OTVENTURES\Tarek.Mohammed"]
end

.available_optionsObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 68

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :domain,
                                 env_name: "FL_GMAIL_DOMAIN",
                                 description: "G Suite domain",
                                 optional: true,
                                 default_value: "gmail.com",
                                 verify_block: proc do |value|
                                   UI.user_error!("No domain") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :username,
                                 env_name: "FL_GMAIL_USERNAME",
                                 description: "Username for gmail",
                                 verify_block: proc do |value|
                                   UI.user_error!("No username") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :password,
                                 env_name: "FL_GMAIL_PASSWORD",
                                 description: "Password for gmail",
                                 optional: true,
                                 sensitive: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("No password") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :to,
                                 env_name: "FL_GMAIL_TO",
                                 description: "Mail to recipients",
                                 sensitive: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("No recipients") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :cc,
                                 env_name: "FL_GMAIL_CC",
                                 description: "Mail cc recipients",
                                 sensitive: true,
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :subject,
                                 env_name: "FL_GMAIL_SUBJECT",
                                 description: "The subject of the email",
                                 sensitive: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("No subject of email") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :body,
                                 env_name: "FL_GMAIL_BODY",
                                 description: "The body of the email",
                                 sensitive: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("No body of email") if value.to_s.length == 0
                                 end)
  ]
end

.descriptionObject



51
52
53
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 51

def self.description
  "send email using outlook"
end

.detailsObject



63
64
65
66
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 63

def self.details
  # Optional:
  "send email using outlook"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


123
124
125
126
127
128
129
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 123

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



59
60
61
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 59

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fastlane/plugin/outlook/actions/outlook_action.rb', line 7

def self.run(params)
  require 'mail'
  require 'sendgrid-ruby'
  from = SendGrid::Email.new(email: '[email protected]')
  to = SendGrid::Email.new(email: '[email protected]')
  subject = 'Sending with Twilio SendGrid is Fun'
  content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
  mail = SendGrid::Mail.new(from, subject, to, content)

  sg = SendGrid::API.new(api_key: params[:username])
  response = sg.client.mail._('send').post(request_body: mail.to_json)
  puts response.status_code
  puts response.body
  # Mail.defaults do
  #   if params[:password]
  #     delivery_method :smtp, {
  #       address:              'smtp.office365.com',
  #       port:                 587,
  #       user_name:            params[:username],
  #       password:             params[:password],
  #       authentication:       'login',
  #       enable_starttls_auto: true
  #     }
  #   else
  #     delivery_method :smtp, {
  #       port: 587,
  #       address: "smtp-relay.gmail.com",
  #       domain: params[:domain]
  #     }
  #  end
  #end

  # Mail.deliver do
  #   from     params[:username]
  #   to       params[:to]
  #   cc       params[:cc]
  #   subject  params[:subject]
  #   html_part do
  #     content_type 'text/html; charset=UTF-8'
  #     body params[:body]
  #   end
  # end
end