Sha256: 060135ed8d50081341150455104e363afc32ffc967d482818bb90f1c4c0425c2
Contents?: true
Size: 1.35 KB
Versions: 12
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true require 'net/http' module WorkOS # The Events module provides convenience methods for working with the # WorkOS Events platform. You'll need a valid API key and be in the # Events beta to be able to access the API # module Events class << self include Client # Retrieve events. # # @param [Hash] options An options hash # @option options [String] event The type of event # @option options [String] organization_id Limit scope of events to an organization # @option options [String] limit Maximum number of records to return. # @option options [String] after Pagination cursor to receive records # after a provided Event ID. # # @return [Hash] def list_events(options = {}) raise ArgumentError, 'Events parameter is required.' if options[:events].nil? response = execute_request( request: get_request( path: '/events', auth: true, params: options, ), ) parsed_response = JSON.parse(response.body) events = parsed_response['data'].map do |event| ::WorkOS::Event.new(event.to_json) end WorkOS::Types::ListStruct.new( data: events, list_metadata: parsed_response['list_metadata'], ) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems