Class: Atatus::Spies::SNSSpy Private
- Inherits:
-
Object
- Object
- Atatus::Spies::SNSSpy
- Defined in:
- lib/atatus/spies/sns.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Ext
Constant Summary collapse
- TYPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'messaging'
- SUBTYPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'sns'
- AP_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/:accesspoint[\/:].*/
- AP_REGION_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/^(?:[^:]+:){3}([^:]+).*/
Class Method Summary collapse
- .arn_region(arn) ⇒ Object private
- .get_topic(params) ⇒ Object private
- .last_after_slash_or_colon(arn) ⇒ Object private
- .span_context(topic, region) ⇒ Object private
- .without_net_http ⇒ Object private
Instance Method Summary collapse
- #install ⇒ Object private
Class Method Details
.arn_region(arn) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 63 64 |
# File 'lib/atatus/spies/sns.rb', line 60 def self.arn_region(arn) if arn && (match = AP_REGION_REGEX.match(arn)) match[1] end end |
.get_topic(params) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 43 44 45 46 |
# File 'lib/atatus/spies/sns.rb', line 40 def self.get_topic(params) return '[PHONENUMBER]' if params[:phone_number] last_after_slash_or_colon( params[:topic_arn] || params[:target_arn] ) end |
.last_after_slash_or_colon(arn) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/atatus/spies/sns.rb', line 48 def self.last_after_slash_or_colon(arn) if index = arn.rindex(AP_REGEX) return arn[index+1..-1] end if arn.include?('/') arn.split('/')[-1] else arn.split(':')[-1] end end |
.span_context(topic, region) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
66 67 68 69 70 71 72 73 74 |
# File 'lib/atatus/spies/sns.rb', line 66 def self.span_context(topic, region) Atatus::Span::Context.new( message: { queue_name: topic }, destination: { service: { resource: "#{SUBTYPE}/#{topic}" }, cloud: { region: region } } ) end |
.without_net_http ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 |
# File 'lib/atatus/spies/sns.rb', line 30 def self.without_net_http return yield unless defined?(NetHTTPSpy) # rubocop:disable Style/ExplicitBlockArgument Atatus::Spies::NetHTTPSpy.disable_in do yield end # rubocop:enable Style/ExplicitBlockArgument end |
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
115 116 117 |
# File 'lib/atatus/spies/sns.rb', line 115 def install ::Aws::SNS::Client.prepend(Ext) end |