|
| 1 | +# Events |
| 2 | + |
| 3 | +```ruby |
| 4 | +events_api = client.events |
| 5 | +``` |
| 6 | + |
| 7 | +## Class Name |
| 8 | + |
| 9 | +`EventsApi` |
| 10 | + |
| 11 | +## Methods |
| 12 | + |
| 13 | +* [Search Events](../../doc/api/events.md#search-events) |
| 14 | +* [Disable Events](../../doc/api/events.md#disable-events) |
| 15 | +* [Enable Events](../../doc/api/events.md#enable-events) |
| 16 | +* [List Event Types](../../doc/api/events.md#list-event-types) |
| 17 | + |
| 18 | + |
| 19 | +# Search Events |
| 20 | + |
| 21 | +Search for Square API events that occur within a 28-day timeframe. |
| 22 | + |
| 23 | +```ruby |
| 24 | +def search_events(body:) |
| 25 | +``` |
| 26 | + |
| 27 | +## Parameters |
| 28 | + |
| 29 | +| Parameter | Type | Tags | Description | |
| 30 | +| --- | --- | --- | --- | |
| 31 | +| `body` | [`Search Events Request Hash`](../../doc/models/search-events-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. | |
| 32 | + |
| 33 | +## Response Type |
| 34 | + |
| 35 | +This method returns a `\ApiResponse` instance. The `data` property in this instance returns the response data which is of type [`Search Events Response Hash`](../../doc/models/search-events-response.md). |
| 36 | + |
| 37 | +## Example Usage |
| 38 | + |
| 39 | +```ruby |
| 40 | +body = {} |
| 41 | + |
| 42 | + |
| 43 | +result = events_api.search_events(body: body) |
| 44 | + |
| 45 | +if result.success? |
| 46 | + puts result.data |
| 47 | +elsif result.error? |
| 48 | + warn result.errors |
| 49 | +end |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +# Disable Events |
| 54 | + |
| 55 | +Disables events to prevent them from being searchable. |
| 56 | +All events are disabled by default. You must enable events to make them searchable. |
| 57 | +Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. |
| 58 | + |
| 59 | +```ruby |
| 60 | +def disable_events |
| 61 | +``` |
| 62 | + |
| 63 | +## Response Type |
| 64 | + |
| 65 | +This method returns a `\ApiResponse` instance. The `data` property in this instance returns the response data which is of type [`Disable Events Response Hash`](../../doc/models/disable-events-response.md). |
| 66 | + |
| 67 | +## Example Usage |
| 68 | + |
| 69 | +```ruby |
| 70 | +result = events_api.disable_events |
| 71 | + |
| 72 | +if result.success? |
| 73 | + puts result.data |
| 74 | +elsif result.error? |
| 75 | + warn result.errors |
| 76 | +end |
| 77 | +``` |
| 78 | + |
| 79 | + |
| 80 | +# Enable Events |
| 81 | + |
| 82 | +Enables events to make them searchable. Only events that occur while in the enabled state are searchable. |
| 83 | + |
| 84 | +```ruby |
| 85 | +def enable_events |
| 86 | +``` |
| 87 | + |
| 88 | +## Response Type |
| 89 | + |
| 90 | +This method returns a `\ApiResponse` instance. The `data` property in this instance returns the response data which is of type [`Enable Events Response Hash`](../../doc/models/enable-events-response.md). |
| 91 | + |
| 92 | +## Example Usage |
| 93 | + |
| 94 | +```ruby |
| 95 | +result = events_api.enable_events |
| 96 | + |
| 97 | +if result.success? |
| 98 | + puts result.data |
| 99 | +elsif result.error? |
| 100 | + warn result.errors |
| 101 | +end |
| 102 | +``` |
| 103 | + |
| 104 | + |
| 105 | +# List Event Types |
| 106 | + |
| 107 | +Lists all event types that you can subscribe to as webhooks or query using the Events API. |
| 108 | + |
| 109 | +```ruby |
| 110 | +def list_event_types(api_version: nil) |
| 111 | +``` |
| 112 | + |
| 113 | +## Parameters |
| 114 | + |
| 115 | +| Parameter | Type | Tags | Description | |
| 116 | +| --- | --- | --- | --- | |
| 117 | +| `api_version` | `String` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | |
| 118 | + |
| 119 | +## Response Type |
| 120 | + |
| 121 | +This method returns a `\ApiResponse` instance. The `data` property in this instance returns the response data which is of type [`List Event Types Response Hash`](../../doc/models/list-event-types-response.md). |
| 122 | + |
| 123 | +## Example Usage |
| 124 | + |
| 125 | +```ruby |
| 126 | +result = events_api.list_event_types |
| 127 | + |
| 128 | +if result.success? |
| 129 | + puts result.data |
| 130 | +elsif result.error? |
| 131 | + warn result.errors |
| 132 | +end |
| 133 | +``` |
| 134 | + |
0 commit comments