Class: ForestLiana::IntercomConversationGetter
- Inherits:
-
IntegrationBaseGetter
- Object
- IntegrationBaseGetter
- ForestLiana::IntercomConversationGetter
- Defined in:
- app/services/forest_liana/intercom_conversation_getter.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(params) ⇒ IntercomConversationGetter
constructor
A new instance of IntercomConversationGetter.
- #perform ⇒ Object
Constructor Details
#initialize(params) ⇒ IntercomConversationGetter
Returns a new instance of IntercomConversationGetter.
5 6 7 8 9 |
# File 'app/services/forest_liana/intercom_conversation_getter.rb', line 5 def initialize(params) @params = params @access_token = ForestLiana.integrations[:intercom][:access_token] @intercom = ::Intercom::Client.new(token: @access_token) end |
Instance Attribute Details
#record ⇒ Object
Returns the value of attribute record.
3 4 5 |
# File 'app/services/forest_liana/intercom_conversation_getter.rb', line 3 def record @record end |
Instance Method Details
#perform ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/forest_liana/intercom_conversation_getter.rb', line 11 def perform begin @record = @intercom.conversations.find(id: @params[:conversation_id]) rescue Intercom::ResourceNotFound @record = nil rescue Intercom::UnexpectedError => exception FOREST_REPORTER.report exception FOREST_LOGGER.error "Cannot retrieve the Intercom conversation: #{exception.}" @record = nil end end |