Class: Hubspot::EngagementCall

Inherits:
Engagement show all
Defined in:
lib/hubspot/engagement.rb

Constant Summary

Constants inherited from Engagement

Hubspot::Engagement::ASSOCIATE_ENGAGEMENT_PATH, Hubspot::Engagement::CREATE_ENGAGMEMENT_PATH, Hubspot::Engagement::ENGAGEMENT_PATH, Hubspot::Engagement::GET_ASSOCIATED_ENGAGEMENTS

Instance Attribute Summary

Attributes inherited from Engagement

#associations, #attachments, #engagement, #id, #metadata

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Engagement

#[], associate!, #destroy!, #destroyed?, find, find_by_association, find_by_company, find_by_contact, #initialize, #update!

Constructor Details

This class inherits a constructor from Hubspot::Engagement

Class Method Details

.create!(contact_vid, body, duration, owner_id = nil, deal_id = nil, status = 'COMPLETED', time = nil) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/hubspot/engagement.rb', line 172

def create!(contact_vid, body, duration, owner_id = nil, deal_id = nil, status = 'COMPLETED', time = nil)
  data = {
    engagement: {
      type: 'CALL'
    },
    associations: {
      contactIds: [contact_vid],
      dealIds: [deal_id],
      ownerIds: [owner_id]
    },
    metadata: {
      body: body,
      status: status,
      durationMilliseconds: duration
    }
  }

  data[:engagement][:timestamp] = (time.to_i) * 1000 if time
  data[:engagement][:owner_id] = owner_id if owner_id

  super(data)
end

Instance Method Details

#bodyObject



155
156
157
# File 'lib/hubspot/engagement.rb', line 155

def body
  ['body']
end

#company_idsObject



163
164
165
# File 'lib/hubspot/engagement.rb', line 163

def company_ids
  associations['companyIds']
end

#contact_idsObject



159
160
161
# File 'lib/hubspot/engagement.rb', line 159

def contact_ids
  associations['contactIds']
end

#deal_idsObject



167
168
169
# File 'lib/hubspot/engagement.rb', line 167

def deal_ids
  associations['dealIds']
end