Class: Trycourier::Resources::Profiles::Lists

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/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.



88
89
90
# File 'lib/trycourier/resources/profiles/lists.rb', line 88

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Removes all list subscriptions for given user.



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

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

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

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

Returns the subscribed lists for a specified user.



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

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

#subscribe(user_id, lists: , request_options: {}) ⇒ Trycourier::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.



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

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