Sha256: d74310e5a58f3c50286058aa9d7691f155695d251ab895057608d8e927453aed

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

module RudderAnalyticsSync
  module Operations
    class Page < Operation
      def call
        batch = build_payload.merge(
          type: 'page'
        )
        if batch.inspect.length > MAX_MESSAGE_SIZE
          raise ArgumentError, 'Max message size is 32 KB'
        end

        request.post('/v1/batch', { 'batch' => [batch] })
      end

      def build_payload
        properties = (options[:properties] && isoify_dates!(options[:properties])) || {}

        base_payload.merge(
          name: options[:name],
          event: options[:name],
          properties: properties.merge({ name: options[:name] })
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rudder_analytics_sync-2.0.1 lib/rudder_analytics_sync/operations/page.rb