Sha256: 4d33d415ca6b983a721045d57af4a61420805f68481c0e94e43c4f74f0bd9842
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
module Services module Hubspot module Associations class Create def initialize(company_id, contacts_ids) @company_id = company_id @contacts_ids = contacts_ids end def call ::Hubspot::Crm::Associations::BatchApi.new.create( 'companies', 'contacts', batch_input_public_association: association, auth_names: 'oauth2' ) end private def association ::Hubspot::Crm::Associations::BatchInputPublicAssociation.new( inputs: contacts_to_associate ) end def contacts_to_associate @contacts_ids.map do |id| ::Hubspot::Crm::Associations::PublicAssociation.new( from: ::Hubspot::Crm::Associations::PublicObjectId.new(id: @company_id), to: ::Hubspot::Crm::Associations::PublicObjectId.new(id: id), type: 'company_to_contact' ) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems