Class: Trycourier::Resources::Brands
- Inherits:
-
Object
- Object
- Trycourier::Resources::Brands
- Defined in:
- lib/trycourier/resources/brands.rb
Instance Method Summary collapse
-
#create(name: , id: nil, settings: nil, snippets: nil, request_options: {}) ⇒ Trycourier::Models::Brand
Create a new brand.
-
#delete(brand_id, request_options: {}) ⇒ nil
Delete a brand by brand ID.
-
#initialize(client:) ⇒ Brands
constructor
private
A new instance of Brands.
-
#list(cursor: nil, request_options: {}) ⇒ Trycourier::Models::BrandListResponse
Get the list of brands.
-
#retrieve(brand_id, request_options: {}) ⇒ Trycourier::Models::Brand
Fetch a specific brand by brand ID.
-
#update(brand_id, name: , settings: nil, snippets: nil, request_options: {}) ⇒ Trycourier::Models::Brand
Replace an existing brand with the supplied values.
Constructor Details
#initialize(client:) ⇒ Brands
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 Brands.
123 124 125 |
# File 'lib/trycourier/resources/brands.rb', line 123 def initialize(client:) @client = client end |
Instance Method Details
#create(name: , id: nil, settings: nil, snippets: nil, request_options: {}) ⇒ Trycourier::Models::Brand
Create a new brand
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trycourier/resources/brands.rb', line 19 def create(params) parsed, = Trycourier::BrandCreateParams.dump_request(params) @client.request( method: :post, path: "brands", body: parsed, model: Trycourier::Brand, options: ) end |
#delete(brand_id, request_options: {}) ⇒ nil
Delete a brand by brand ID.
111 112 113 114 115 116 117 118 |
# File 'lib/trycourier/resources/brands.rb', line 111 def delete(brand_id, params = {}) @client.request( method: :delete, path: ["brands/%1$s", brand_id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, request_options: {}) ⇒ Trycourier::Models::BrandListResponse
Get the list of brands.
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/trycourier/resources/brands.rb', line 89 def list(params = {}) parsed, = Trycourier::BrandListParams.dump_request(params) @client.request( method: :get, path: "brands", query: parsed, model: Trycourier::Models::BrandListResponse, options: ) end |
#retrieve(brand_id, request_options: {}) ⇒ Trycourier::Models::Brand
Fetch a specific brand by brand ID.
41 42 43 44 45 46 47 48 |
# File 'lib/trycourier/resources/brands.rb', line 41 def retrieve(brand_id, params = {}) @client.request( method: :get, path: ["brands/%1$s", brand_id], model: Trycourier::Brand, options: params[:request_options] ) end |
#update(brand_id, name: , settings: nil, snippets: nil, request_options: {}) ⇒ Trycourier::Models::Brand
Replace an existing brand with the supplied values.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/trycourier/resources/brands.rb', line 67 def update(brand_id, params) parsed, = Trycourier::BrandUpdateParams.dump_request(params) @client.request( method: :put, path: ["brands/%1$s", brand_id], body: parsed, model: Trycourier::Brand, options: ) end |