Sha256: 1c6fb7a01c1e91e6c9a344e8d99b9d96969f8ef23b7957253b7b140a15418bd4

Contents?: true

Size: 938 Bytes

Versions: 13

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

module ChartMogul
  module Metrics
    class ActivitiesExport < APIResource
      set_resource_name 'ActivitiesExport'
      set_resource_path '/v1/activities_export'

      readonly_attr :id
      readonly_attr :status
      readonly_attr :file_url
      readonly_attr :params
      readonly_attr :expires_at
      readonly_attr :created_at

      writeable_attr :start_date
      writeable_attr :end_date
      writeable_attr :type

      include API::Actions::Retrieve
      include API::Actions::Create

      def serialize_for_write
        super.tap do |attributes|
          attributes.clone.each do |k, v|
            attributes[preprocess_attributes(k)] = attributes.delete(k)
          end
        end
      end

      def preprocess_attributes(attribute)
        return attribute unless %i[start_date end_date].include?(attribute)

        attribute.to_s.tr('_', '-')
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
chartmogul-ruby-4.4.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-4.3.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-4.2.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-4.1.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-4.0.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.3.1 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.3.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.2.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.1.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.0.2 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-3.0.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-2.9.0 lib/chartmogul/metrics/activities_export.rb
chartmogul-ruby-2.1.0 lib/chartmogul/metrics/activities_export.rb