class Hubspot::Crm::Extensions::Cards::CardsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 22
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

archive(app_id, card_id, opts = {}) click to toggle source

Delete a card Permanently deletes a card definition with the given ID. Once deleted, data fetch requests for this card will no longer be sent to your service. This can't be undone. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the card to delete. @param [Hash] opts the optional parameters @return [nil]

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 31
def archive(app_id, card_id, opts = {})
  archive_with_http_info(app_id, card_id, opts)
  nil
end
archive_with_http_info(app_id, card_id, opts = {}) click to toggle source

Delete a card Permanently deletes a card definition with the given ID. Once deleted, data fetch requests for this card will no longer be sent to your service. This can&#39;t be undone. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the card to delete. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 42
def archive_with_http_info(app_id, card_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardsApi.archive ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling CardsApi.archive"
  end
  # verify the required parameter 'card_id' is set
  if @api_client.config.client_side_validation && card_id.nil?
    fail ArgumentError, "Missing the required parameter 'card_id' when calling CardsApi.archive"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/cards/{appId}/{cardId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'cardId' + '}', CGI.escape(card_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(['*/*'])

  # 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] || ['developer_hapikey']

  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: CardsApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create(app_id, card_create_request, opts = {}) click to toggle source

Create a new card Defines a new card that will become active on an account when this app is installed. @param app_id [Integer] The ID of the target app. @param card_create_request [CardCreateRequest] The new card definition. @param [Hash] opts the optional parameters @return [CardResponse]

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 99
def create(app_id, card_create_request, opts = {})
  data, _status_code, _headers = create_with_http_info(app_id, card_create_request, opts)
  data
end
create_with_http_info(app_id, card_create_request, opts = {}) click to toggle source

Create a new card Defines a new card that will become active on an account when this app is installed. @param app_id [Integer] The ID of the target app. @param card_create_request [CardCreateRequest] The new card definition. @param [Hash] opts the optional parameters @return [Array<(CardResponse, Integer, Hash)>] CardResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 110
def create_with_http_info(app_id, card_create_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardsApi.create ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling CardsApi.create"
  end
  # verify the required parameter 'card_create_request' is set
  if @api_client.config.client_side_validation && card_create_request.nil?
    fail ArgumentError, "Missing the required parameter 'card_create_request' when calling CardsApi.create"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/cards/{appId}'.sub('{' + 'appId' + '}', CGI.escape(app_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/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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: CardsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_all(app_id, opts = {}) click to toggle source

Get all cards Returns a list of cards for a given app. @param app_id [Integer] The ID of the target app. @param [Hash] opts the optional parameters @return [CardListResponse]

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 168
def get_all(app_id, opts = {})
  data, _status_code, _headers = get_all_with_http_info(app_id, opts)
  data
end
get_all_with_http_info(app_id, opts = {}) click to toggle source

Get all cards Returns a list of cards for a given app. @param app_id [Integer] The ID of the target app. @param [Hash] opts the optional parameters @return [Array<(CardListResponse, Integer, Hash)>] CardListResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 178
def get_all_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardsApi.get_all ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling CardsApi.get_all"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/cards/{appId}'.sub('{' + 'appId' + '}', CGI.escape(app_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] || 'CardListResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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: CardsApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_by_id(app_id, card_id, opts = {}) click to toggle source

Get a card. Returns the definition for a card with the given ID. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the target card. @param [Hash] opts the optional parameters @return [CardResponse]

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 231
def get_by_id(app_id, card_id, opts = {})
  data, _status_code, _headers = get_by_id_with_http_info(app_id, card_id, opts)
  data
end
get_by_id_with_http_info(app_id, card_id, opts = {}) click to toggle source

Get a card. Returns the definition for a card with the given ID. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the target card. @param [Hash] opts the optional parameters @return [Array<(CardResponse, Integer, Hash)>] CardResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 242
def get_by_id_with_http_info(app_id, card_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardsApi.get_by_id ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling CardsApi.get_by_id"
  end
  # verify the required parameter 'card_id' is set
  if @api_client.config.client_side_validation && card_id.nil?
    fail ArgumentError, "Missing the required parameter 'card_id' when calling CardsApi.get_by_id"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/cards/{appId}/{cardId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'cardId' + '}', CGI.escape(card_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] || 'CardResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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: CardsApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update(app_id, card_id, card_patch_request, opts = {}) click to toggle source

Update a card Update a card definition with new details. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the card to update. @param card_patch_request [CardPatchRequest] Card definition fields to be updated. @param [Hash] opts the optional parameters @return [CardResponse]

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 300
def update(app_id, card_id, card_patch_request, opts = {})
  data, _status_code, _headers = update_with_http_info(app_id, card_id, card_patch_request, opts)
  data
end
update_with_http_info(app_id, card_id, card_patch_request, opts = {}) click to toggle source

Update a card Update a card definition with new details. @param app_id [Integer] The ID of the target app. @param card_id [String] The ID of the card to update. @param card_patch_request [CardPatchRequest] Card definition fields to be updated. @param [Hash] opts the optional parameters @return [Array<(CardResponse, Integer, Hash)>] CardResponse data, response status code and response headers

# File lib/hubspot/codegen/crm/extensions/cards/api/cards_api.rb, line 312
def update_with_http_info(app_id, card_id, card_patch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CardsApi.update ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling CardsApi.update"
  end
  # verify the required parameter 'card_id' is set
  if @api_client.config.client_side_validation && card_id.nil?
    fail ArgumentError, "Missing the required parameter 'card_id' when calling CardsApi.update"
  end
  # verify the required parameter 'card_patch_request' is set
  if @api_client.config.client_side_validation && card_patch_request.nil?
    fail ArgumentError, "Missing the required parameter 'card_patch_request' when calling CardsApi.update"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/cards/{appId}/{cardId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'cardId' + '}', CGI.escape(card_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/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['developer_hapikey']

  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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CardsApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end