Skip to content

Commit a0ae86f

Browse files
Merge pull request #132 from square/release/38.1.0.20240604
Generated PR for Release: 38.1.0.20240604
2 parents fdc6dd9 + 39e6efb commit a0ae86f

22 files changed

+676
-15
lines changed

doc/api/events.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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+

doc/client.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:
55

66
| Parameter | Type | Description |
77
| --- | --- | --- |
8-
| `square_version` | `String` | Square Connect API versions<br>*Default*: `'2024-05-15'` |
8+
| `square_version` | `String` | Square Connect API versions<br>*Default*: `'2024-06-04'` |
99
| `custom_url` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
1010
| `environment` | `string` | The API environment. <br> **Default: `production`** |
1111
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
@@ -25,7 +25,7 @@ The API client can be initialized as follows:
2525

2626
```ruby
2727
client = Square::Client.new(
28-
square_version: '2024-05-15',
28+
square_version: '2024-06-04',
2929
bearer_auth_credentials: BearerAuthCredentials.new(
3030
access_token: 'AccessToken'
3131
),
@@ -94,6 +94,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
9494
| devices | Gets DevicesApi |
9595
| disputes | Gets DisputesApi |
9696
| employees | Gets EmployeesApi |
97+
| events | Gets EventsApi |
9798
| gift_cards | Gets GiftCardsApi |
9899
| gift_card_activities | Gets GiftCardActivitiesApi |
99100
| inventory | Gets InventoryApi |

doc/models/disable-events-response.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
# Disable Events Response
3+
4+
Defines the fields that are included in the response body of
5+
a request to the [DisableEvents](../../doc/api/events.md#disable-events) endpoint.
6+
7+
Note: if there are errors processing the request, the events field will not be
8+
present.
9+
10+
## Structure
11+
12+
`Disable Events Response`
13+
14+
## Fields
15+
16+
| Name | Type | Tags | Description |
17+
| --- | --- | --- | --- |
18+
| `errors` | [`Array<Error Hash>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |
19+
20+
## Example (as JSON)
21+
22+
```json
23+
{
24+
"errors": [
25+
{
26+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
27+
"code": "MAP_KEY_LENGTH_TOO_LONG",
28+
"detail": "detail6",
29+
"field": "field4"
30+
},
31+
{
32+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
33+
"code": "MAP_KEY_LENGTH_TOO_LONG",
34+
"detail": "detail6",
35+
"field": "field4"
36+
}
37+
]
38+
}
39+
```
40+

doc/models/enable-events-response.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# Enable Events Response
3+
4+
Defines the fields that are included in the response body of
5+
a request to the [EnableEvents](../../doc/api/events.md#enable-events) endpoint.
6+
7+
Note: if there are errors processing the request, the events field will not be
8+
present.
9+
10+
## Structure
11+
12+
`Enable Events Response`
13+
14+
## Fields
15+
16+
| Name | Type | Tags | Description |
17+
| --- | --- | --- | --- |
18+
| `errors` | [`Array<Error Hash>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |
19+
20+
## Example (as JSON)
21+
22+
```json
23+
{
24+
"errors": [
25+
{
26+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
27+
"code": "MAP_KEY_LENGTH_TOO_LONG",
28+
"detail": "detail6",
29+
"field": "field4"
30+
}
31+
]
32+
}
33+
```
34+

doc/models/event-data.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
| Name | Type | Tags | Description |
1111
| --- | --- | --- | --- |
12-
| `type` | `String` | Optional | Name of the affected object’s type. |
13-
| `id` | `String` | Optional | ID of the affected object. |
14-
| `deleted` | `TrueClass \| FalseClass` | Optional | Is true if the affected object was deleted. Otherwise absent. |
15-
| `object` | `Hash` | Optional | An object containing fields and values relevant to the event. Is absent if affected object was deleted. |
12+
| `type` | `String` | Optional | The name of the affected object’s type. |
13+
| `id` | `String` | Optional | The ID of the affected object. |
14+
| `deleted` | `TrueClass \| FalseClass` | Optional | This is true if the affected object has been deleted; otherwise, it's absent. |
15+
| `object` | `Hash` | Optional | An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. |
1616

1717
## Example (as JSON)
1818

doc/models/event-metadata.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# Event Metadata
3+
4+
Contains metadata about a particular [Event](../../doc/models/event.md).
5+
6+
## Structure
7+
8+
`Event Metadata`
9+
10+
## Fields
11+
12+
| Name | Type | Tags | Description |
13+
| --- | --- | --- | --- |
14+
| `event_id` | `String` | Optional | A unique ID for the event. |
15+
| `api_version` | `String` | Optional | The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. |
16+
17+
## Example (as JSON)
18+
19+
```json
20+
{
21+
"event_id": "event_id0",
22+
"api_version": "api_version6"
23+
}
24+
```
25+

doc/models/event.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| Name | Type | Tags | Description |
1111
| --- | --- | --- | --- |
1212
| `merchant_id` | `String` | Optional | The ID of the target merchant associated with the event. |
13-
| `location_id` | `String` | Optional | The ID of the location associated with the event. |
13+
| `location_id` | `String` | Optional | The ID of the target location associated with the event. |
1414
| `type` | `String` | Optional | The type of event this represents. |
1515
| `event_id` | `String` | Optional | A unique ID for the event. |
1616
| `created_at` | `String` | Optional | Timestamp of when the event was created, in RFC 3339 format. |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# List Event Types Request
3+
4+
Lists all event types that can be subscribed to.
5+
6+
## Structure
7+
8+
`List Event Types Request`
9+
10+
## Fields
11+
12+
| Name | Type | Tags | Description |
13+
| --- | --- | --- | --- |
14+
| `api_version` | `String` | Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. |
15+
16+
## Example (as JSON)
17+
18+
```json
19+
{
20+
"api_version": "api_version0"
21+
}
22+
```
23+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
# List Event Types Response
3+
4+
Defines the fields that are included in the response body of
5+
a request to the [ListEventTypes](../../doc/api/events.md#list-event-types) endpoint.
6+
7+
Note: if there are errors processing the request, the event types field will not be
8+
present.
9+
10+
## Structure
11+
12+
`List Event Types Response`
13+
14+
## Fields
15+
16+
| Name | Type | Tags | Description |
17+
| --- | --- | --- | --- |
18+
| `errors` | [`Array<Error Hash>`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. |
19+
| `event_types` | `Array<String>` | Optional | The list of event types. |
20+
| `metadata` | [`Array<Event Type Metadata Hash>`](../../doc/models/event-type-metadata.md) | Optional | Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). |
21+
22+
## Example (as JSON)
23+
24+
```json
25+
{
26+
"event_types": [
27+
"inventory.count.updated"
28+
],
29+
"metadata": [
30+
{
31+
"api_version_introduced": "2018-07-12",
32+
"event_type": "inventory.count.updated",
33+
"release_status": "PUBLIC"
34+
}
35+
],
36+
"errors": [
37+
{
38+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
39+
"code": "MAP_KEY_LENGTH_TOO_LONG",
40+
"detail": "detail6",
41+
"field": "field4"
42+
},
43+
{
44+
"category": "MERCHANT_SUBSCRIPTION_ERROR",
45+
"code": "MAP_KEY_LENGTH_TOO_LONG",
46+
"detail": "detail6",
47+
"field": "field4"
48+
}
49+
]
50+
}
51+
```
52+

doc/models/quantity-ratio.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A whole number or unreduced fractional ratio.
1212
| Name | Type | Tags | Description |
1313
| --- | --- | --- | --- |
1414
| `quantity` | `Integer` | Optional | The whole or fractional quantity as the numerator. |
15-
| `quantity_denominator` | `Integer` | Optional | The whole or fractional quantity as the denominator.<br>In the case of fractional quantity this field is the denominator and quantity is the numerator.<br>When unspecified, the value is `1`. For example, when `quantity=3` and `quantity_donominator` is unspecified,<br>the quantity ratio is `3` or `3/1`. |
15+
| `quantity_denominator` | `Integer` | Optional | The whole or fractional quantity as the denominator.<br>With fractional quantity this field is the denominator and quantity is the numerator.<br>The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified,<br>the quantity ratio is `3` or `3/1`. |
1616

1717
## Example (as JSON)
1818

0 commit comments

Comments
 (0)