Class: Amocrm::Resources::Catalogs

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Catalogs

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

Parameters:



119
120
121
# File 'lib/amocrm/resources/catalogs.rb', line 119

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create catalogs.



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

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

#get_by_id(id, request_options: {}) ⇒ Amocrm::Models::CatalogGetByIDResponse::Catalog, Amocrm::Models::CatalogGetByIDResponse::Problem

Get catalog by id.

Parameters:

Returns:

See Also:



81
82
83
84
85
86
87
88
# File 'lib/amocrm/resources/catalogs.rb', line 81

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

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

Get catalogs list.

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/amocrm/resources/catalogs.rb', line 59

def list(params = {})
  parsed, options = Amocrm::CatalogListParams.dump_request(params)
  query = Amocrm::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/v4/catalogs",
    query: query,
    model: Amocrm::Models::CatalogListResponse,
    options: options
  )
end

#update(body:, request_options: {}) ⇒ Amocrm::Models::CatalogUpdateResponse::CatalogUpdateResponse, Amocrm::Models::CatalogUpdateResponse::Problem

Update catalogs (batch).



37
38
39
40
41
42
43
44
45
46
# File 'lib/amocrm/resources/catalogs.rb', line 37

def update(params)
  parsed, options = Amocrm::CatalogUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "api/v4/catalogs",
    body: parsed[:body],
    model: Amocrm::Models::CatalogUpdateResponse,
    options: options
  )
end

#update_by_id(id, can_add_elements: nil, can_link_multiple: nil, name: nil, request_id: nil, sort: nil, request_options: {}) ⇒ Amocrm::Models::CatalogUpdateByIDResponse::CatalogUpdateResponse, Amocrm::Models::CatalogUpdateByIDResponse::Problem

Update catalog by id.

Parameters:

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

Returns:

See Also:



105
106
107
108
109
110
111
112
113
114
# File 'lib/amocrm/resources/catalogs.rb', line 105

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