class Hubspot::Events::EventsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/hubspot/codegen/events/api/events_api.rb, line 20
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_page(opts = {}) click to toggle source

Returns a collection of events matching a query. @param [Hash] opts the optional parameters @option opts [DateTime] :occurred_after The starting time as an ISO 8601 timestamp. @option opts [DateTime] :occurred_before The ending time as an ISO 8601 timestamp. @option opts [String] :object_type The type of object being selected. Valid values are hubspot named object types (e.g. &#x60;contact&#x60;). @option opts [Integer] :object_id The id of the selected object. If not present, then the &#x60;objectProperty&#x60; parameter is required. @option opts [String] :event_type Limits the response to the specified event type. For example &#x60;&amp;eventType&#x3D;e_visited_page&#x60; returns only &#x60;e_visited_page&#x60; events. If not present all event types are returned. @option opts [String] :after An additional parameter that may be used to get the next &#x60;limit&#x60; set of results. @option opts [String] :before @option opts [Integer] :limit The maximum number of events to return, defaults to 20. @option opts [Array<String>] :sort Selects the sort field and order. Defaults to ascending, prefix with &#x60;-&#x60; for descending order. &#x60;occurredAt&#x60; is the only field supported for sorting. @return [CollectionResponseExternalUnifiedEvent]

# File lib/hubspot/codegen/events/api/events_api.rb, line 35
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

Returns a collection of events matching a query. @param [Hash] opts the optional parameters @option opts [DateTime] :occurred_after The starting time as an ISO 8601 timestamp. @option opts [DateTime] :occurred_before The ending time as an ISO 8601 timestamp. @option opts [String] :object_type The type of object being selected. Valid values are hubspot named object types (e.g. &#x60;contact&#x60;). @option opts [Integer] :object_id The id of the selected object. If not present, then the &#x60;objectProperty&#x60; parameter is required. @option opts [String] :event_type Limits the response to the specified event type. For example &#x60;&amp;eventType&#x3D;e_visited_page&#x60; returns only &#x60;e_visited_page&#x60; events. If not present all event types are returned. @option opts [String] :after An additional parameter that may be used to get the next &#x60;limit&#x60; set of results. @option opts [String] :before @option opts [Integer] :limit The maximum number of events to return, defaults to 20. @option opts [Array<String>] :sort Selects the sort field and order. Defaults to ascending, prefix with &#x60;-&#x60; for descending order. &#x60;occurredAt&#x60; is the only field supported for sorting. @return [Array<(CollectionResponseExternalUnifiedEvent, Integer, Hash)>] CollectionResponseExternalUnifiedEvent data, response status code and response headers

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'occurredAfter'] = opts[:'occurred_after'] if !opts[:'occurred_after'].nil?
  query_params[:'occurredBefore'] = opts[:'occurred_before'] if !opts[:'occurred_before'].nil?
  query_params[:'objectType'] = opts[:'object_type'] if !opts[:'object_type'].nil?
  query_params[:'objectId'] = opts[:'object_id'] if !opts[:'object_id'].nil?
  query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil?
  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?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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] || 'CollectionResponseExternalUnifiedEvent' 

  # 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: EventsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end