Class: Trycourier::Resources::Profiles
- Inherits:
-
Object
- Object
- Trycourier::Resources::Profiles
- Defined in:
- lib/trycourier/resources/profiles.rb,
lib/trycourier/resources/profiles/lists.rb
Defined Under Namespace
Classes: Lists
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(user_id, profile:, request_options: {}) ⇒ Trycourier::Models::ProfileCreateResponse
Some parameter documentations has been truncated, see Models::ProfileCreateParams for more details.
-
#delete(user_id, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileDeleteParams for more details.
-
#initialize(client:) ⇒ Profiles
constructor
private
A new instance of Profiles.
-
#replace(user_id, profile:, request_options: {}) ⇒ Trycourier::Models::ProfileReplaceResponse
Some parameter documentations has been truncated, see Models::ProfileReplaceParams for more details.
-
#retrieve(user_id, request_options: {}) ⇒ Trycourier::Models::ProfileRetrieveResponse
Some parameter documentations has been truncated, see Models::ProfileRetrieveParams for more details.
-
#update(user_id, patch:, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Profiles
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 Profiles.
144 145 146 147 |
# File 'lib/trycourier/resources/profiles.rb', line 144 def initialize(client:) @client = client @lists = Trycourier::Resources::Profiles::Lists.new(client: client) end |
Instance Attribute Details
#lists ⇒ Trycourier::Resources::Profiles::Lists (readonly)
7 8 9 |
# File 'lib/trycourier/resources/profiles.rb', line 7 def lists @lists end |
Instance Method Details
#create(user_id, profile:, request_options: {}) ⇒ Trycourier::Models::ProfileCreateResponse
Some parameter documentations has been truncated, see Models::ProfileCreateParams for more details.
Merge the supplied values with an existing profile or create a new profile if one doesn’t already exist.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trycourier/resources/profiles.rb', line 26 def create(user_id, params) parsed, = Trycourier::ProfileCreateParams.dump_request(params) @client.request( method: :post, path: ["profiles/%1$s", user_id], body: parsed, model: Trycourier::Models::ProfileCreateResponse, options: ) end |
#delete(user_id, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileDeleteParams for more details.
Deletes the specified user profile.
101 102 103 104 105 106 107 108 |
# File 'lib/trycourier/resources/profiles.rb', line 101 def delete(user_id, params = {}) @client.request( method: :delete, path: ["profiles/%1$s", user_id], model: NilClass, options: params[:request_options] ) end |
#replace(user_id, profile:, request_options: {}) ⇒ Trycourier::Models::ProfileReplaceResponse
Some parameter documentations has been truncated, see Models::ProfileReplaceParams for more details.
When using ‘PUT`, be sure to include all the key-value pairs required by the recipient’s profile. Any key-value pairs that exist in the profile but fail to be included in the ‘PUT` request will be removed from the profile. Remember, a `PUT` update is a full replacement of the data. For partial updates, use the [Patch](www.courier.com/docs/reference/profiles/patch/) request.
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/trycourier/resources/profiles.rb', line 130 def replace(user_id, params) parsed, = Trycourier::ProfileReplaceParams.dump_request(params) @client.request( method: :put, path: ["profiles/%1$s", user_id], body: parsed, model: Trycourier::Models::ProfileReplaceResponse, options: ) end |
#retrieve(user_id, request_options: {}) ⇒ Trycourier::Models::ProfileRetrieveResponse
Some parameter documentations has been truncated, see Models::ProfileRetrieveParams for more details.
Returns the specified user profile.
51 52 53 54 55 56 57 58 |
# File 'lib/trycourier/resources/profiles.rb', line 51 def retrieve(user_id, params = {}) @client.request( method: :get, path: ["profiles/%1$s", user_id], model: Trycourier::Models::ProfileRetrieveResponse, options: params[:request_options] ) end |
#update(user_id, patch:, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileUpdateParams for more details.
Update a profile
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/trycourier/resources/profiles.rb', line 76 def update(user_id, params) parsed, = Trycourier::ProfileUpdateParams.dump_request(params) @client.request( method: :patch, path: ["profiles/%1$s", user_id], body: parsed, model: NilClass, options: ) end |