Sha256: 121690beaeba6209dae1e2619b3d7c660e793e1848124a636d10a2e644db4d01
Contents?: true
Size: 983 Bytes
Versions: 12
Compression:
Stored size: 983 Bytes
Contents
module Services module Hubspot module Contacts class CreateBatch def initialize(emails, access_token) @emails = emails @access_token = access_token end def call contacts_object = ::Hubspot::Crm::Contacts::BatchInputSimplePublicObjectInput.new( inputs: contacts ) batch_api.create(contacts_object, auth_names: 'oauth2') end private def contacts @emails.map do |email| ::Hubspot::Crm::Contacts::SimplePublicObjectInput.new( properties: { email: email } ) end end def batch_api config = ::Hubspot::Crm::Contacts::Configuration.new do |config| config.access_token = @access_token end api_client = ::Hubspot::Crm::Contacts::ApiClient.new(config) ::Hubspot::Crm::Contacts::BatchApi.new(api_client) end end end end end
Version data entries
12 entries across 6 versions & 1 rubygems