Class: Amocrm::Resources::Contacts
- Inherits:
-
Object
- Object
- Amocrm::Resources::Contacts
- Defined in:
- lib/amocrm/resources/contacts.rb
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ Amocrm::Models::ContactCreateResponse::ContactCreateResponse, Amocrm::Models::ContactCreateResponse::Problem
Create contacts.
-
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::ContactGetByIDResponse::Contact, Amocrm::Models::ContactGetByIDResponse::Problem
Get a contact by id.
-
#initialize(client:) ⇒ Contacts
constructor
private
A new instance of Contacts.
-
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::ContactListResponse::ContactListResponse, Amocrm::Models::ContactListResponse::Problem
Get a list of contacts (pagination, sorting, filtering).
-
#update(body:, request_options: {}) ⇒ Amocrm::Models::ContactUpdateResponse::ContactUpdateResponse, Amocrm::Models::ContactUpdateResponse::Problem
Update contacts (batch).
-
#update_by_id(id, _embedded: nil, created_at: nil, created_by: nil, custom_fields_values: nil, first_name: nil, last_name: nil, name: nil, responsible_user_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, updated_by: nil, request_options: {}) ⇒ Amocrm::Models::ContactUpdateByIDResponse::ContactUpdateResponse, Amocrm::Models::ContactUpdateByIDResponse::Problem
Update a contact by id.
Constructor Details
#initialize(client:) ⇒ Contacts
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 Contacts.
155 156 157 |
# File 'lib/amocrm/resources/contacts.rb', line 155 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ Amocrm::Models::ContactCreateResponse::ContactCreateResponse, Amocrm::Models::ContactCreateResponse::Problem
Create contacts.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/amocrm/resources/contacts.rb', line 16 def create(params) parsed, = Amocrm::ContactCreateParams.dump_request(params) @client.request( method: :post, path: "api/v4/contacts", body: parsed[:body], model: Amocrm::Models::ContactCreateResponse, options: ) end |
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::ContactGetByIDResponse::Contact, Amocrm::Models::ContactGetByIDResponse::Problem
Get a contact by id.
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/amocrm/resources/contacts.rb', line 94 def get_by_id(id, params = {}) parsed, = Amocrm::ContactGetByIDParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/contacts/%1$s", id], query: query, model: Amocrm::Models::ContactGetByIDResponse, options: ) end |
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::ContactListResponse::ContactListResponse, Amocrm::Models::ContactListResponse::Problem
Get a list of contacts (pagination, sorting, filtering).
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/amocrm/resources/contacts.rb', line 69 def list(params = {}) parsed, = Amocrm::ContactListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/contacts", query: query, model: Amocrm::Models::ContactListResponse, options: ) end |
#update(body:, request_options: {}) ⇒ Amocrm::Models::ContactUpdateResponse::ContactUpdateResponse, Amocrm::Models::ContactUpdateResponse::Problem
Update contacts (batch).
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/amocrm/resources/contacts.rb', line 37 def update(params) parsed, = Amocrm::ContactUpdateParams.dump_request(params) @client.request( method: :patch, path: "api/v4/contacts", body: parsed[:body], model: Amocrm::Models::ContactUpdateResponse, options: ) end |
#update_by_id(id, _embedded: nil, created_at: nil, created_by: nil, custom_fields_values: nil, first_name: nil, last_name: nil, name: nil, responsible_user_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, updated_by: nil, request_options: {}) ⇒ Amocrm::Models::ContactUpdateByIDResponse::ContactUpdateResponse, Amocrm::Models::ContactUpdateByIDResponse::Problem
Update a contact by id.
141 142 143 144 145 146 147 148 149 150 |
# File 'lib/amocrm/resources/contacts.rb', line 141 def update_by_id(id, params = {}) parsed, = Amocrm::ContactUpdateByIDParams.dump_request(params) @client.request( method: :patch, path: ["api/v4/contacts/%1$s", id], body: parsed, model: Amocrm::Models::ContactUpdateByIDResponse, options: ) end |