Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit 4e2601f

Browse files
authored
Release 2.20180712.2 (#45)
1 parent 19780e2 commit 4e2601f

26 files changed

+2151
-3
lines changed

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## Version 2.20180712.2 (2018-08-21)
4+
5+
The Connect SDK now includes functionality for the OAuth API. The Square OAuth API lets applications request and obtain permission from a Square account to make API calls on behalf of that account. Applications can request individual permissions so that users do not need to grant full access to their Square accounts.
6+
7+
### OAuth API
8+
9+
* `ObtainToken` endpoint — Exchanges the authorization code for an access token. After a merchant authorizes your application with the permissions form, an authorization code is sent to the application's redirect URL (See [Implementing OAuth](https://docs.connect.squareup.com/api/oauth#implementingoauth) for information about how to set up the redirect URL).
10+
11+
* `RenewToken` endpoint — 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 merchant must complete the [OAuth flow](https://docs.connect.squareup.com/api/oauth#implementingoauth) from the beginning. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).
12+
* `RevokeToken` endpoint — Revokes an access token generated with the OAuth flow. If a merchant has more than one access token for your application, this endpoint revokes all of them, regardless of which token you specify. If you revoke a merchant's access token, all of the merchant's active subscriptions associated with your application are canceled immediately. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).
13+
314
## Version 2.20180712.1 (2018-08-02)
415

516
We have added MobileAuthorization API.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ for the specification and template files we used to generate this.
1010
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
1111

1212
- API version: 2.0
13-
- Package version: 2.20180712.1
13+
- Package version: 2.20180712.2
1414
- Build package: io.swagger.codegen.languages.RubyClientCodegen
1515

1616
For more information, please visit [https://squareup.com/developers](https://squareup.com/developers)
@@ -96,6 +96,9 @@ Class | Method | HTTP request | Description
9696
*SquareConnect::CustomersApi* | [**update_customer**](docs/CustomersApi.md#update_customer) | **PUT** /v2/customers/{customer_id} | UpdateCustomer
9797
*SquareConnect::LocationsApi* | [**list_locations**](docs/LocationsApi.md#list_locations) | **GET** /v2/locations | ListLocations
9898
*SquareConnect::MobileAuthorizationApi* | [**create_mobile_authorization_code**](docs/MobileAuthorizationApi.md#create_mobile_authorization_code) | **POST** /mobile/authorization-code | CreateMobileAuthorizationCode
99+
*SquareConnect::OAuthApi* | [**obtain_token**](docs/OAuthApi.md#obtain_token) | **POST** /oauth2/token | ObtainToken
100+
*SquareConnect::OAuthApi* | [**renew_token**](docs/OAuthApi.md#renew_token) | **POST** /oauth2/clients/{client_id}/access-token/renew | RenewToken
101+
*SquareConnect::OAuthApi* | [**revoke_token**](docs/OAuthApi.md#revoke_token) | **POST** /oauth2/revoke | RevokeToken
99102
*SquareConnect::OrdersApi* | [**batch_retrieve_orders**](docs/OrdersApi.md#batch_retrieve_orders) | **POST** /v2/locations/{location_id}/orders/batch-retrieve | BatchRetrieveOrders
100103
*SquareConnect::OrdersApi* | [**create_order**](docs/OrdersApi.md#create_order) | **POST** /v2/locations/{location_id}/orders | CreateOrder
101104
*SquareConnect::ReportingApi* | [**list_additional_recipient_receivable_refunds**](docs/ReportingApi.md#list_additional_recipient_receivable_refunds) | **GET** /v2/locations/{location_id}/additional-recipient-receivable-refunds | ListAdditionalRecipientReceivableRefunds
@@ -288,6 +291,8 @@ Class | Method | HTTP request | Description
288291
- [SquareConnect::LocationStatus](docs/LocationStatus.md)
289292
- [SquareConnect::LocationType](docs/LocationType.md)
290293
- [SquareConnect::Money](docs/Money.md)
294+
- [SquareConnect::ObtainTokenRequest](docs/ObtainTokenRequest.md)
295+
- [SquareConnect::ObtainTokenResponse](docs/ObtainTokenResponse.md)
291296
- [SquareConnect::Order](docs/Order.md)
292297
- [SquareConnect::OrderLineItem](docs/OrderLineItem.md)
293298
- [SquareConnect::OrderLineItemDiscount](docs/OrderLineItemDiscount.md)
@@ -301,12 +306,16 @@ Class | Method | HTTP request | Description
301306
- [SquareConnect::RegisterDomainRequest](docs/RegisterDomainRequest.md)
302307
- [SquareConnect::RegisterDomainResponse](docs/RegisterDomainResponse.md)
303308
- [SquareConnect::RegisterDomainResponseStatus](docs/RegisterDomainResponseStatus.md)
309+
- [SquareConnect::RenewTokenRequest](docs/RenewTokenRequest.md)
310+
- [SquareConnect::RenewTokenResponse](docs/RenewTokenResponse.md)
304311
- [SquareConnect::RetrieveCatalogObjectRequest](docs/RetrieveCatalogObjectRequest.md)
305312
- [SquareConnect::RetrieveCatalogObjectResponse](docs/RetrieveCatalogObjectResponse.md)
306313
- [SquareConnect::RetrieveCustomerRequest](docs/RetrieveCustomerRequest.md)
307314
- [SquareConnect::RetrieveCustomerResponse](docs/RetrieveCustomerResponse.md)
308315
- [SquareConnect::RetrieveTransactionRequest](docs/RetrieveTransactionRequest.md)
309316
- [SquareConnect::RetrieveTransactionResponse](docs/RetrieveTransactionResponse.md)
317+
- [SquareConnect::RevokeTokenRequest](docs/RevokeTokenRequest.md)
318+
- [SquareConnect::RevokeTokenResponse](docs/RevokeTokenResponse.md)
310319
- [SquareConnect::SearchCatalogObjectsRequest](docs/SearchCatalogObjectsRequest.md)
311320
- [SquareConnect::SearchCatalogObjectsResponse](docs/SearchCatalogObjectsResponse.md)
312321
- [SquareConnect::SearchCustomersRequest](docs/SearchCustomersRequest.md)

docs/OAuthApi.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# SquareConnect::OAuthApi
2+
3+
All URIs are relative to *https://connect.squareup.com*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**obtain_token**](OAuthApi.md#obtain_token) | **POST** /oauth2/token | ObtainToken
8+
[**renew_token**](OAuthApi.md#renew_token) | **POST** /oauth2/clients/{client_id}/access-token/renew | RenewToken
9+
[**revoke_token**](OAuthApi.md#revoke_token) | **POST** /oauth2/revoke | RevokeToken
10+
11+
12+
# **obtain_token**
13+
> ObtainTokenResponse obtain_token(body)
14+
15+
ObtainToken
16+
17+
Exchanges the authorization code for an access token. After a merchant authorizes your application with the permissions form, an authorization code is sent to the application's redirect URL (See [Implementing OAuth](https://docs.connect.squareup.com/api/oauth#implementingoauth) for information about how to set up the redirect URL).
18+
19+
### Example
20+
```ruby
21+
# load the gem
22+
require 'square_connect'
23+
24+
api_instance = SquareConnect::OAuthApi.new
25+
26+
body = SquareConnect::ObtainTokenRequest.new # ObtainTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
27+
28+
29+
begin
30+
#ObtainToken
31+
result = api_instance.obtain_token(body)
32+
p result
33+
rescue SquareConnect::ApiError => e
34+
puts "Exception when calling OAuthApi->obtain_token: #{e}"
35+
end
36+
```
37+
38+
### Parameters
39+
40+
Name | Type | Description | Notes
41+
------------- | ------------- | ------------- | -------------
42+
**body** | [**ObtainTokenRequest**](ObtainTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |
43+
44+
### Return type
45+
46+
[**ObtainTokenResponse**](ObtainTokenResponse.md)
47+
48+
### Authorization
49+
50+
No authorization required
51+
52+
### HTTP request headers
53+
54+
- **Content-Type**: application/json
55+
- **Accept**: application/json
56+
57+
58+
59+
# **renew_token**
60+
> RenewTokenResponse renew_token(client_id, body)
61+
62+
RenewToken
63+
64+
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 merchant must complete the [OAuth flow](https://docs.connect.squareup.com/api/oauth#implementingoauth) from the beginning. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).
65+
66+
### Example
67+
```ruby
68+
# load the gem
69+
require 'square_connect'
70+
# setup authorization
71+
SquareConnect.configure do |config|
72+
# Configure API key authorization: oauth2ClientSecret
73+
config.api_key['Authorization'] = 'YOUR API KEY'
74+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
75+
#config.api_key_prefix['Authorization'] = 'Bearer'
76+
end
77+
78+
api_instance = SquareConnect::OAuthApi.new
79+
80+
client_id = "client_id_example" # String | Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps).
81+
82+
body = SquareConnect::RenewTokenRequest.new # RenewTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
83+
84+
85+
begin
86+
#RenewToken
87+
result = api_instance.renew_token(client_id, body)
88+
p result
89+
rescue SquareConnect::ApiError => e
90+
puts "Exception when calling OAuthApi->renew_token: #{e}"
91+
end
92+
```
93+
94+
### Parameters
95+
96+
Name | Type | Description | Notes
97+
------------- | ------------- | ------------- | -------------
98+
**client_id** | **String**| Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps). |
99+
**body** | [**RenewTokenRequest**](RenewTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |
100+
101+
### Return type
102+
103+
[**RenewTokenResponse**](RenewTokenResponse.md)
104+
105+
### Authorization
106+
107+
[oauth2ClientSecret](../README.md#oauth2ClientSecret)
108+
109+
### HTTP request headers
110+
111+
- **Content-Type**: application/json
112+
- **Accept**: application/json
113+
114+
115+
116+
# **revoke_token**
117+
> RevokeTokenResponse revoke_token(body)
118+
119+
RevokeToken
120+
121+
Revokes an access token generated with the OAuth flow. If a merchant has more than one access token for your application, this endpoint revokes all of them, regardless of which token you specify. If you revoke a merchant's access token, all of the merchant's active subscriptions associated with your application are canceled immediately. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).
122+
123+
### Example
124+
```ruby
125+
# load the gem
126+
require 'square_connect'
127+
# setup authorization
128+
SquareConnect.configure do |config|
129+
# Configure API key authorization: oauth2ClientSecret
130+
config.api_key['Authorization'] = 'YOUR API KEY'
131+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
132+
#config.api_key_prefix['Authorization'] = 'Bearer'
133+
end
134+
135+
api_instance = SquareConnect::OAuthApi.new
136+
137+
body = SquareConnect::RevokeTokenRequest.new # RevokeTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
138+
139+
140+
begin
141+
#RevokeToken
142+
result = api_instance.revoke_token(body)
143+
p result
144+
rescue SquareConnect::ApiError => e
145+
puts "Exception when calling OAuthApi->revoke_token: #{e}"
146+
end
147+
```
148+
149+
### Parameters
150+
151+
Name | Type | Description | Notes
152+
------------- | ------------- | ------------- | -------------
153+
**body** | [**RevokeTokenRequest**](RevokeTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |
154+
155+
### Return type
156+
157+
[**RevokeTokenResponse**](RevokeTokenResponse.md)
158+
159+
### Authorization
160+
161+
[oauth2ClientSecret](../README.md#oauth2ClientSecret)
162+
163+
### HTTP request headers
164+
165+
- **Content-Type**: application/json
166+
- **Accept**: application/json
167+
168+
169+

docs/ObtainTokenRequest.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SquareConnect::ObtainTokenRequest
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**client_id** | **String** | Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
11+
**client_secret** | **String** | Your application's secret, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
12+
**code** | **String** | The authorization code to exchange. | [optional]
13+
**redirect_uri** | **String** | The redirect URL assigned in the [application dashboard](https://connect.squareup.com/apps). | [optional]
14+
15+

docs/ObtainTokenResponse.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SquareConnect::ObtainTokenResponse
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**access_token** | **String** | Your application's access token. You provide this token in a header with every request to Connect API endpoints. See [Request and response headers](https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders) for the format of this header. | [optional]
11+
**token_type** | **String** | This value is always _bearer_. | [optional]
12+
**expires_at** | **String** | The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. | [optional]
13+
**merchant_id** | **String** | The ID of the authorizing merchant's business. | [optional]
14+
**subscription_id** | **String** | The ID of the merchant [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) associated with the authorization. Only present if the merchant signed up for a subscription during authorization. | [optional]
15+
**plan_id** | **String** | The ID of the [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization. | [optional]
16+
**id_token** | **String** | Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request. | [optional]
17+
18+

docs/RenewTokenRequest.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SquareConnect::RenewTokenRequest
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**access_token** | **String** | The token you want to renew. | [optional]
11+
12+

docs/RenewTokenResponse.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SquareConnect::RenewTokenResponse
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**access_token** | **String** | The renewed access token. This value might be different from the `access_token` you provided in your request. You provide this token in a header with every request to Connect API endpoints. See [Request and response headers](https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders) for the format of this header. | [optional]
11+
**token_type** | **String** | This value is always _bearer_. | [optional]
12+
**expires_at** | **String** | The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. | [optional]
13+
**merchant_id** | **String** | The ID of the authorizing merchant's business. | [optional]
14+
**subscription_id** | **String** | The ID of the merchant [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) associated with the authorization. Only present if the merchant signed up for a subscription during authorization. | [optional]
15+
**plan_id** | **String** | The ID of the [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization. | [optional]
16+
17+

docs/RevokeTokenRequest.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SquareConnect::RevokeTokenRequest
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**client_id** | **String** | Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
11+
**access_token** | **String** | The access token of the merchant whose token you want to revoke. Do not provide a value for merchant_id if you provide this parameter. | [optional]
12+
**merchant_id** | **String** | The ID of the merchant whose token you want to revoke. Do not provide a value for access_token if you provide this parameter. | [optional]
13+
14+

docs/RevokeTokenResponse.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SquareConnect::RevokeTokenResponse
2+
3+
### Description
4+
5+
6+
7+
## Properties
8+
Name | Type | Description | Notes
9+
------------ | ------------- | ------------- | -------------
10+
**success** | **BOOLEAN** | If the request is successful, this is true. | [optional]
11+
12+

lib/square_connect.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
require 'square_connect/models/location_status'
123123
require 'square_connect/models/location_type'
124124
require 'square_connect/models/money'
125+
require 'square_connect/models/obtain_token_request'
126+
require 'square_connect/models/obtain_token_response'
125127
require 'square_connect/models/order'
126128
require 'square_connect/models/order_line_item'
127129
require 'square_connect/models/order_line_item_discount'
@@ -135,12 +137,16 @@
135137
require 'square_connect/models/register_domain_request'
136138
require 'square_connect/models/register_domain_response'
137139
require 'square_connect/models/register_domain_response_status'
140+
require 'square_connect/models/renew_token_request'
141+
require 'square_connect/models/renew_token_response'
138142
require 'square_connect/models/retrieve_catalog_object_request'
139143
require 'square_connect/models/retrieve_catalog_object_response'
140144
require 'square_connect/models/retrieve_customer_request'
141145
require 'square_connect/models/retrieve_customer_response'
142146
require 'square_connect/models/retrieve_transaction_request'
143147
require 'square_connect/models/retrieve_transaction_response'
148+
require 'square_connect/models/revoke_token_request'
149+
require 'square_connect/models/revoke_token_response'
144150
require 'square_connect/models/search_catalog_objects_request'
145151
require 'square_connect/models/search_catalog_objects_response'
146152
require 'square_connect/models/search_customers_request'
@@ -214,6 +220,7 @@
214220
require 'square_connect/api/customers_api'
215221
require 'square_connect/api/locations_api'
216222
require 'square_connect/api/mobile_authorization_api'
223+
require 'square_connect/api/o_auth_api'
217224
require 'square_connect/api/orders_api'
218225
require 'square_connect/api/reporting_api'
219226
require 'square_connect/api/transactions_api'

0 commit comments

Comments
 (0)