class ChartMogul::Enrichment::DeprecatedCustomer

DEPRECATED: Please use ChartMogul/Customer instead.

Public Class Methods

all(options = {}) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 85
def self.all(options = {})
  Customers.all(options)
end

Public Instance Methods

add_custom_attributes!(*custom_attrs) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 58
def add_custom_attributes!(*custom_attrs)
  self.custom_attributes = custom_without_assign!(:post,
                                                  "/v1/customers/#{uuid}/attributes/custom",
                                                  custom: custom_attrs)[:custom]
end
add_tags!(*tags) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 46
def add_tags!(*tags)
  self.tags = custom_without_assign!(:post,
                                     "/v1/customers/#{uuid}/attributes/tags",
                                     tags: tags)[:tags]
end
custom_attributes() click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 42
def custom_attributes
  @attributes[:custom]
end
merge_into!(other_customer) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 76
def merge_into!(other_customer)
  options = {
    from: { customer_uuid: uuid },
    into: { customer_uuid: other_customer.uuid }
  }
  custom!(:post, '/v1/customers/merges', options)
  true
end
remove_custom_attributes!(*custom_attrs) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 70
def remove_custom_attributes!(*custom_attrs)
  self.custom_attributes = custom_without_assign!(:delete,
                                                  "/v1/customers/#{uuid}/attributes/custom",
                                                  custom: custom_attrs)[:custom]
end
remove_tags!(*tags) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 52
def remove_tags!(*tags)
  self.tags = custom_without_assign!(:delete,
                                     "/v1/customers/#{uuid}/attributes/tags",
                                     tags: tags)[:tags]
end
tags() click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 38
def tags
  @attributes[:tags]
end
update_custom_attributes!(custom_attrs = {}) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 64
def update_custom_attributes!(custom_attrs = {})
  self.custom_attributes = custom_without_assign!(:put,
                                                  "/v1/customers/#{uuid}/attributes/custom",
                                                  custom: custom_attrs)[:custom]
end

Private Instance Methods

custom_attributes=(custom_attributes = {}) click to toggle source

When passing timestamps, either use Time instance, or iso8601-parseable string.

# File lib/chartmogul/enrichment/customer.rb, line 100
def custom_attributes=(custom_attributes = {})
  @attributes[:custom] = ChartMogul::Utils::JSONParser.typecast_custom_attributes(custom_attributes)
end
set_attributes(attributes_attributes) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 104
def set_attributes(attributes_attributes)
  @attributes = attributes_attributes
  @attributes[:custom] = ChartMogul::Utils::JSONParser.typecast_custom_attributes(attributes_attributes[:custom])
end
tags=(tags) click to toggle source
# File lib/chartmogul/enrichment/customer.rb, line 95
def tags=(tags)
  @attributes[:tags] = tags
end