Class: HubSpotSDK::Resources::Marketing::MarketingEvents::SubscriberState
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Marketing::MarketingEvents::SubscriberState
- Defined in:
- lib/hubspot_sdk/resources/marketing/marketing_events/subscriber_state.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ SubscriberState
constructor
private
A new instance of SubscriberState.
-
#record_by_email(subscriber_state, external_event_id:, external_account_id:, inputs:, request_options: {}) ⇒ StringIO
Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses.
-
#record_by_id(subscriber_state, external_event_id:, external_account_id:, inputs:, request_options: {}) ⇒ StringIO
Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact IDs.
Constructor Details
#initialize(client:) ⇒ SubscriberState
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SubscriberState.
99 100 101 |
# File 'lib/hubspot_sdk/resources/marketing/marketing_events/subscriber_state.rb', line 99 def initialize(client:) @client = client end |
Instance Method Details
#record_by_email(subscriber_state, external_event_id:, external_account_id:, inputs:, request_options: {}) ⇒ StringIO
Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses. Note that the contact must already exist in HubSpot; a contact will not be created. The contactProperties field is used only when creating a new contact. These properties will not update existing contacts.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hubspot_sdk/resources/marketing/marketing_events/subscriber_state.rb', line 29 def record_by_email(subscriber_state, params) query_params = [:external_account_id] parsed, = HubSpotSDK::Marketing::MarketingEvents::SubscriberStateRecordByEmailParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) external_event_id = parsed.delete(:external_event_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "marketing/marketing-events/2026-03/events/%1$s/%2$s/email-upsert", external_event_id, subscriber_state ], query: query.transform_keys(external_account_id: "externalAccountId"), headers: {"accept" => "*/*"}, body: parsed.except(*query_params), model: StringIO, options: ) end |
#record_by_id(subscriber_state, external_event_id:, external_account_id:, inputs:, request_options: {}) ⇒ StringIO
Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact IDs. Note that the contact must already exist in HubSpot; a contact will not be created.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/hubspot_sdk/resources/marketing/marketing_events/subscriber_state.rb', line 72 def record_by_id(subscriber_state, params) query_params = [:external_account_id] parsed, = HubSpotSDK::Marketing::MarketingEvents::SubscriberStateRecordByIDParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) external_event_id = parsed.delete(:external_event_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "marketing/marketing-events/2026-03/events/%1$s/%2$s/upsert", external_event_id, subscriber_state ], query: query.transform_keys(external_account_id: "externalAccountId"), headers: {"accept" => "*/*"}, body: parsed.except(*query_params), model: StringIO, options: ) end |