class Pipedrive::GoalsApi
Attributes
Public Class Methods
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Find goals Returns data about goals based on criteria. For searching, append `{searchField}={searchValue}` to the URL, where `searchField` can be any one of the lowest-level fields in dot-notation (e.g. `type.params.pipeline_id`; `title`). `searchValue` should be the value you are looking for on that field. Additionally, `is_active=<true|false>` can be provided to search for only active/inactive goals. When providing `period.start`, `period.end` must also be provided and vice versa. @param [Hash] opts the optional parameters @option opts [String] :type_name Type of the goal. If provided, everyone's goals will be returned. @option opts [String] :title Title of the goal. @option opts [Boolean] :is_active Whether goal is active or not. (default to true) @option opts [Integer] :assignee_id ID of the user who's goal to fetch. When omitted, only your goals will be returned. @option opts [String] :assignee_type Type of the goal's assignee. If provided, everyone's goals will be returned. @option opts [Float] :expected_outcome_target Numeric value of the outcome. If provided, everyone's goals will be returned. @option opts [String] :expected_outcome_tracking_metric Tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned. @option opts [Integer] :expected_outcome_currency_id Numeric ID of the goal's currency. Only applicable to goals with `expected_outcome.tracking_metric` with value `sum`. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_pipeline_id ID of the pipeline or `null` for all pipelines. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_stage_id ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_activity_type_id ID of the activity type. Applicable to only `activities_completed` or `activities_added` types of goals. If provided, everyone's goals will be returned. @option opts [Date] :period_start Start date of the period for which to find goals. Date in format of YYYY-MM-DD. When `period.start` is provided, `period.end` must be provided too. @option opts [Date] :period_end End date of the period for which to find goals. Date in format of YYYY-MM-DD. @return [nil]
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 39 def goals_find_get(opts = {}) goals_find_get_with_http_info(opts) nil end
Find goals Returns data about goals based on criteria. For searching, append `{searchField}={searchValue}` to the URL, where `searchField` can be any one of the lowest-level fields in dot-notation (e.g. `type.params.pipeline_id`; `title`). `searchValue` should be the value you are looking for on that field. Additionally, `is_active=<true|false>` can be provided to search for only active/inactive goals. When providing `period.start`, `period.end` must also be provided and vice versa. @param [Hash] opts the optional parameters @option opts [String] :type_name Type of the goal. If provided, everyone's goals will be returned. @option opts [String] :title Title of the goal. @option opts [Boolean] :is_active Whether goal is active or not. @option opts [Integer] :assignee_id ID of the user who's goal to fetch. When omitted, only your goals will be returned. @option opts [String] :assignee_type Type of the goal's assignee. If provided, everyone's goals will be returned. @option opts [Float] :expected_outcome_target Numeric value of the outcome. If provided, everyone's goals will be returned. @option opts [String] :expected_outcome_tracking_metric Tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned. @option opts [Integer] :expected_outcome_currency_id Numeric ID of the goal's currency. Only applicable to goals with `expected_outcome.tracking_metric` with value `sum`. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_pipeline_id ID of the pipeline or `null` for all pipelines. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_stage_id ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned. @option opts [Integer] :type_params_activity_type_id ID of the activity type. Applicable to only `activities_completed` or `activities_added` types of goals. If provided, everyone's goals will be returned. @option opts [Date] :period_start Start date of the period for which to find goals. Date in format of YYYY-MM-DD. When `period.start` is provided, `period.end` must be provided too. @option opts [Date] :period_end End date of the period for which to find goals. Date in format of YYYY-MM-DD. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 61 def goals_find_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GoalsApi.goals_find_get ...' end allowable_values = ["deals_won", "deals_progressed", "activities_completed", "activities_added", "deals_started"] if @api_client.config.client_side_validation && opts[:'type_name'] && !allowable_values.include?(opts[:'type_name']) fail ArgumentError, "invalid value for \"type_name\", must be one of #{allowable_values}" end allowable_values = ["true", "false"] if @api_client.config.client_side_validation && opts[:'is_active'] && !allowable_values.include?(opts[:'is_active']) fail ArgumentError, "invalid value for \"is_active\", must be one of #{allowable_values}" end allowable_values = ["person", "company", "team"] if @api_client.config.client_side_validation && opts[:'assignee_type'] && !allowable_values.include?(opts[:'assignee_type']) fail ArgumentError, "invalid value for \"assignee_type\", must be one of #{allowable_values}" end allowable_values = ["quantity", "sum"] if @api_client.config.client_side_validation && opts[:'expected_outcome_tracking_metric'] && !allowable_values.include?(opts[:'expected_outcome_tracking_metric']) fail ArgumentError, "invalid value for \"expected_outcome_tracking_metric\", must be one of #{allowable_values}" end # resource path local_var_path = '/goals/find' # query parameters query_params = opts[:query_params] || {} query_params[:'type.name'] = opts[:'type_name'] if !opts[:'type_name'].nil? query_params[:'title'] = opts[:'title'] if !opts[:'title'].nil? query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil? query_params[:'assignee.id'] = opts[:'assignee_id'] if !opts[:'assignee_id'].nil? query_params[:'assignee.type'] = opts[:'assignee_type'] if !opts[:'assignee_type'].nil? query_params[:'expected_outcome.target'] = opts[:'expected_outcome_target'] if !opts[:'expected_outcome_target'].nil? query_params[:'expected_outcome.tracking_metric'] = opts[:'expected_outcome_tracking_metric'] if !opts[:'expected_outcome_tracking_metric'].nil? query_params[:'expected_outcome.currency_id'] = opts[:'expected_outcome_currency_id'] if !opts[:'expected_outcome_currency_id'].nil? query_params[:'type.params.pipeline_id'] = opts[:'type_params_pipeline_id'] if !opts[:'type_params_pipeline_id'].nil? query_params[:'type.params.stage_id'] = opts[:'type_params_stage_id'] if !opts[:'type_params_stage_id'].nil? query_params[:'type.params.activity_type_id'] = opts[:'type_params_activity_type_id'] if !opts[:'type_params_activity_type_id'].nil? query_params[:'period.start'] = opts[:'period_start'] if !opts[:'period_start'].nil? query_params[:'period.end'] = opts[:'period_end'] if !opts[:'period_end'].nil? # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key'] 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: GoalsApi#goals_find_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete existing goal Marks goal as deleted. @param id [String] ID of the goal to be deleted. @param [Hash] opts the optional parameters @return [nil]
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 136 def goals_id_delete(id, opts = {}) goals_id_delete_with_http_info(id, opts) nil end
Delete existing goal Marks goal as deleted. @param id [String] ID of the goal to be deleted. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 146 def goals_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GoalsApi.goals_id_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 GoalsApi.goals_id_delete" end # resource path local_var_path = '/goals/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key'] 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: GoalsApi#goals_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update existing goal Updates existing goal. @param id [String] ID of the goal to be updated. @param [Hash] opts the optional parameters @option opts [String] :title Title of the goal. @option opts [Object] :assignee Who is this goal assigned to. It requires the following JSON structure: { \"id\": \"1\", \"type\": \"person\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team. @option opts [Object] :type Type of the goal. It requires the following JSON structure: { \"name\": \"deals_started\", \"params\": { \"pipeline_id\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`. @option opts [Object] :expected_outcome Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \"target\": \"50\", \"tracking_metric\": \"quantity\" } or { \"target\": \"50\", \"tracking_metric\": \"sum\", \"currency_id\": 1 }. `currency_id` should only be added to `sum` type of goals. @option opts [Object] :duration Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. @option opts [String] :interval Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. @return [nil]
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 202 def goals_id_put(id, opts = {}) goals_id_put_with_http_info(id, opts) nil end
Update existing goal Updates existing goal. @param id [String] ID of the goal to be updated. @param [Hash] opts the optional parameters @option opts [String] :title Title of the goal. @option opts [Object] :assignee Who is this goal assigned to. It requires the following JSON structure: { \"id\": \"1\", \"type\": \"person\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team. @option opts [Object] :type Type of the goal. It requires the following JSON structure: { \"name\": \"deals_started\", \"params\": { \"pipeline_id\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`. @option opts [Object] :expected_outcome Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \"target\": \"50\", \"tracking_metric\": \"quantity\" } or { \"target\": \"50\", \"tracking_metric\": \"sum\", \"currency_id\": 1 }. `currency_id` should only be added to `sum` type of goals. @option opts [Object] :duration Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. @option opts [String] :interval Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 218 def goals_id_put_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GoalsApi.goals_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 GoalsApi.goals_id_put" end allowable_values = ["weekly", "monthly", "quarterly", "yearly"] if @api_client.config.client_side_validation && opts[:'interval'] && !allowable_values.include?(opts[:'interval']) fail ArgumentError, "invalid value for \"interval\", must be one of #{allowable_values}" end # resource path local_var_path = '/goals/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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['title'] = opts[:'title'] if !opts[:'title'].nil? form_params['assignee'] = opts[:'assignee'] if !opts[:'assignee'].nil? form_params['type'] = opts[:'type'] if !opts[:'type'].nil? form_params['expected_outcome'] = opts[:'expected_outcome'] if !opts[:'expected_outcome'].nil? form_params['duration'] = opts[:'duration'] if !opts[:'duration'].nil? form_params['interval'] = opts[:'interval'] if !opts[:'interval'].nil? # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key'] 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: GoalsApi#goals_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get result of a goal Gets progress of a goal for specified period. @param id [String] ID of the goal that the results are looked for. @param period_start [Date] Start date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. @param period_end [Date] End date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. @param [Hash] opts the optional parameters @return [nil]
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 282 def goals_id_results_get(id, period_start, period_end, opts = {}) goals_id_results_get_with_http_info(id, period_start, period_end, opts) nil end
Get result of a goal Gets progress of a goal for specified period. @param id [String] ID of the goal that the results are looked for. @param period_start [Date] Start date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. @param period_end [Date] End date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 294 def goals_id_results_get_with_http_info(id, period_start, period_end, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GoalsApi.goals_id_results_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 GoalsApi.goals_id_results_get" end # verify the required parameter 'period_start' is set if @api_client.config.client_side_validation && period_start.nil? fail ArgumentError, "Missing the required parameter 'period_start' when calling GoalsApi.goals_id_results_get" end # verify the required parameter 'period_end' is set if @api_client.config.client_side_validation && period_end.nil? fail ArgumentError, "Missing the required parameter 'period_end' when calling GoalsApi.goals_id_results_get" end # resource path local_var_path = '/goals/{id}/results'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'period.start'] = period_start query_params[:'period.end'] = period_end # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key'] 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: GoalsApi#goals_id_results_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Add a new goal Adds a new goal. @param [Hash] opts the optional parameters @return [nil]
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 353 def goals_post(opts = {}) goals_post_with_http_info(opts) nil end
Add a new goal Adds a new goal. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/pipedrive-openapi-client/api/goals_api.rb, line 362 def goals_post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GoalsApi.goals_post ...' end # resource path local_var_path = '/goals' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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] # auth_names auth_names = opts[:auth_names] || ['api_key'] 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: GoalsApi#goals_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end