Class: SalesforceStreamer::PushTopic
- Inherits:
-
Object
- Object
- SalesforceStreamer::PushTopic
- Extended by:
- Dry::Initializer
- Defined in:
- lib/salesforce_streamer/push_topic.rb
Overview
Models the PushTopic object for both Restforce and Streamer
Constant Summary collapse
- DEFAULT_API_VERSION =
ENV.fetch('SALESFORCE_API_VERSION', '58.0')
Instance Attribute Summary collapse
-
#id ⇒ Object
writeonly
Sets the attribute id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#id=(value) ⇒ Object (writeonly)
Sets the attribute id
17 18 19 |
# File 'lib/salesforce_streamer/push_topic.rb', line 17 def id=(value) @id = value end |
Class Method Details
.prepare_handler_proc(constant) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/salesforce_streamer/push_topic.rb', line 56 def prepare_handler_proc(constant) if constant.respond_to? :call constant elsif constant.respond_to? :perform_async proc { || constant.perform_async() } else fail(UnprocessableHandlerError, constant) end end |
.strip_spaces(str) ⇒ Object
50 51 52 53 54 |
# File 'lib/salesforce_streamer/push_topic.rb', line 50 def strip_spaces(str) fail(NilQueryError, @name) unless str str.gsub(/\s+/, ' ') end |
Instance Method Details
#attributes ⇒ Object
29 30 31 |
# File 'lib/salesforce_streamer/push_topic.rb', line 29 def attributes self.class.dry_initializer.public_attributes self end |
#handle(message) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/salesforce_streamer/push_topic.rb', line 19 def handle() ['topic'] = @name ['hostname'] = ENV['HOSTNAME'] ['k8s_pod_name'] = ENV['K8S_POD_NAME'] .call() rescue StandardError => e Log.error e Configuration.instance.exception_adapter.call e end |