Class: Courier::Resources::Profiles::Lists

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/profiles/lists.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Lists

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 Lists.

Parameters:



89
90
91
# File 'lib/courier/resources/profiles/lists.rb', line 89

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(user_id, request_options: {}) ⇒ Courier::Models::Profiles::ListDeleteResponse

Some parameter documentations has been truncated, see Models::Profiles::ListDeleteParams for more details.

Removes all list subscriptions for given user.

Parameters:

  • user_id (String)

    A unique identifier representing the user associated with the requested profile.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/courier/resources/profiles/lists.rb', line 49

def delete(user_id, params = {})
  @client.request(
    method: :delete,
    path: ["profiles/%1$s/lists", user_id],
    model: Courier::Models::Profiles::ListDeleteResponse,
    options: params[:request_options]
  )
end

#retrieve(user_id, cursor: nil, request_options: {}) ⇒ Courier::Models::Profiles::ListRetrieveResponse

Some parameter documentations has been truncated, see Models::Profiles::ListRetrieveParams for more details.

Returns the subscribed lists for a specified user.

Parameters:

  • user_id (String)

    A unique identifier representing the user associated with the requested user pro

  • cursor (String, nil)

    A unique identifier that allows for fetching the next set of message statuses.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/courier/resources/profiles/lists.rb', line 23

def retrieve(user_id, params = {})
  parsed, options = Courier::Profiles::ListRetrieveParams.dump_request(params)
  query = Courier::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["profiles/%1$s/lists", user_id],
    query: query,
    model: Courier::Models::Profiles::ListRetrieveResponse,
    options: options
  )
end

#subscribe(user_id, lists:, request_options: {}) ⇒ Courier::Models::Profiles::ListSubscribeResponse

Some parameter documentations has been truncated, see Models::Profiles::ListSubscribeParams for more details.

Subscribes the given user to one or more lists. If the list does not exist, it will be created.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
# File 'lib/courier/resources/profiles/lists.rb', line 75

def subscribe(user_id, params)
  parsed, options = Courier::Profiles::ListSubscribeParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["profiles/%1$s/lists", user_id],
    body: parsed,
    model: Courier::Models::Profiles::ListSubscribeResponse,
    options: options
  )
end