Skip to content

Commit

Permalink
Merge pull request #130 from square/release/37.0.0.20240417
Browse files Browse the repository at this point in the history
Generated PR for Release: 37.0.0.20240417
  • Loading branch information
daphnechiu authored Apr 16, 2024
2 parents be889da + fe606c1 commit 527432c
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 186 deletions.
4 changes: 4 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# **ATTENTION**
This repository **cannot** accept Pull Requests. If you wish to proceed with opening this PR, please understand that your code **will not** be pulled into this repository. Consider opening an issue which lays out the problem instead. Thank you very much for your efforts and highlighting issues!

Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly.
71 changes: 0 additions & 71 deletions doc/api/o-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,82 +10,11 @@ o_auth_api = client.o_auth

## Methods

* [Renew Token](../../doc/api/o-auth.md#renew-token)
* [Revoke Token](../../doc/api/o-auth.md#revoke-token)
* [Obtain Token](../../doc/api/o-auth.md#obtain-token)
* [Retrieve Token Status](../../doc/api/o-auth.md#retrieve-token-status)


# Renew Token

**This endpoint is deprecated.**

`RenewToken` is deprecated. For information about refreshing OAuth access tokens, see
[Migrate from Renew to Refresh OAuth Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).

Renews an OAuth access token before it expires.

OAuth access tokens besides your application's personal access token expire after 30 days.
You can also renew expired tokens within 15 days of their expiration.
You cannot renew an access token that has been expired for more than 15 days.
Instead, the associated user must recomplete the OAuth flow from the beginning.

__Important:__ The `Authorization` header for this endpoint must have the
following format:

```
Authorization: Client APPLICATION_SECRET
```

Replace `APPLICATION_SECRET` with the application secret on the **Credentials**
page in the [Developer Dashboard](https://developer.squareup.com/apps).

:information_source: **Note** This endpoint does not require authentication.

```ruby
def renew_token(client_id:,
body:,
authorization:)
```

## Parameters

| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `client_id` | `String` | Template, Required | Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). |
| `body` | [`Renew Token Request Hash`](../../doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
| `authorization` | `String` | Header, Required | Client APPLICATION_SECRET |

## Response Type

This method returns a `\ApiResponse` instance. The `data` property in this instance returns the response data which is of type [`Renew Token Response Hash`](../../doc/models/renew-token-response.md).

## Example Usage

```ruby
client_id = 'client_id8'

body = {
:access_token => 'ACCESS_TOKEN'
}

authorization = 'Client CLIENT_SECRET'


result = o_auth_api.renew_token(
client_id: client_id,
body: body,
authorization: authorization
)

if result.success?
puts result.data
elsif result.error?
warn result.errors
end
```


# Revoke Token

Revokes an access token generated with the OAuth flow.
Expand Down
4 changes: 2 additions & 2 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:

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

```ruby
client = Square::Client.new(
square_version: '2024-03-20',
square_version: '2024-04-17',
bearer_auth_credentials: BearerAuthCredentials.new(
access_token: 'AccessToken'
),
Expand Down
2 changes: 1 addition & 1 deletion doc/models/catalog-custom-attribute-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ to store any sensitive information (personally identifiable information, card de
| `name` | `String` | Required | The name of this definition for API and seller-facing UI purposes.<br>The name must be unique within the (merchant, application) pair. Required.<br>May not be empty and may not exceed 255 characters. Can be modified after creation.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` |
| `description` | `String` | Optional | Seller-oriented description of the meaning of this Custom Attribute,<br>any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.<br>**Constraints**: *Maximum Length*: `255` |
| `source_application` | [`Source Application Hash`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. |
| `allowed_object_types` | [`Array<String (Catalog Object Type)>`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.<br>Currently, only `ITEM`, `ITEM_VARIATION`, and `MODIFIER` are allowed. At least one type must be included.<br>See [CatalogObjectType](#type-catalogobjecttype) for possible values |
| `allowed_object_types` | [`Array<String (Catalog Object Type)>`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.<br>Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.<br>See [CatalogObjectType](#type-catalogobjecttype) for possible values |
| `seller_visibility` | [`String (Catalog Custom Attribute Definition Seller Visibility)`](../../doc/models/catalog-custom-attribute-definition-seller-visibility.md) | Optional | Defines the visibility of a custom attribute to sellers in Square<br>client applications, Square APIs or in Square UIs (including Square Point<br>of Sale applications and Square Dashboard). |
| `app_visibility` | [`String (Catalog Custom Attribute Definition App Visibility)`](../../doc/models/catalog-custom-attribute-definition-app-visibility.md) | Optional | Defines the visibility of a custom attribute to applications other than their<br>creating application. |
| `string_config` | [`Catalog Custom Attribute Definition String Config Hash`](../../doc/models/catalog-custom-attribute-definition-string-config.md) | Optional | Configuration associated with Custom Attribute Definitions of type `STRING`. |
Expand Down
2 changes: 1 addition & 1 deletion doc/models/order-line-item-tax.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contributes to the order subtotal.
| `catalog_version` | `Integer` | Optional | The version of the catalog object that this tax references. |
| `name` | `String` | Optional | The tax's name.<br>**Constraints**: *Maximum Length*: `255` |
| `type` | [`String (Order Line Item Tax Type)`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. |
| `percentage` | `String` | Optional | The percentage of the tax, as a string representation of a decimal<br>number. For example, a value of `"7.25"` corresponds to a percentage of<br>7.25%.<br><br>Either `percentage` or `amount_money` should be set, but not both.<br>**Constraints**: *Maximum Length*: `10` |
| `percentage` | `String` | Optional | The percentage of the tax, as a string representation of a decimal<br>number. For example, a value of `"7.25"` corresponds to a percentage of<br>7.25%.<br>**Constraints**: *Maximum Length*: `10` |
| `metadata` | `Hash[String, String]` | Optional | Application-defined data attached to this tax. Metadata fields are intended<br>to store descriptive references or associations with an entity in another system or store brief<br>information about the object. Square does not process this field; it only stores and returns it<br>in relevant API calls. Do not use metadata to store any sensitive information (such as personally<br>identifiable information or card details).<br><br>Keys written by applications must be 60 characters or less and must be in the character set<br>`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed<br>with a namespace, separated from the key with a ':' character.<br><br>Values have a maximum length of 255 characters.<br><br>An application can have up to 10 entries per metadata field.<br><br>Entries written by applications are private and can only be read or modified by the same<br>application.<br><br>For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). |
| `applied_money` | [`Money Hash`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. |
| `scope` | [`String (Order Line Item Tax Scope)`](../../doc/models/order-line-item-tax-scope.md) | Optional | Indicates whether this is a line-item or order-level tax. |
Expand Down
4 changes: 2 additions & 2 deletions doc/models/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ itemization data.
| `tenders` | [`Array<Tender Hash>`](../../doc/models/tender.md) | Optional | The tenders that were used to pay for the order. |
| `refunds` | [`Array<Refund Hash>`](../../doc/models/refund.md) | Optional | The refunds that are part of this order. |
| `metadata` | `Hash[String, String]` | Optional | Application-defined data attached to this order. Metadata fields are intended<br>to store descriptive references or associations with an entity in another system or store brief<br>information about the object. Square does not process this field; it only stores and returns it<br>in relevant API calls. Do not use metadata to store any sensitive information (such as personally<br>identifiable information or card details).<br><br>Keys written by applications must be 60 characters or less and must be in the character set<br>`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed<br>with a namespace, separated from the key with a ':' character.<br><br>Values have a maximum length of 255 characters.<br><br>An application can have up to 10 entries per metadata field.<br><br>Entries written by applications are private and can only be read or modified by the same<br>application.<br><br>For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). |
| `created_at` | `String` | Optional | The timestamp for when the order was created, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). |
| `updated_at` | `String` | Optional | The timestamp for when the order was last updated, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). |
| `created_at` | `String` | Optional | The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). |
| `updated_at` | `String` | Optional | The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). |
| `closed_at` | `String` | Optional | The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). |
| `state` | [`String (Order State)`](../../doc/models/order-state.md) | Optional | The state of the order. |
| `version` | `Integer` | Optional | The version number, which is incremented each time an update is committed to the order.<br>Orders not created through the API do not include a version number and<br>therefore cannot be updated.<br><br>[Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). |
Expand Down
21 changes: 0 additions & 21 deletions doc/models/renew-token-request.md

This file was deleted.

31 changes: 0 additions & 31 deletions doc/models/renew-token-response.md

This file was deleted.

2 changes: 1 addition & 1 deletion lib/square/api/base_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class BaseApi
attr_accessor :config, :http_call_back

def self.user_agent
'Square-Ruby-SDK/36.1.0.20240320 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
'Square-Ruby-SDK/37.0.0.20240417 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
end

def self.user_agent_parameters
Expand Down
52 changes: 0 additions & 52 deletions lib/square/api/o_auth_api.rb
Original file line number Diff line number Diff line change
@@ -1,58 +1,6 @@
module Square
# OAuthApi
class OAuthApi < BaseApi
# `RenewToken` is deprecated. For information about refreshing OAuth access
# tokens, see
# [Migrate from Renew to Refresh OAuth
# Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-t
# okens).
# Renews an OAuth access token before it expires.
# OAuth access tokens besides your application's personal access token
# expire after 30 days.
# You can also renew expired tokens within 15 days of their expiration.
# You cannot renew an access token that has been expired for more than 15
# days.
# Instead, the associated user must recomplete the OAuth flow from the
# beginning.
# __Important:__ The `Authorization` header for this endpoint must have the
# following format:
# ```
# Authorization: Client APPLICATION_SECRET
# ```
# Replace `APPLICATION_SECRET` with the application secret on the
# **Credentials**
# page in the [Developer Dashboard](https://developer.squareup.com/apps).
# @param [String] client_id Required parameter: Your application ID, which
# is available on the **OAuth** page in the [Developer
# Dashboard](https://developer.squareup.com/apps).
# @param [RenewTokenRequest] body Required parameter: An object containing
# the fields to POST for the request. See the corresponding object
# definition for field details.
# @param [String] authorization Required parameter: Client
# APPLICATION_SECRET
# @return [RenewTokenResponse Hash] response from the API call
def renew_token(client_id:,
body:,
authorization:)
warn 'Endpoint renew_token in OAuthApi is deprecated'
new_api_call_builder
.request(new_request_builder(HttpMethodEnum::POST,
'/oauth2/clients/{client_id}/access-token/renew',
'default')
.template_param(new_parameter(client_id, key: 'client_id')
.should_encode(true))
.header_param(new_parameter('application/json', key: 'Content-Type'))
.body_param(new_parameter(body))
.header_param(new_parameter(authorization, key: 'Authorization'))
.header_param(new_parameter('application/json', key: 'accept'))
.body_serializer(proc do |param| param.to_json unless param.nil? end))
.response(new_response_handler
.deserializer(APIHelper.method(:json_deserialize))
.is_api_response(true)
.convertor(ApiResponse.method(:create)))
.execute
end

# Revokes an access token generated with the OAuth flow.
# If an account has more than one OAuth access token for your application,
# this
Expand Down
4 changes: 2 additions & 2 deletions lib/square/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Client
attr_reader :config, :auth_managers

def sdk_version
'36.1.0.20240320'
'37.0.0.20240417'
end

def square_version
Expand Down Expand Up @@ -268,7 +268,7 @@ def initialize(
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
retry_methods: %i[get put], http_callback: nil, environment: 'production',
custom_url: 'https://connect.squareup.com', access_token: nil,
bearer_auth_credentials: nil, square_version: '2024-03-20',
bearer_auth_credentials: nil, square_version: '2024-04-17',
user_agent_detail: '', additional_headers: {}, config: nil
)
@config = if config.nil?
Expand Down
2 changes: 1 addition & 1 deletion lib/square/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
retry_methods: %i[get put], http_callback: nil, environment: 'production',
custom_url: 'https://connect.squareup.com', access_token: nil,
bearer_auth_credentials: nil, square_version: '2024-03-20',
bearer_auth_credentials: nil, square_version: '2024-04-17',
user_agent_detail: '', additional_headers: {}
)

Expand Down
2 changes: 1 addition & 1 deletion square.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'square.rb'
s.version = '36.1.0.20240320'
s.version = '37.0.0.20240417'
s.summary = 'square'
s.description = ''
s.authors = ['Square Developer Platform']
Expand Down

0 comments on commit 527432c

Please sign in to comment.