Class: Amocrm::Resources::EntityFollowers

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EntityFollowers

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

Parameters:



102
103
104
# File 'lib/amocrm/resources/entity_followers.rb', line 102

def initialize(client:)
  @client = client
end

Instance Method Details

#add(entity_id, entity_type:, body:, request_options: {}) ⇒ Amocrm::Models::EntityFollowerAddResponse::EntityFollowerCreateResponse, Amocrm::Models::EntityFollowerAddResponse::Problem

Add followers.

Parameters:

Returns:

See Also:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/amocrm/resources/entity_followers.rb', line 54

def add(entity_id, params)
  parsed, options = Amocrm::EntityFollowerAddParams.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/%2$s/followers", entity_type, entity_id],
    body: parsed[:body],
    model: Amocrm::Models::EntityFollowerAddResponse,
    options: options
  )
end

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

Get followers list.

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/amocrm/resources/entity_followers.rb', line 23

def list(entity_id, params)
  parsed, options = Amocrm::EntityFollowerListParams.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/%2$s/followers", entity_type, entity_id],
    query: query,
    model: Amocrm::Models::EntityFollowerListResponse,
    options: options
  )
end

#remove(entity_id, entity_type:, body:, request_options: {}) ⇒ Amocrm::Models::EntityFollowerRemoveResponse::EmptyResponse, Amocrm::Models::EntityFollowerRemoveResponse::Problem

Remove followers.

Parameters:

Returns:

See Also:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/amocrm/resources/entity_followers.rb', line 84

def remove(entity_id, params)
  parsed, options = Amocrm::EntityFollowerRemoveParams.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/%2$s/followers", entity_type, entity_id],
    body: parsed[:body],
    model: Amocrm::Models::EntityFollowerRemoveResponse,
    options: options
  )
end