Class: Hubspot::Events::EventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/events/api/events_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EventsApi

Returns a new instance of EventsApi.



20
21
22
# File 'lib/hubspot/codegen/events/api/events_api.rb', line 20

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



18
19
20
# File 'lib/hubspot/codegen/events/api/events_api.rb', line 18

def api_client
  @api_client
end

Instance Method Details

#get_page(opts = {}) ⇒ CollectionResponseExternalUnifiedEvent

Returns a collection of events matching a query.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :occurred_after (Time)

    The starting time as an ISO 8601 timestamp.

  • :occurred_before (Time)

    The ending time as an ISO 8601 timestamp.

  • :object_type (String)

    The type of object being selected. Valid values are hubspot named object types (e.g. `contact`).

  • :object_id (Integer)

    The id of the selected object. If not present, then the `objectProperty` parameter is required.

  • :event_type (String)

    Limits the response to the specified event type. For example `&eventType=e_visited_page` returns only `e_visited_page` events. If not present all event types are returned.

  • :after (String)

    An additional parameter that may be used to get the next `limit` set of results.

  • :before (String)
  • :limit (Integer)

    The maximum number of events to return, defaults to 20.

  • :sort (Array<String>)

    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.

Returns:



35
36
37
38
# 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 = {}) ⇒ Array<(CollectionResponseExternalUnifiedEvent, Integer, Hash)>

Returns a collection of events matching a query.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :occurred_after (Time)

    The starting time as an ISO 8601 timestamp.

  • :occurred_before (Time)

    The ending time as an ISO 8601 timestamp.

  • :object_type (String)

    The type of object being selected. Valid values are hubspot named object types (e.g. &#x60;contact&#x60;).

  • :object_id (Integer)

    The id of the selected object. If not present, then the &#x60;objectProperty&#x60; parameter is required.

  • :event_type (String)

    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.

  • :after (String)

    An additional parameter that may be used to get the next &#x60;limit&#x60; set of results.

  • :before (String)
  • :limit (Integer)

    The maximum number of events to return, defaults to 20.

  • :sort (Array<String>)

    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.

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# 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[:debug_body]

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :operation => :"EventsApi.get_page",
    :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