Class: ChartMogul::Metrics::ActivitiesExport

Inherits:
APIResource show all
Includes:
API::Actions::Create, API::Actions::Retrieve
Defined in:
lib/chartmogul/metrics/activities_export.rb

Constant Summary

Constants inherited from APIResource

APIResource::BACKOFF_FACTOR, APIResource::INTERVAL, APIResource::INTERVAL_RANDOMNESS, APIResource::MAX_INTERVAL, APIResource::RETRY_EXCEPTIONS, APIResource::RETRY_STATUSES, APIResource::THREAD_CONNECTION_KEY

Instance Method Summary collapse

Methods included from API::Actions::Create

#create!, included

Methods included from API::Actions::Retrieve

included

Methods inherited from APIResource

connection, handle_other_error, handle_request_error, handling_errors, immutable_keys, set_immutable_keys, set_resource_name, set_resource_path, set_resource_root_key

Methods inherited from Object

#allowed_for_write?, #assign_all_attributes, #assign_writeable_attributes, attributes, define_private_writer, define_reader, define_writer, #initialize, #instance_attributes, new_from_json, readonly_attr, #serialized_value_for_attr, writeable_attr, writeable_attributes

Constructor Details

This class inherits a constructor from ChartMogul::Object

Instance Method Details

#preprocess_attributes(attribute) ⇒ Object



31
32
33
34
35
# File 'lib/chartmogul/metrics/activities_export.rb', line 31

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

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

#serialize_for_writeObject



23
24
25
26
27
28
29
# File 'lib/chartmogul/metrics/activities_export.rb', line 23

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