Class: Trycourier::Resources::Audiences
- Inherits:
-
Object
- Object
- Trycourier::Resources::Audiences
- Defined in:
- lib/trycourier/resources/audiences.rb
Instance Method Summary collapse
-
#delete(audience_id, request_options: {}) ⇒ nil
Deletes the specified audience.
-
#initialize(client:) ⇒ Audiences
constructor
private
A new instance of Audiences.
-
#list(cursor: nil, request_options: {}) ⇒ Trycourier::Models::AudienceListResponse
Get the audiences associated with the authorization token.
-
#list_members(audience_id, cursor: nil, request_options: {}) ⇒ Trycourier::Models::AudienceListMembersResponse
Get list of members of an audience.
-
#retrieve(audience_id, request_options: {}) ⇒ Trycourier::Models::Audience
Returns the specified audience by id.
-
#update(audience_id, description: nil, filter: nil, name: nil, request_options: {}) ⇒ Trycourier::Models::AudienceUpdateResponse
Creates or updates audience.
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.
123 124 125 |
# File 'lib/trycourier/resources/audiences.rb', line 123 def initialize(client:) @client = client end |
Instance Method Details
#delete(audience_id, request_options: {}) ⇒ nil
Deletes the specified audience.
87 88 89 90 91 92 93 94 |
# File 'lib/trycourier/resources/audiences.rb', line 87 def delete(audience_id, params = {}) @client.request( method: :delete, path: ["audiences/%1$s", audience_id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, request_options: {}) ⇒ Trycourier::Models::AudienceListResponse
Get the audiences associated with the authorization token.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/trycourier/resources/audiences.rb', line 65 def list(params = {}) parsed, = Trycourier::AudienceListParams.dump_request(params) @client.request( method: :get, path: "audiences", query: parsed, model: Trycourier::Models::AudienceListResponse, options: ) end |
#list_members(audience_id, cursor: nil, request_options: {}) ⇒ Trycourier::Models::AudienceListMembersResponse
Get list of members of an audience.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/trycourier/resources/audiences.rb', line 109 def list_members(audience_id, params = {}) parsed, = Trycourier::AudienceListMembersParams.dump_request(params) @client.request( method: :get, path: ["audiences/%1$s/members", audience_id], query: parsed, model: Trycourier::Models::AudienceListMembersResponse, options: ) end |
#retrieve(audience_id, request_options: {}) ⇒ Trycourier::Models::Audience
Returns the specified audience by id.
17 18 19 20 21 22 23 24 |
# File 'lib/trycourier/resources/audiences.rb', line 17 def retrieve(audience_id, params = {}) @client.request( method: :get, path: ["audiences/%1$s", audience_id], model: Trycourier::Audience, options: params[:request_options] ) end |
#update(audience_id, description: nil, filter: nil, name: nil, request_options: {}) ⇒ Trycourier::Models::AudienceUpdateResponse
Creates or updates audience.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/trycourier/resources/audiences.rb', line 43 def update(audience_id, params = {}) parsed, = Trycourier::AudienceUpdateParams.dump_request(params) @client.request( method: :put, path: ["audiences/%1$s", audience_id], body: parsed, model: Trycourier::Models::AudienceUpdateResponse, options: ) end |