Class: Amocrm::Resources::EntityNotes

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EntityNotes

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

Parameters:



197
198
199
# File 'lib/amocrm/resources/entity_notes.rb', line 197

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create notes for entity type.



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

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

#get_by_id(id, entity_type:, with: nil, request_options: {}) ⇒ Amocrm::Models::EntityNoteGetByIDResponse::Note, Amocrm::Models::EntityNoteGetByIDResponse::Problem

Get note by id.

Parameters:

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/amocrm/resources/entity_notes.rb', line 90

def get_by_id(id, params)
  parsed, options = Amocrm::EntityNoteGetByIDParams.dump_request(params)
  query = Amocrm::Internal::Util.encode_query_params(parsed)
  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/notes/%2$s", entity_type, id],
    query: query,
    model: Amocrm::Models::EntityNoteGetByIDResponse,
    options: options
  )
end

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

Get notes list for entity type.

Parameters:

Returns:

See Also:



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

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

#pin(id, entity_type:, request_options: {}) ⇒ Amocrm::Models::EntityNotePinResponse::EmptyResponse, Amocrm::Models::EntityNotePinResponse::Problem

Pin note by id.



117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/amocrm/resources/entity_notes.rb', line 117

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

#unpin(id, entity_type:, request_options: {}) ⇒ Amocrm::Models::EntityNoteUnpinResponse::EmptyResponse, Amocrm::Models::EntityNoteUnpinResponse::Problem

Unpin note by id.



142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/amocrm/resources/entity_notes.rb', line 142

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

#update(entity_type, body:, request_options: {}) ⇒ Amocrm::Models::EntityNoteUpdateResponse::NoteCreateResponse, Amocrm::Models::EntityNoteUpdateResponse::Problem

Update notes for entity type (batch).



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

def update(entity_type, params)
  parsed, options = Amocrm::EntityNoteUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/v4/%1$s/notes", entity_type],
    body: parsed[:body],
    model: Amocrm::Models::EntityNoteUpdateResponse,
    options: options
  )
end

#update_by_id(id, entity_type:, entity_id: nil, note_type: nil, params: nil, updated_at: nil, updated_by: nil, request_options: {}) ⇒ Amocrm::Models::EntityNoteUpdateByIDResponse::NoteCreateResponse, Amocrm::Models::EntityNoteUpdateByIDResponse::Problem

Update note by id.

Parameters:

Returns:

See Also:



179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/amocrm/resources/entity_notes.rb', line 179

def update_by_id(id, params)
  parsed, options = Amocrm::EntityNoteUpdateByIDParams.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/notes/%2$s", entity_type, id],
    body: parsed,
    model: Amocrm::Models::EntityNoteUpdateByIDResponse,
    options: options
  )
end