Class: Amocrm::Resources::CustomFieldGroups

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CustomFieldGroups

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

Parameters:



137
138
139
# File 'lib/amocrm/resources/custom_field_groups.rb', line 137

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create custom field groups.



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

def create(entity_type, params)
  parsed, options = Amocrm::CustomFieldGroupCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v4/%1$s/custom_fields/groups", entity_type],
    body: parsed[:body],
    model: Amocrm::Models::CustomFieldGroupCreateResponse,
    options: options
  )
end

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

Delete a custom field group by id.

Parameters:

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/amocrm/resources/custom_field_groups.rb', line 63

def delete_by_id(id, params)
  parsed, options = Amocrm::CustomFieldGroupDeleteByIDParams.dump_request(params)
  entity_type =
    parsed.delete(:entity_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/v4/%1$s/custom_fields/groups/%2$s", entity_type, id],
    model: Amocrm::Models::CustomFieldGroupDeleteByIDResponse,
    options: options
  )
end

#get_by_id(id, entity_type:, request_options: {}) ⇒ Amocrm::Models::CustomFieldGroupGetByIDResponse::CustomFieldGroup, Amocrm::Models::CustomFieldGroupGetByIDResponse::Problem

Get custom field group by id.



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/amocrm/resources/custom_field_groups.rb', line 88

def get_by_id(id, params)
  parsed, options = Amocrm::CustomFieldGroupGetByIDParams.dump_request(params)
  entity_type =
    parsed.delete(:entity_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/v4/%1$s/custom_fields/groups/%2$s", entity_type, id],
    model: Amocrm::Models::CustomFieldGroupGetByIDResponse,
    options: options
  )
end

#list(entity_type, limit: nil, page: nil, request_options: {}) ⇒ Amocrm::Models::CustomFieldGroupListResponse::CustomFieldGroupListResponse, Amocrm::Models::CustomFieldGroupListResponse::Problem

Get custom field groups list.

Parameters:

  • entity_type (String)
  • limit (Integer)
  • page (Integer)
  • request_options (Amocrm::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/amocrm/resources/custom_field_groups.rb', line 40

def list(entity_type, params = {})
  parsed, options = Amocrm::CustomFieldGroupListParams.dump_request(params)
  query = Amocrm::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/v4/%1$s/custom_fields/groups", entity_type],
    query: query,
    model: Amocrm::Models::CustomFieldGroupListResponse,
    options: options
  )
end

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

Update a custom field group by id.

Parameters:

  • id (Integer)

    Path param

  • entity_type (String)

    Path param

  • name (String)

    Body param

  • sort (Integer)

    Body param

  • request_options (Amocrm::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/amocrm/resources/custom_field_groups.rb', line 119

def update_by_id(id, params)
  parsed, options = Amocrm::CustomFieldGroupUpdateByIDParams.dump_request(params)
  entity_type =
    parsed.delete(:entity_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["api/v4/%1$s/custom_fields/groups/%2$s", entity_type, id],
    body: parsed,
    model: Amocrm::Models::CustomFieldGroupUpdateByIDResponse,
    options: options
  )
end