class Patch::PreferencesApi

Constants

OPERATIONS

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/patch_ruby/api/preferences_api.rb, line 26
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_preference(create_preference_request = {}, opts = {}) click to toggle source

creates a project preference Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. @param create_preference_request [CreatePreferenceRequest] @param [Hash] opts the optional parameters @return [PreferenceResponse]

# File lib/patch_ruby/api/preferences_api.rb, line 34
def create_preference(create_preference_request = {}, opts = {})
  _create_preference_request = Patch::CreatePreferenceRequest.new(create_preference_request) 
  data, _status_code, _headers = create_preference_with_http_info(_create_preference_request, opts)
  data
end
create_preference_with_http_info(create_preference_request, opts = {}) click to toggle source

creates a project preference Creates a project preference for the given organization. If you have a &#x60;preference&#x60; in place, all of your orders will be directed to the project the preference points to. @param create_preference_request [CreatePreferenceRequest] @param [Hash] opts the optional parameters @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers

# File lib/patch_ruby/api/preferences_api.rb, line 45
def create_preference_with_http_info(create_preference_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PreferencesApi.create_preference ...'
  end
  # verify the required parameter 'create_preference_request' is set
  if @api_client.config.client_side_validation && create_preference_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_preference_request' when calling PreferencesApi.create_preference"
  end
  # resource path
  local_var_path = '/v1/preferences'

  # 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/json'])

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_preference_request)

  # return_type
  return_type = opts[:debug_return_type] || 'PreferenceResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearer_auth']

  new_options = opts.merge(
    :operation => :"PreferencesApi.create_preference",
    :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: PreferencesApi#create_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_preference(id, opts = {}) click to toggle source

Deletes an organization's preference for a project Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. @param id [String] @param [Hash] opts the optional parameters @return [PreferenceResponse]

# File lib/patch_ruby/api/preferences_api.rb, line 100
def delete_preference(id, opts = {})
  
  data, _status_code, _headers = delete_preference_with_http_info(id, opts)
  data
end
delete_preference_with_http_info(id, opts = {}) click to toggle source

Deletes an organization&#39;s preference for a project Deletes the given &#x60;preference&#x60;. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. @param id [String] @param [Hash] opts the optional parameters @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers

# File lib/patch_ruby/api/preferences_api.rb, line 111
def delete_preference_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PreferencesApi.delete_preference ...'
  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 PreferencesApi.delete_preference"
  end
  # resource path
  local_var_path = '/v1/preferences/{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'])

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'PreferenceResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearer_auth']

  new_options = opts.merge(
    :operation => :"PreferencesApi.delete_preference",
    :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: PreferencesApi#delete_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
retrieve_preference(id, opts = {}) click to toggle source

Retrieve the preference Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. @param id [String] @param [Hash] opts the optional parameters @return [PreferenceResponse]

# File lib/patch_ruby/api/preferences_api.rb, line 164
def retrieve_preference(id, opts = {})
  
  data, _status_code, _headers = retrieve_preference_with_http_info(id, opts)
  data
end
retrieve_preference_with_http_info(id, opts = {}) click to toggle source

Retrieve the preference Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. @param id [String] @param [Hash] opts the optional parameters @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers

# File lib/patch_ruby/api/preferences_api.rb, line 175
def retrieve_preference_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preference ...'
  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 PreferencesApi.retrieve_preference"
  end
  # resource path
  local_var_path = '/v1/preferences/{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'])

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'PreferenceResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearer_auth']

  new_options = opts.merge(
    :operation => :"PreferencesApi.retrieve_preference",
    :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: PreferencesApi#retrieve_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
retrieve_preferences(opts = {}) click to toggle source

Retrieves a list of preferences Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. @param [Hash] opts the optional parameters @option opts [Integer] :page @return [PreferenceListResponse]

# File lib/patch_ruby/api/preferences_api.rb, line 228
def retrieve_preferences(opts = {})
  
  data, _status_code, _headers = retrieve_preferences_with_http_info(opts)
  data
end
retrieve_preferences_with_http_info(opts = {}) click to toggle source

Retrieves a list of preferences Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. @param [Hash] opts the optional parameters @option opts [Integer] :page @return [Array<(PreferenceListResponse, Integer, Hash)>] PreferenceListResponse data, response status code and response headers

# File lib/patch_ruby/api/preferences_api.rb, line 239
def retrieve_preferences_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preferences ...'
  end
  # resource path
  local_var_path = '/v1/preferences'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PreferenceListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearer_auth']

  new_options = opts.merge(
    :operation => :"PreferencesApi.retrieve_preferences",
    :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: PreferencesApi#retrieve_preferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end