Class: Amocrm::Resources::Customers
- Inherits:
-
Object
- Object
- Amocrm::Resources::Customers
- Defined in:
- lib/amocrm/resources/customers.rb
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ Amocrm::Models::CustomerCreateResponse::CustomerCreateResponse, Amocrm::Models::CustomerCreateResponse::Problem
Create customers.
-
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::CustomerGetByIDResponse::Customer, Amocrm::Models::CustomerGetByIDResponse::Problem
Get a customer by id.
-
#initialize(client:) ⇒ Customers
constructor
private
A new instance of Customers.
-
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::CustomerListResponse::CustomerListResponse, Amocrm::Models::CustomerListResponse::Problem
Get a list of customers.
-
#update(body:, request_options: {}) ⇒ Amocrm::Models::CustomerUpdateResponse::CustomerUpdateResponse, Amocrm::Models::CustomerUpdateResponse::Problem
Update customers (batch).
-
#update_by_id(id, _embedded: nil, custom_fields_values: nil, main_user_id: nil, name: nil, next_date: nil, next_price: nil, periodicity: nil, responsible_user_id: nil, status_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, updated_by: nil, request_options: {}) ⇒ Amocrm::Models::CustomerUpdateByIDResponse::CustomerUpdateResponse, Amocrm::Models::CustomerUpdateByIDResponse::Problem
Update a customer by id.
Constructor Details
#initialize(client:) ⇒ Customers
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 Customers.
143 144 145 |
# File 'lib/amocrm/resources/customers.rb', line 143 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ Amocrm::Models::CustomerCreateResponse::CustomerCreateResponse, Amocrm::Models::CustomerCreateResponse::Problem
Create customers.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/amocrm/resources/customers.rb', line 16 def create(params) parsed, = Amocrm::CustomerCreateParams.dump_request(params) @client.request( method: :post, path: "api/v4/customers", body: parsed[:body], model: Amocrm::Models::CustomerCreateResponse, options: ) end |
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::CustomerGetByIDResponse::Customer, Amocrm::Models::CustomerGetByIDResponse::Problem
Get a customer by id.
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/amocrm/resources/customers.rb', line 94 def get_by_id(id, params = {}) parsed, = Amocrm::CustomerGetByIDParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/customers/%1$s", id], query: query, model: Amocrm::Models::CustomerGetByIDResponse, options: ) end |
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::CustomerListResponse::CustomerListResponse, Amocrm::Models::CustomerListResponse::Problem
Get a list of customers.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/amocrm/resources/customers.rb', line 69 def list(params = {}) parsed, = Amocrm::CustomerListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/customers", query: query, model: Amocrm::Models::CustomerListResponse, options: ) end |
#update(body:, request_options: {}) ⇒ Amocrm::Models::CustomerUpdateResponse::CustomerUpdateResponse, Amocrm::Models::CustomerUpdateResponse::Problem
Update customers (batch).
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/amocrm/resources/customers.rb', line 37 def update(params) parsed, = Amocrm::CustomerUpdateParams.dump_request(params) @client.request( method: :patch, path: "api/v4/customers", body: parsed[:body], model: Amocrm::Models::CustomerUpdateResponse, options: ) end |
#update_by_id(id, _embedded: nil, custom_fields_values: nil, main_user_id: nil, name: nil, next_date: nil, next_price: nil, periodicity: nil, responsible_user_id: nil, status_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, updated_by: nil, request_options: {}) ⇒ Amocrm::Models::CustomerUpdateByIDResponse::CustomerUpdateResponse, Amocrm::Models::CustomerUpdateByIDResponse::Problem
Update a customer by id.
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/amocrm/resources/customers.rb', line 129 def update_by_id(id, params = {}) parsed, = Amocrm::CustomerUpdateByIDParams.dump_request(params) @client.request( method: :patch, path: ["api/v4/customers/%1$s", id], body: parsed, model: Amocrm::Models::CustomerUpdateByIDResponse, options: ) end |