Class: Chartmogul::V1::Customers::Attributes

Inherits:
Chartmogul::V1::Customers show all
Defined in:
lib/chartmogul/v1/customers.rb

Constant Summary

Constants inherited from Chartmogul::V1::Customers

BASE_URI

Constants inherited from Base

Base::BASE_URI

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Chartmogul::V1::Customers

#attributes

Instance Method Details

#create(customer_id, attributes = []) ⇒ Object

Public: Create Custom Attributes for a Customer

See: dev.chartmogul.com/docs/create-custom-attributes-for-customer

customer_id - The String/Integer ChartMogul ID of the customer.

Specified as part of the URL.

attributes - The Array options used to create a Attributes (default: []).

Examples

client.customers.attributes.create 'foo', [
  { type: 'String',  key: 'bar', value: 'baz' },
  { type: 'Integer', key: 'qux', value: 1 }
]

Returns the instance of Chartmogul::V1::Request.



30
31
32
33
34
35
36
# File 'lib/chartmogul/v1/customers.rb', line 30

def create(customer_id, attributes = [])
  Chartmogul::V1::Request.new("#{BASE_URI}/#{customer_id}/attributes/custom",
    body:    { custom: attributes },
    method:  :post,
    userpwd: client.userpwd,
  )
end

#update(customer_id, attributes = []) ⇒ Object

Public: Update Custom Attributes of a Customer.

See: dev.chartmogul.com/docs/update-custom-attributes-of-customer

customer_id - The String/Integer ChartMogul ID of the customer.

Specified as part of the URL.

attributes - The Array options used to refine the Customer attributes (default: []).

Examples

client.customers.attributes.update 'foo', [
  { type: 'String',  key: 'bar', value: 'baz' },
  { type: 'Integer', key: 'qux', value: 1 }
]

Returns the instance of Chartmogul::V1::Request.



54
55
56
57
58
59
60
# File 'lib/chartmogul/v1/customers.rb', line 54

def update(customer_id, attributes = [])
  Chartmogul::V1::Request.new("#{BASE_URI}/#{customer_id}/attributes/custom",
    body:    { custom: attributes },
    method:  :put,
    userpwd: client.userpwd,
  )
end