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, **options) ⇒ 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.

options - The Hash options used to create a Attribute (default: {}):

:type  - The String data type of the custom attribute.
         Can be String, Integer, Timestamp or Boolean.
:key   - The String key of the custom attribute.
         Accepts alphanumeric characters and underscores.
:value - The value of the custom attribute.
         Should be of the data type as specified in *type*.

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



29
30
31
# File 'lib/chartmogul/v1/customers.rb', line 29

def create(customer_id, **options)
  Chartmogul::V1::Request.new "#{BASE_URI}/#{customer_id}/attributes/custom", options.merge(method: :post, userpwd: client.userpwd)
end

#update(customer_id, **options) ⇒ 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.

options - The Hash options used to refine the Customer attributes (default: {}).

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



42
43
44
# File 'lib/chartmogul/v1/customers.rb', line 42

def update(customer_id, **options)
  Chartmogul::V1::Request.new "#{BASE_URI}/#{customer_id}/attributes/custom", options.merge(method: :put, userpwd: client.userpwd)
end