class Hubspot::EngagementNote

Public Class Methods

create!(contact_id, note_body, owner_id = nil, deal_id = nil) click to toggle source
Calls superclass method Hubspot::Engagement::create!
# File lib/hubspot/engagement.rb, line 131
def create!(contact_id, note_body, owner_id = nil, deal_id = nil)
  data = {
    engagement: {
      type: 'NOTE'
    },
    associations: {
      contactIds: [contact_id]
    },
    metadata: {
      body: note_body
    }
  }

  # if the owner id has been provided, append it to the engagement
  data[:engagement][:owner_id] = owner_id if owner_id
  # if the deal id has been provided, associate the note with the deal
  data[:associations][:dealIds] = [deal_id] if deal_id

  super(data)
end

Public Instance Methods

body() click to toggle source
# File lib/hubspot/engagement.rb, line 122
def body
  metadata['body']
end
contact_ids() click to toggle source
# File lib/hubspot/engagement.rb, line 126
def contact_ids
  associations['contactIds']
end