Class: Posthubify::CustomFieldsResource
- Inherits:
-
Object
- Object
- Posthubify::CustomFieldsResource
- Defined in:
- lib/posthubify/resources/messaging.rb
Overview
Custom fields (D3) — definition CRUD + per-contact value (Node sdk .customFields).
Instance Method Summary collapse
- #clear_value(contact_id, key) ⇒ Object
- #create(input) ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(http) ⇒ CustomFieldsResource
constructor
A new instance of CustomFieldsResource.
- #list ⇒ Object
- #set_value(contact_id, key, value) ⇒ Object
- #update(key, input) ⇒ Object
- #values_for(contact_id) ⇒ Object
Constructor Details
#initialize(http) ⇒ CustomFieldsResource
Returns a new instance of CustomFieldsResource.
451 452 453 |
# File 'lib/posthubify/resources/messaging.rb', line 451 def initialize(http) @http = http end |
Instance Method Details
#clear_value(contact_id, key) ⇒ Object
479 480 481 |
# File 'lib/posthubify/resources/messaging.rb', line 479 def clear_value(contact_id, key) @http.data('DELETE', "/contacts/#{contact_id}/fields/#{key}") end |
#create(input) ⇒ Object
459 460 461 |
# File 'lib/posthubify/resources/messaging.rb', line 459 def create(input) @http.data('POST', '/custom-fields', body: input) end |
#delete(key) ⇒ Object
467 468 469 |
# File 'lib/posthubify/resources/messaging.rb', line 467 def delete(key) @http.data('DELETE', "/custom-fields/#{key}") end |
#list ⇒ Object
455 456 457 |
# File 'lib/posthubify/resources/messaging.rb', line 455 def list @http.data('GET', '/custom-fields') end |
#set_value(contact_id, key, value) ⇒ Object
475 476 477 |
# File 'lib/posthubify/resources/messaging.rb', line 475 def set_value(contact_id, key, value) @http.data('PUT', "/contacts/#{contact_id}/fields/#{key}", body: { 'value' => value }) end |
#update(key, input) ⇒ Object
463 464 465 |
# File 'lib/posthubify/resources/messaging.rb', line 463 def update(key, input) @http.data('PATCH', "/custom-fields/#{key}", body: input) end |
#values_for(contact_id) ⇒ Object
471 472 473 |
# File 'lib/posthubify/resources/messaging.rb', line 471 def values_for(contact_id) @http.data('GET', "/contacts/#{contact_id}/fields") end |