class Pipedrive::TeamsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/pipedrive-openapi-client/api/teams_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

teams_get(opts = {}) click to toggle source

Get all teams Returns data about teams within the company @param [Hash] opts the optional parameters @option opts [String] :order_by Field name to sort returned teams by (default to 'id') @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Teams]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 28
def teams_get(opts = {})
  data, _status_code, _headers = teams_get_with_http_info(opts)
  data
end
teams_get_with_http_info(opts = {}) click to toggle source

Get all teams Returns data about teams within the company @param [Hash] opts the optional parameters @option opts [String] :order_by Field name to sort returned teams by @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Array<(Teams, Integer, Hash)>] Teams data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 39
def teams_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_get ...'
  end
  allowable_values = ["id", "name", "manager_id", "active_flag"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/teams'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'skip_users'] = opts[:'skip_users'] if !opts[:'skip_users'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Teams' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_id_get(id, opts = {}) click to toggle source

Get a single team Returns data about a specific team @param id [Integer] ID of the team @param [Hash] opts the optional parameters @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Teams]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 94
def teams_id_get(id, opts = {})
  data, _status_code, _headers = teams_id_get_with_http_info(id, opts)
  data
end
teams_id_get_with_http_info(id, opts = {}) click to toggle source

Get a single team Returns data about a specific team @param id [Integer] ID of the team @param [Hash] opts the optional parameters @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Array<(Teams, Integer, Hash)>] Teams data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 105
def teams_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_id_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_id_get"
  end
  # resource path
  local_var_path = '/teams/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'skip_users'] = opts[:'skip_users'] if !opts[:'skip_users'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Teams' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_id_put(id, opts = {}) click to toggle source

Update a team Updates an existing team and returns the updated object @param id [Integer] ID of the team @param [Hash] opts the optional parameters @return [Teams]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 158
def teams_id_put(id, opts = {})
  data, _status_code, _headers = teams_id_put_with_http_info(id, opts)
  data
end
teams_id_put_with_http_info(id, opts = {}) click to toggle source

Update a team Updates an existing team and returns the updated object @param id [Integer] ID of the team @param [Hash] opts the optional parameters @return [Array<(Teams, Integer, Hash)>] Teams data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 168
def teams_id_put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_id_put ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_id_put"
  end
  # resource path
  local_var_path = '/teams/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Teams' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_id_users_delete(id, users, opts = {}) click to toggle source

Delete users from a team Deletes users from an existing team @param id [Integer] ID of the team @param users [Array<Integer>] List of User IDs @param [Hash] opts the optional parameters @return [UserIDs]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 223
def teams_id_users_delete(id, users, opts = {})
  data, _status_code, _headers = teams_id_users_delete_with_http_info(id, users, opts)
  data
end
teams_id_users_delete_with_http_info(id, users, opts = {}) click to toggle source

Delete users from a team Deletes users from an existing team @param id [Integer] ID of the team @param users [Array<Integer>] List of User IDs @param [Hash] opts the optional parameters @return [Array<(UserIDs, Integer, Hash)>] UserIDs data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 234
def teams_id_users_delete_with_http_info(id, users, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_id_users_delete ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_id_users_delete"
  end
  # verify the required parameter 'users' is set
  if @api_client.config.client_side_validation && users.nil?
    fail ArgumentError, "Missing the required parameter 'users' when calling TeamsApi.teams_id_users_delete"
  end
  # resource path
  local_var_path = '/teams/{id}/users'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['users'] = @api_client.build_collection_param(users, :csv)

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'UserIDs' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_id_users_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_id_users_get(id, opts = {}) click to toggle source

Get all users in a team Returns list of all user IDs within a team @param id [Integer] ID of the team @param [Hash] opts the optional parameters @return [UserIDs]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 293
def teams_id_users_get(id, opts = {})
  data, _status_code, _headers = teams_id_users_get_with_http_info(id, opts)
  data
end
teams_id_users_get_with_http_info(id, opts = {}) click to toggle source

Get all users in a team Returns list of all user IDs within a team @param id [Integer] ID of the team @param [Hash] opts the optional parameters @return [Array<(UserIDs, Integer, Hash)>] UserIDs data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 303
def teams_id_users_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_id_users_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_id_users_get"
  end
  # resource path
  local_var_path = '/teams/{id}/users'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'UserIDs' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_id_users_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_id_users_post(id, users, opts = {}) click to toggle source

Add users to a team Adds users to an existing team @param id [Integer] ID of the team @param users [Array<Integer>] List of User IDs @param [Hash] opts the optional parameters @return [UserIDs]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 356
def teams_id_users_post(id, users, opts = {})
  data, _status_code, _headers = teams_id_users_post_with_http_info(id, users, opts)
  data
end
teams_id_users_post_with_http_info(id, users, opts = {}) click to toggle source

Add users to a team Adds users to an existing team @param id [Integer] ID of the team @param users [Array<Integer>] List of User IDs @param [Hash] opts the optional parameters @return [Array<(UserIDs, Integer, Hash)>] UserIDs data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 367
def teams_id_users_post_with_http_info(id, users, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_id_users_post ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_id_users_post"
  end
  # verify the required parameter 'users' is set
  if @api_client.config.client_side_validation && users.nil?
    fail ArgumentError, "Missing the required parameter 'users' when calling TeamsApi.teams_id_users_post"
  end
  # resource path
  local_var_path = '/teams/{id}/users'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['users'] = @api_client.build_collection_param(users, :csv)

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'UserIDs' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_id_users_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_post(name, manager_id, opts = {}) click to toggle source

Add a new team Adds a new team to the company and returns the created object @param name [String] The Team name @param manager_id [Integer] The Team manager ID @param [Hash] opts the optional parameters @option opts [String] :description The Team description @option opts [Array] :users IDs of the Users that belong to the Team @return [Teams]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 429
def teams_post(name, manager_id, opts = {})
  data, _status_code, _headers = teams_post_with_http_info(name, manager_id, opts)
  data
end
teams_post_with_http_info(name, manager_id, opts = {}) click to toggle source

Add a new team Adds a new team to the company and returns the created object @param name [String] The Team name @param manager_id [Integer] The Team manager ID @param [Hash] opts the optional parameters @option opts [String] :description The Team description @option opts [Array] :users IDs of the Users that belong to the Team @return [Array<(Teams, Integer, Hash)>] Teams data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 442
def teams_post_with_http_info(name, manager_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_post ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling TeamsApi.teams_post"
  end
  # verify the required parameter 'manager_id' is set
  if @api_client.config.client_side_validation && manager_id.nil?
    fail ArgumentError, "Missing the required parameter 'manager_id' when calling TeamsApi.teams_post"
  end
  # resource path
  local_var_path = '/teams'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['name'] = name
  form_params['manager_id'] = manager_id
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['users'] = opts[:'users'] if !opts[:'users'].nil?

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Teams' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
teams_user_id_get(id, opts = {}) click to toggle source

Get all teams of a user Returns data about all teams which have specified user as a member @param id [Integer] ID of the user @param [Hash] opts the optional parameters @option opts [String] :order_by Field name to sort returned teams by (default to 'id') @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Teams]

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 506
def teams_user_id_get(id, opts = {})
  data, _status_code, _headers = teams_user_id_get_with_http_info(id, opts)
  data
end
teams_user_id_get_with_http_info(id, opts = {}) click to toggle source

Get all teams of a user Returns data about all teams which have specified user as a member @param id [Integer] ID of the user @param [Hash] opts the optional parameters @option opts [String] :order_by Field name to sort returned teams by @option opts [NumberBooleanDefault0] :skip_users When enabled, the teams will not include IDs of member users @return [Array<(Teams, Integer, Hash)>] Teams data, response status code and response headers

# File lib/pipedrive-openapi-client/api/teams_api.rb, line 518
def teams_user_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamsApi.teams_user_id_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling TeamsApi.teams_user_id_get"
  end
  allowable_values = ["id", "name", "manager_id", "active_flag"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/teams/user/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'skip_users'] = opts[:'skip_users'] if !opts[:'skip_users'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Teams' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamsApi#teams_user_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end