Sha256: 51c4326f02f3a338525dbc36bdbc9c36291f0880d3a876fd0208b50ac1299821
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module SalesforceStreamer class SalesforceClient def initialize(client: Restforce.new) @client = client end def authenticate! @client.authenticate! end def subscribe(*args) @client.subscribe(args) do yield end end # Returns nil or an instance of Restforce::SObject def find_push_topic_by_name(name) query = QUERY.dup.gsub(/\s+/, ' ').gsub('{{NAME}}', name) @client.query(query).first end # Returns true or raises an exception if the upsert fails def upsert_push_topic(push_topic) @client.upsert!('PushTopic', :Id, 'Id' => push_topic.id, 'Name' => push_topic.name, 'ApiVersion' => push_topic.api_version, 'Description' => push_topic.description, 'NotifyForFields' => push_topic.notify_for_fields, 'Query' => push_topic.query ) end private QUERY = <<~SOQL.chomp.freeze SELECT Id, Name, ApiVersion, Description, NotifyForFields, Query, isActive FROM PushTopic WHERE Name = '{{NAME}}' SOQL end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
salesforce_streamer-0.1.1 | lib/salesforce_streamer/salesforce_client.rb |
salesforce_streamer-0.1.0 | lib/salesforce_streamer/salesforce_client.rb |