Class: Amocrm::Resources::CatalogElements
- Inherits:
-
Object
- Object
- Amocrm::Resources::CatalogElements
- Defined in:
- lib/amocrm/resources/catalog_elements.rb
Instance Method Summary collapse
-
#create(catalog_id, body:, request_options: {}) ⇒ Amocrm::Models::CatalogElementCreateResponse::CatalogElementCreateResponse, Amocrm::Models::CatalogElementCreateResponse::Problem
Create catalog elements.
-
#get_by_id(id, catalog_id:, with: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementGetByIDResponse::CatalogElement, Amocrm::Models::CatalogElementGetByIDResponse::Problem
Get catalog element by id.
-
#initialize(client:) ⇒ CatalogElements
constructor
private
A new instance of CatalogElements.
-
#list(catalog_id, filter: nil, limit: nil, page: nil, query: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementListResponse::CatalogElementListResponse, Amocrm::Models::CatalogElementListResponse::Problem
Get catalog elements list.
-
#update(catalog_id, body:, request_options: {}) ⇒ Amocrm::Models::CatalogElementUpdateResponse::CatalogElementUpdateResponse, Amocrm::Models::CatalogElementUpdateResponse::Problem
Update catalog elements (batch).
-
#update_by_id(id, catalog_id:, custom_fields_values: nil, name: nil, request_id: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementUpdateByIDResponse::CatalogElementUpdateResponse, Amocrm::Models::CatalogElementUpdateByIDResponse::Problem
Update catalog element by id.
Constructor Details
#initialize(client:) ⇒ CatalogElements
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 CatalogElements.
144 145 146 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 144 def initialize(client:) @client = client end |
Instance Method Details
#create(catalog_id, body:, request_options: {}) ⇒ Amocrm::Models::CatalogElementCreateResponse::CatalogElementCreateResponse, Amocrm::Models::CatalogElementCreateResponse::Problem
Create catalog elements.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 17 def create(catalog_id, params) parsed, = Amocrm::CatalogElementCreateParams.dump_request(params) @client.request( method: :post, path: ["api/v4/catalogs/%1$s/elements", catalog_id], body: parsed[:body], model: Amocrm::Models::CatalogElementCreateResponse, options: ) end |
#get_by_id(id, catalog_id:, with: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementGetByIDResponse::CatalogElement, Amocrm::Models::CatalogElementGetByIDResponse::Problem
Get catalog element by id.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 91 def get_by_id(id, params) parsed, = Amocrm::CatalogElementGetByIDParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) catalog_id = parsed.delete(:catalog_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["api/v4/catalogs/%1$s/elements/%2$s", catalog_id, id], query: query, model: Amocrm::Models::CatalogElementGetByIDResponse, options: ) end |
#list(catalog_id, filter: nil, limit: nil, page: nil, query: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementListResponse::CatalogElementListResponse, Amocrm::Models::CatalogElementListResponse::Problem
Get catalog elements list.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 64 def list(catalog_id, params = {}) parsed, = Amocrm::CatalogElementListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/catalogs/%1$s/elements", catalog_id], query: query, model: Amocrm::Models::CatalogElementListResponse, options: ) end |
#update(catalog_id, body:, request_options: {}) ⇒ Amocrm::Models::CatalogElementUpdateResponse::CatalogElementUpdateResponse, Amocrm::Models::CatalogElementUpdateResponse::Problem
Update catalog elements (batch).
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 39 def update(catalog_id, params) parsed, = Amocrm::CatalogElementUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/v4/catalogs/%1$s/elements", catalog_id], body: parsed[:body], model: Amocrm::Models::CatalogElementUpdateResponse, options: ) end |
#update_by_id(id, catalog_id:, custom_fields_values: nil, name: nil, request_id: nil, request_options: {}) ⇒ Amocrm::Models::CatalogElementUpdateByIDResponse::CatalogElementUpdateResponse, Amocrm::Models::CatalogElementUpdateByIDResponse::Problem
Update catalog element by id.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/amocrm/resources/catalog_elements.rb', line 126 def update_by_id(id, params) parsed, = Amocrm::CatalogElementUpdateByIDParams.dump_request(params) catalog_id = parsed.delete(:catalog_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["api/v4/catalogs/%1$s/elements/%2$s", catalog_id, id], body: parsed, model: Amocrm::Models::CatalogElementUpdateByIDResponse, options: ) end |