Class: Amocrm::Resources::Leads
- Inherits:
-
Object
- Object
- Amocrm::Resources::Leads
- Defined in:
- lib/amocrm/resources/leads.rb
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ Amocrm::Models::LeadCreateResponse::LeadCreateResponse, Amocrm::Models::LeadCreateResponse::Problem
Create leads.
-
#create_complex(body:, request_options: {}) ⇒ Amocrm::Models::LeadCreateComplexResponse::LeadComplexCreateResponse, Amocrm::Models::LeadCreateComplexResponse::Problem
Create leads using the complex method (supports unsorted metadata).
-
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::LeadGetByIDResponse::Lead, Amocrm::Models::LeadGetByIDResponse::Problem
Get a lead by id.
-
#initialize(client:) ⇒ Leads
constructor
private
A new instance of Leads.
-
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::LeadListResponse::LeadListResponse, Amocrm::Models::LeadListResponse::Problem
Get a list of leads (pagination, sorting, filtering).
-
#update(body:, request_options: {}) ⇒ Amocrm::Models::LeadUpdateResponse::LeadUpdateResponse, Amocrm::Models::LeadUpdateResponse::Problem
Update leads (batch).
-
#update_by_id(id, _embedded: nil, closed_at: nil, custom_fields_values: nil, group_id: nil, loss_reason_id: nil, name: nil, pipeline_id: nil, price: nil, responsible_user_id: nil, status_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, request_options: {}) ⇒ Amocrm::Models::LeadUpdateByIDResponse::LeadUpdateResponse, Amocrm::Models::LeadUpdateByIDResponse::Problem
Update a lead by id.
Constructor Details
#initialize(client:) ⇒ Leads
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 Leads.
178 179 180 |
# File 'lib/amocrm/resources/leads.rb', line 178 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ Amocrm::Models::LeadCreateResponse::LeadCreateResponse, Amocrm::Models::LeadCreateResponse::Problem
Create leads.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/amocrm/resources/leads.rb', line 16 def create(params) parsed, = Amocrm::LeadCreateParams.dump_request(params) @client.request( method: :post, path: "api/v4/leads", body: parsed[:body], model: Amocrm::Models::LeadCreateResponse, options: ) end |
#create_complex(body:, request_options: {}) ⇒ Amocrm::Models::LeadCreateComplexResponse::LeadComplexCreateResponse, Amocrm::Models::LeadCreateComplexResponse::Problem
Create leads using the complex method (supports unsorted metadata).
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/amocrm/resources/leads.rb', line 91 def create_complex(params) parsed, = Amocrm::LeadCreateComplexParams.dump_request(params) @client.request( method: :post, path: "api/v4/leads/complex", body: parsed[:body], model: Amocrm::Models::LeadCreateComplexResponse, options: ) end |
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::LeadGetByIDResponse::Lead, Amocrm::Models::LeadGetByIDResponse::Problem
Get a lead by id.
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/amocrm/resources/leads.rb', line 115 def get_by_id(id, params = {}) parsed, = Amocrm::LeadGetByIDParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/leads/%1$s", id], query: query, model: Amocrm::Models::LeadGetByIDResponse, options: ) end |
#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::LeadListResponse::LeadListResponse, Amocrm::Models::LeadListResponse::Problem
Get a list of leads (pagination, sorting, filtering).
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/amocrm/resources/leads.rb', line 69 def list(params = {}) parsed, = Amocrm::LeadListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/leads", query: query, model: Amocrm::Models::LeadListResponse, options: ) end |
#update(body:, request_options: {}) ⇒ Amocrm::Models::LeadUpdateResponse::LeadUpdateResponse, Amocrm::Models::LeadUpdateResponse::Problem
Update leads (batch).
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/amocrm/resources/leads.rb', line 37 def update(params) parsed, = Amocrm::LeadUpdateParams.dump_request(params) @client.request( method: :patch, path: "api/v4/leads", body: parsed[:body], model: Amocrm::Models::LeadUpdateResponse, options: ) end |
#update_by_id(id, _embedded: nil, closed_at: nil, custom_fields_values: nil, group_id: nil, loss_reason_id: nil, name: nil, pipeline_id: nil, price: nil, responsible_user_id: nil, status_id: nil, tags_to_add: nil, tags_to_delete: nil, updated_at: nil, request_options: {}) ⇒ Amocrm::Models::LeadUpdateByIDResponse::LeadUpdateResponse, Amocrm::Models::LeadUpdateByIDResponse::Problem
Update a lead by id.
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/amocrm/resources/leads.rb', line 164 def update_by_id(id, params = {}) parsed, = Amocrm::LeadUpdateByIDParams.dump_request(params) @client.request( method: :patch, path: ["api/v4/leads/%1$s", id], body: parsed, model: Amocrm::Models::LeadUpdateByIDResponse, options: ) end |