Module: Resend::ContactProperties
- Defined in:
- lib/resend/contact_properties.rb
Overview
Module for managing contact properties
Contact properties allow you to store custom data about your contacts
Class Method Summary collapse
-
.create(params) ⇒ Hash
Create a custom property for your contacts.
-
.get(contact_property_id = "") ⇒ Hash
Retrieve a contact property by its ID.
-
.list(params = {}) ⇒ Hash
Retrieve a list of contact properties.
-
.remove(contact_property_id = "") ⇒ Hash
Remove an existing contact property.
-
.update(params) ⇒ Hash
Update an existing contact property.
Class Method Details
.create(params) ⇒ Hash
Create a custom property for your contacts
31 32 33 34 |
# File 'lib/resend/contact_properties.rb', line 31 def create(params) path = "contact-properties" Resend::Request.new(path, params, "post").perform end |
.get(contact_property_id = "") ⇒ Hash
Retrieve a contact property by its ID
44 45 46 47 |
# File 'lib/resend/contact_properties.rb', line 44 def get(contact_property_id = "") path = "contact-properties/#{contact_property_id}" Resend::Request.new(path, {}, "get").perform end |
.list(params = {}) ⇒ Hash
Retrieve a list of contact properties
63 64 65 66 |
# File 'lib/resend/contact_properties.rb', line 63 def list(params = {}) path = Resend::PaginationHelper.build_paginated_path("contact-properties", params) Resend::Request.new(path, {}, "get").perform end |
.remove(contact_property_id = "") ⇒ Hash
Remove an existing contact property
100 101 102 103 |
# File 'lib/resend/contact_properties.rb', line 100 def remove(contact_property_id = "") path = "contact-properties/#{contact_property_id}" Resend::Request.new(path, {}, "delete").perform end |
.update(params) ⇒ Hash
Update an existing contact property
Note: The ‘key’ and ‘type’ fields cannot be changed after creation
84 85 86 87 88 89 90 |
# File 'lib/resend/contact_properties.rb', line 84 def update(params) raise ArgumentError, "Missing `id` field" if params[:id].nil? contact_property_id = params[:id] path = "contact-properties/#{contact_property_id}" Resend::Request.new(path, params, "patch").perform end |