Class: AwsSnsKit::AwsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_sns_kit/aws_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance, notification) ⇒ AwsClient

Returns a new instance of AwsClient.



5
6
7
8
9
# File 'lib/aws_sns_kit/aws_client.rb', line 5

def initialize(instance, notification)
  @client_wrapper = AWS::SNS.new.client
  @instance = instance
  @notification = notification
end

Instance Attribute Details

#client_wrapperObject (readonly)

Returns the value of attribute client_wrapper.



3
4
5
# File 'lib/aws_sns_kit/aws_client.rb', line 3

def client_wrapper
  @client_wrapper
end

#instanceObject (readonly)

Returns the value of attribute instance.



3
4
5
# File 'lib/aws_sns_kit/aws_client.rb', line 3

def instance
  @instance
end

#notificationObject (readonly)

Returns the value of attribute notification.



3
4
5
# File 'lib/aws_sns_kit/aws_client.rb', line 3

def notification
  @notification
end

Instance Method Details

#publishObject



11
12
13
14
15
# File 'lib/aws_sns_kit/aws_client.rb', line 11

def publish
  client_wrapper.publish(target_arn: platform_endpoint, message: notification.message, message_structure: "json")
rescue AWS::SNS::Errors::EndpointDisabled
  retry if enable
end