Class: SurgeAPI::Resources::Audiences
- Inherits:
-
Object
- Object
- SurgeAPI::Resources::Audiences
- Defined in:
- lib/surge_api/resources/audiences.rb
Instance Method Summary collapse
-
#add_contact(audience_id, id:, request_options: {}) ⇒ SurgeAPI::Models::Contact
Some parameter documentations has been truncated, see Models::AudienceAddContactParams for more details.
-
#create(account_id, name:, request_options: {}) ⇒ SurgeAPI::Models::AudienceCreateResponse
Creates a new audience.
-
#initialize(client:) ⇒ Audiences
constructor
private
A new instance of Audiences.
-
#list_contacts(audience_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Contact>
Some parameter documentations has been truncated, see Models::AudienceListContactsParams for more details.
Constructor Details
#initialize(client:) ⇒ Audiences
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 Audiences.
92 93 94 |
# File 'lib/surge_api/resources/audiences.rb', line 92 def initialize(client:) @client = client end |
Instance Method Details
#add_contact(audience_id, id:, request_options: {}) ⇒ SurgeAPI::Models::Contact
Some parameter documentations has been truncated, see Models::AudienceAddContactParams for more details.
Adds an existing contact to a manual audience.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/surge_api/resources/audiences.rb', line 46 def add_contact(audience_id, params) parsed, = SurgeAPI::AudienceAddContactParams.dump_request(params) @client.request( method: :post, path: ["audiences/%1$s/contacts", audience_id], body: parsed, model: SurgeAPI::Contact, options: ) end |
#create(account_id, name:, request_options: {}) ⇒ SurgeAPI::Models::AudienceCreateResponse
Creates a new audience.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/surge_api/resources/audiences.rb', line 19 def create(account_id, params) parsed, = SurgeAPI::AudienceCreateParams.dump_request(params) @client.request( method: :post, path: ["accounts/%1$s/audiences", account_id], body: parsed, model: SurgeAPI::Models::AudienceCreateResponse, options: ) end |
#list_contacts(audience_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Contact>
Some parameter documentations has been truncated, see Models::AudienceListContactsParams for more details.
List all contacts in an audience with cursor-based pagination. The account is inferred from the audience.
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/surge_api/resources/audiences.rb', line 76 def list_contacts(audience_id, params = {}) parsed, = SurgeAPI::AudienceListContactsParams.dump_request(params) query = SurgeAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["audiences/%1$s/contacts", audience_id], query: query, page: SurgeAPI::Internal::Cursor, model: SurgeAPI::Contact, options: ) end |