Class: ChartMogul::Enrichment::DeprecatedCustomer

Inherits:
APIResource show all
Includes:
API::Actions::Custom, API::Actions::Retrieve, API::Actions::Update
Defined in:
lib/chartmogul/enrichment/customer.rb

Overview

DEPRECATED: Please use ChartMogul/Customer instead.

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from API::Actions::Update

included, #update!

Methods included from API::Actions::Retrieve

included

Methods included from API::Actions::Custom

#custom!, #custom_without_assign!, 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, #serialize_for_write, #serialized_value_for_attr, writeable_attr, writeable_attributes

Constructor Details

This class inherits a constructor from ChartMogul::Object

Class Method Details

.all(options = {}) ⇒ Object



85
86
87
# File 'lib/chartmogul/enrichment/customer.rb', line 85

def self.all(options = {})
  Customers.all(options)
end

.search(email) ⇒ Object



89
90
91
# File 'lib/chartmogul/enrichment/customer.rb', line 89

def self.search(email)
  Customers.search(email)
end

Instance Method Details

#add_custom_attributes!(*custom_attrs) ⇒ Object



58
59
60
61
62
# 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) ⇒ Object



46
47
48
49
50
# 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_attributesObject



42
43
44
# File 'lib/chartmogul/enrichment/customer.rb', line 42

def custom_attributes
  @attributes[:custom]
end

#merge_into!(other_customer) ⇒ Object



76
77
78
79
80
81
82
83
# 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) ⇒ Object



70
71
72
73
74
# 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) ⇒ Object



52
53
54
55
56
# 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

#tagsObject



38
39
40
# File 'lib/chartmogul/enrichment/customer.rb', line 38

def tags
  @attributes[:tags]
end

#update_custom_attributes!(custom_attrs = {}) ⇒ Object



64
65
66
67
68
# 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