Class: Amocrm::Resources::CustomerStatuses

Inherits:
Object
  • Object
show all
Defined in:
lib/amocrm/resources/customer_statuses.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CustomerStatuses

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 CustomerStatuses.

Parameters:



110
111
112
# File 'lib/amocrm/resources/customer_statuses.rb', line 110

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body:, request_options: {}) ⇒ Amocrm::Models::CustomerStatusCreateResponse::CustomerStatusCreateResponse, Amocrm::Models::CustomerStatusCreateResponse::Problem

Create statuses.



16
17
18
19
20
21
22
23
24
25
# File 'lib/amocrm/resources/customer_statuses.rb', line 16

def create(params)
  parsed, options = Amocrm::CustomerStatusCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/v4/customers/statuses",
    body: parsed[:body],
    model: Amocrm::Models::CustomerStatusCreateResponse,
    options: options
  )
end

#delete_by_id(id, request_options: {}) ⇒ Object, Amocrm::Models::CustomerStatusDeleteByIDResponse::Problem

Delete a status by id.

Parameters:

Returns:

See Also:



55
56
57
58
59
60
61
62
# File 'lib/amocrm/resources/customer_statuses.rb', line 55

def delete_by_id(id, params = {})
  @client.request(
    method: :delete,
    path: ["api/v4/customers/statuses/%1$s", id],
    model: Amocrm::Models::CustomerStatusDeleteByIDResponse,
    options: params[:request_options]
  )
end

#get_by_id(id, request_options: {}) ⇒ Amocrm::Models::CustomerStatusGetByIDResponse::CustomerStatus, Amocrm::Models::CustomerStatusGetByIDResponse::Problem

Get status by id.



74
75
76
77
78
79
80
81
# File 'lib/amocrm/resources/customer_statuses.rb', line 74

def get_by_id(id, params = {})
  @client.request(
    method: :get,
    path: ["api/v4/customers/statuses/%1$s", id],
    model: Amocrm::Models::CustomerStatusGetByIDResponse,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ Amocrm::Models::CustomerStatusListResponse::CustomerStatusListResponse, Amocrm::Models::CustomerStatusListResponse::Problem

Get statuses list.



36
37
38
39
40
41
42
43
# File 'lib/amocrm/resources/customer_statuses.rb', line 36

def list(params = {})
  @client.request(
    method: :get,
    path: "api/v4/customers/statuses",
    model: Amocrm::Models::CustomerStatusListResponse,
    options: params[:request_options]
  )
end

#update_by_id(id, color: nil, name: nil, sort: nil, request_options: {}) ⇒ Object, Amocrm::Models::CustomerStatusUpdateByIDResponse::Problem

Update a status by id.

Parameters:

  • id (Integer)
  • color (String)
  • name (String)
  • sort (Integer)
  • request_options (Amocrm::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



96
97
98
99
100
101
102
103
104
105
# File 'lib/amocrm/resources/customer_statuses.rb', line 96

def update_by_id(id, params = {})
  parsed, options = Amocrm::CustomerStatusUpdateByIDParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/v4/customers/statuses/%1$s", id],
    body: parsed,
    model: Amocrm::Models::CustomerStatusUpdateByIDResponse,
    options: options
  )
end