class Hubspot::Crm::Imports::CoreApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 21
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

cancel(import_id, opts = {}) click to toggle source

Cancel an active import This allows a developer to cancel an active import. @param import_id [Integer] @param [Hash] opts the optional parameters @return [ActionResponse]

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 29
def cancel(import_id, opts = {})
  data, _status_code, _headers = cancel_with_http_info(import_id, opts)
  data
end
cancel_with_http_info(import_id, opts = {}) click to toggle source

Cancel an active import This allows a developer to cancel an active import. @param import_id [Integer] @param [Hash] opts the optional parameters @return [Array<(ActionResponse, Integer, Hash)>] ActionResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 39
def cancel_with_http_info(import_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CoreApi.cancel ...'
  end
  # verify the required parameter 'import_id' is set
  if @api_client.config.client_side_validation && import_id.nil?
    fail ArgumentError, "Missing the required parameter 'import_id' when calling CoreApi.cancel"
  end
  # resource path
  local_var_path = '/crm/v3/imports/{importId}/cancel'.sub('{' + 'importId' + '}', CGI.escape(import_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] || 'ActionResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', '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: CoreApi#cancel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create(opts = {}) click to toggle source

Start a new import Begins importing data from the specified file resources. This uploads the corresponding file and uses the import request object to convert rows in the files to objects. @param [Hash] opts the optional parameters @option opts [File] :files A list of files containing the data to import @option opts [String] :import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. @return [PublicImportResponse]

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 92
def create(opts = {})
  data, _status_code, _headers = create_with_http_info(opts)
  data
end
create_with_http_info(opts = {}) click to toggle source

Start a new import Begins importing data from the specified file resources. This uploads the corresponding file and uses the import request object to convert rows in the files to objects. @param [Hash] opts the optional parameters @option opts [File] :files A list of files containing the data to import @option opts [String] :import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. @return [Array<(PublicImportResponse, Integer, Hash)>] PublicImportResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 103
def create_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CoreApi.create ...'
  end
  # resource path
  local_var_path = '/crm/v3/imports/'

  # 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(['multipart/form-data'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['files'] = opts[:'files'] if !opts[:'files'].nil?
  form_params['importRequest'] = opts[:'import_request'] if !opts[:'import_request'].nil?

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', '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: CoreApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_by_id(import_id, opts = {}) click to toggle source

Get the information on any import A complete summary of an import record, including any updates. @param import_id [Integer] @param [Hash] opts the optional parameters @return [PublicImportResponse]

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 155
def get_by_id(import_id, opts = {})
  data, _status_code, _headers = get_by_id_with_http_info(import_id, opts)
  data
end
get_by_id_with_http_info(import_id, opts = {}) click to toggle source

Get the information on any import A complete summary of an import record, including any updates. @param import_id [Integer] @param [Hash] opts the optional parameters @return [Array<(PublicImportResponse, Integer, Hash)>] PublicImportResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 165
def get_by_id_with_http_info(import_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CoreApi.get_by_id ...'
  end
  # verify the required parameter 'import_id' is set
  if @api_client.config.client_side_validation && import_id.nil?
    fail ArgumentError, "Missing the required parameter 'import_id' when calling CoreApi.get_by_id"
  end
  # resource path
  local_var_path = '/crm/v3/imports/{importId}'.sub('{' + 'importId' + '}', CGI.escape(import_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] || 'PublicImportResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', '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: CoreApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_page(opts = {}) click to toggle source

Get active imports Returns a paged list of active imports for this account. @param [Hash] opts the optional parameters @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. @option opts [String] :before @option opts [Integer] :limit The maximum number of results to display per page. @return [CollectionResponsePublicImportResponse]

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 219
def get_page(opts = {})
  data, _status_code, _headers = get_page_with_http_info(opts)
  data
end
get_page_with_http_info(opts = {}) click to toggle source

Get active imports Returns a paged list of active imports for this account. @param [Hash] opts the optional parameters @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. @option opts [String] :before @option opts [Integer] :limit The maximum number of results to display per page. @return [Array<(CollectionResponsePublicImportResponse, Integer, Hash)>] CollectionResponsePublicImportResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/imports/api/core_api.rb, line 231
def get_page_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CoreApi.get_page ...'
  end
  # resource path
  local_var_path = '/crm/v3/imports/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'CollectionResponsePublicImportResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', '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: CoreApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end