Class: ChartMogul::Enrichment::DeprecatedCustomer

Inherits:
APIResource
  • Object
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.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from API::Actions::Update

#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, set_resource_name, set_resource_path, set_resource_root_key

Class Method Details

.all(options = {}) ⇒ Object



83
84
85
# File 'lib/chartmogul/enrichment/customer.rb', line 83

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

.search(email) ⇒ Object



87
88
89
# File 'lib/chartmogul/enrichment/customer.rb', line 87

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

Instance Method Details

#add_custom_attributes!(*custom_attrs) ⇒ Object



56
57
58
59
60
# File 'lib/chartmogul/enrichment/customer.rb', line 56

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



44
45
46
47
48
# File 'lib/chartmogul/enrichment/customer.rb', line 44

def add_tags!(*tags)
  self.tags = custom_without_assign!(:post,
                                     "/v1/customers/#{uuid}/attributes/tags",
                                     tags: tags)[:tags]
end

#custom_attributes ⇒ Object



40
41
42
# File 'lib/chartmogul/enrichment/customer.rb', line 40

def custom_attributes
  @attributes[:custom]
end

#merge_into!(other_customer) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/chartmogul/enrichment/customer.rb', line 74

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



68
69
70
71
72
# File 'lib/chartmogul/enrichment/customer.rb', line 68

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



50
51
52
53
54
# File 'lib/chartmogul/enrichment/customer.rb', line 50

def remove_tags!(*tags)
  self.tags = custom_without_assign!(:delete,
                                     "/v1/customers/#{uuid}/attributes/tags",
                                     tags: tags)[:tags]
end

#tags ⇒ Object



36
37
38
# File 'lib/chartmogul/enrichment/customer.rb', line 36

def tags
  @attributes[:tags]
end

#update_custom_attributes!(custom_attrs = {}) ⇒ Object



62
63
64
65
66
# File 'lib/chartmogul/enrichment/customer.rb', line 62

def update_custom_attributes!(custom_attrs = {})
  self.custom_attributes = custom_without_assign!(:put,
                                                  "/v1/customers/#{uuid}/attributes/custom",
                                                  custom: custom_attrs)[:custom]
end