Class: Fastlane::Helper::AwsSns

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/aws_sns_topic/helper/aws_sns_topic_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_key, secret_access_key, region, topic_arn) ⇒ AwsSns

Returns a new instance of AwsSns.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fastlane/plugin/aws_sns_topic/helper/aws_sns_topic_helper.rb', line 20

def initialize(access_key, secret_access_key, region, topic_arn)
  @client = Aws::SNS::Client.new(
    access_key_id: access_key,
    secret_access_key: secret_access_key,
    region: region
  )
  @topic = Aws::SNS::Topic.new(
    arn: topic_arn,
    client: @client
  )
end

Instance Method Details

#publish_message(message, subject) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/fastlane/plugin/aws_sns_topic/helper/aws_sns_topic_helper.rb', line 32

def publish_message(message, subject)
  @topic.publish({
    message: message,
    subject: subject
  })
rescue => error
  UI.crash!("Send SNS topic message error: #{error.inspect}")
end