Class: Amocrm::Resources::Users
- Inherits:
-
Object
- Object
- Amocrm::Resources::Users
- Defined in:
- lib/amocrm/resources/users.rb
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ Amocrm::Models::UserCreateResponse::UserCreateResponse, Amocrm::Models::UserCreateResponse::Problem
Create users (batch).
-
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::UserGetByIDResponse::User, Amocrm::Models::UserGetByIDResponse::Problem
Get user by id.
-
#initialize(client:) ⇒ Users
constructor
private
A new instance of Users.
-
#list(limit: nil, page: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::UserListResponse::UserListResponse, Amocrm::Models::UserListResponse::Problem
Get users list.
Constructor Details
#initialize(client:) ⇒ Users
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 Users.
77 78 79 |
# File 'lib/amocrm/resources/users.rb', line 77 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ Amocrm::Models::UserCreateResponse::UserCreateResponse, Amocrm::Models::UserCreateResponse::Problem
Create users (batch).
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/amocrm/resources/users.rb', line 16 def create(params) parsed, = Amocrm::UserCreateParams.dump_request(params) @client.request( method: :post, path: "api/v4/users", body: parsed[:body], model: Amocrm::Models::UserCreateResponse, options: ) end |
#get_by_id(id, with: nil, request_options: {}) ⇒ Amocrm::Models::UserGetByIDResponse::User, Amocrm::Models::UserGetByIDResponse::Problem
Get user by id.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/amocrm/resources/users.rb', line 62 def get_by_id(id, params = {}) parsed, = Amocrm::UserGetByIDParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/users/%1$s", id], query: query, model: Amocrm::Models::UserGetByIDResponse, options: ) end |
#list(limit: nil, page: nil, with: nil, request_options: {}) ⇒ Amocrm::Models::UserListResponse::UserListResponse, Amocrm::Models::UserListResponse::Problem
Get users list.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/amocrm/resources/users.rb', line 39 def list(params = {}) parsed, = Amocrm::UserListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/users", query: query, model: Amocrm::Models::UserListResponse, options: ) end |