Skip to content

Commit d10e738

Browse files
feat(ruby): add .fernignore and rename to legacy client (#156)
* feat(ruby): add .fernignore and rename to legacy client * patch test --------- Co-authored-by: Deep Singhvi <[email protected]>
1 parent 4fbec84 commit d10e738

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+901
-812
lines changed

.fernignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib/square_legacy/
2+
lib/square_legacy.rb

CHANGELOG.md

Lines changed: 672 additions & 576 deletions
Large diffs are not rendered by default.

doc/auth/oauth-2-bearer-token.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
21
# OAuth 2 Bearer token
32

4-
5-
63
Documentation for accessing and setting credentials for global.
74

85
## Auth Credentials
96

10-
| Name | Type | Description | Getter |
11-
| --- | --- | --- | --- |
7+
| Name | Type | Description | Getter |
8+
| ----------- | -------- | --------------------------------------------------- | -------------- |
129
| AccessToken | `String` | The OAuth 2.0 Access Token to use for API requests. | `access_token` |
1310

14-
15-
1611
**Note:** Auth credentials can be set using named parameter for any of the above credentials (e.g. `access_token`) in the client initialization.
1712

1813
## Usage Example
@@ -22,11 +17,9 @@ Documentation for accessing and setting credentials for global.
2217
You must provide credentials in the client as shown in the following code snippet.
2318

2419
```ruby
25-
client = Square::Client.new(
20+
client = SquareLegacy::Client.new(
2621
bearer_auth_credentials: BearerAuthCredentials.new(
2722
access_token: 'AccessToken'
2823
)
2924
)
3025
```
31-
32-

doc/client.md

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
21
# Client Class Documentation
32

43
The following parameters are configurable for the API Client:
54

6-
| Parameter | Type | Description |
7-
| --- | --- | --- |
8-
| `square_version` | `String` | Square Connect API versions<br>*Default*: `'2025-07-16'` |
9-
| `custom_url` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
10-
| `environment` | `string` | The API environment. <br> **Default: `production`** |
11-
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
12-
| `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
13-
| `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
14-
| `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
15-
| `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
16-
| `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
17-
| `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
18-
| `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
19-
| `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
20-
| `user_agent_detail` | `string` | User agent detail, to be appended with user-agent header. |
21-
| `additional_headers` | `String` | Additional headers to add to each API request |
22-
| `bearer_auth_credentials` | [`BearerAuthCredentials`](auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
5+
| Parameter | Type | Description |
6+
| ------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
7+
| `square_version` | `String` | Square Connect API versions<br>_Default_: `'2025-07-16'` |
8+
| `custom_url` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>_Default_: `'https://connect.squareup.com'` |
9+
| `environment` | `string` | The API environment. <br> **Default: `production`** |
10+
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
11+
| `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
12+
| `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
13+
| `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
14+
| `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
15+
| `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
16+
| `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
17+
| `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
18+
| `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
19+
| `user_agent_detail` | `string` | User agent detail, to be appended with user-agent header. |
20+
| `additional_headers` | `String` | Additional headers to add to each API request |
21+
| `bearer_auth_credentials` | [`BearerAuthCredentials`](auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
2322

2423
The API client can be initialized as follows:
2524

2625
```ruby
27-
client = Square::Client.new(
26+
client = SquareLegacy::Client.new(
2827
square_version: '2025-06-18',
2928
bearer_auth_credentials: BearerAuthCredentials.new(
3029
access_token: 'AccessToken'
@@ -36,25 +35,25 @@ client = Square::Client.new(
3635

3736
API calls return an `ApiResponse` object that includes the following fields:
3837

39-
| Field | Description |
40-
| --- | --- |
41-
| `status_code` | Status code of the HTTP response |
42-
| `reason_phrase` | Reason phrase of the HTTP response |
43-
| `headers` | Headers of the HTTP response as a Hash |
44-
| `raw_body` | The body of the HTTP response as a String |
45-
| `request` | HTTP request info |
46-
| `errors` | Errors, if they exist |
47-
| `cursor` | Cursor, if it exists |
48-
| `body` | The deserialized body of the HTTP response |
49-
| `data` | Data portion of returned body |
38+
| Field | Description |
39+
| --------------- | ------------------------------------------ |
40+
| `status_code` | Status code of the HTTP response |
41+
| `reason_phrase` | Reason phrase of the HTTP response |
42+
| `headers` | Headers of the HTTP response as a Hash |
43+
| `raw_body` | The body of the HTTP response as a String |
44+
| `request` | HTTP request info |
45+
| `errors` | Errors, if they exist |
46+
| `cursor` | Cursor, if it exists |
47+
| `body` | The deserialized body of the HTTP response |
48+
| `data` | Data portion of returned body |
5049

5150
## Make Calls with the API Client
5251

5352
```ruby
54-
require 'square'
53+
require 'square_legacy'
5554
include Square
5655

57-
client = Square::Client.new(
56+
client = SquareLegacy::Client.new(
5857
square_version: '2025-06-18',
5958
bearer_auth_credentials: BearerAuthCredentials.new(
6059
access_token: 'AccessToken'
@@ -78,48 +77,47 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
7877

7978
## API
8079

81-
| Name | Description |
82-
| --- | --- |
83-
| mobile_authorization | Gets MobileAuthorizationApi |
84-
| o_auth | Gets OAuthApi |
85-
| v1_transactions | Gets V1TransactionsApi |
86-
| apple_pay | Gets ApplePayApi |
87-
| bank_accounts | Gets BankAccountsApi |
88-
| bookings | Gets BookingsApi |
89-
| booking_custom_attributes | Gets BookingCustomAttributesApi |
90-
| cards | Gets CardsApi |
91-
| cash_drawers | Gets CashDrawersApi |
92-
| catalog | Gets CatalogApi |
93-
| customers | Gets CustomersApi |
80+
| Name | Description |
81+
| -------------------------- | -------------------------------- |
82+
| mobile_authorization | Gets MobileAuthorizationApi |
83+
| o_auth | Gets OAuthApi |
84+
| v1_transactions | Gets V1TransactionsApi |
85+
| apple_pay | Gets ApplePayApi |
86+
| bank_accounts | Gets BankAccountsApi |
87+
| bookings | Gets BookingsApi |
88+
| booking_custom_attributes | Gets BookingCustomAttributesApi |
89+
| cards | Gets CardsApi |
90+
| cash_drawers | Gets CashDrawersApi |
91+
| catalog | Gets CatalogApi |
92+
| customers | Gets CustomersApi |
9493
| customer_custom_attributes | Gets CustomerCustomAttributesApi |
95-
| customer_groups | Gets CustomerGroupsApi |
96-
| customer_segments | Gets CustomerSegmentsApi |
97-
| devices | Gets DevicesApi |
98-
| disputes | Gets DisputesApi |
99-
| employees | Gets EmployeesApi |
100-
| events | Gets EventsApi |
101-
| gift_cards | Gets GiftCardsApi |
102-
| gift_card_activities | Gets GiftCardActivitiesApi |
103-
| inventory | Gets InventoryApi |
104-
| invoices | Gets InvoicesApi |
105-
| labor | Gets LaborApi |
106-
| locations | Gets LocationsApi |
94+
| customer_groups | Gets CustomerGroupsApi |
95+
| customer_segments | Gets CustomerSegmentsApi |
96+
| devices | Gets DevicesApi |
97+
| disputes | Gets DisputesApi |
98+
| employees | Gets EmployeesApi |
99+
| events | Gets EventsApi |
100+
| gift_cards | Gets GiftCardsApi |
101+
| gift_card_activities | Gets GiftCardActivitiesApi |
102+
| inventory | Gets InventoryApi |
103+
| invoices | Gets InvoicesApi |
104+
| labor | Gets LaborApi |
105+
| locations | Gets LocationsApi |
107106
| location_custom_attributes | Gets LocationCustomAttributesApi |
108-
| checkout | Gets CheckoutApi |
109-
| transactions | Gets TransactionsApi |
110-
| loyalty | Gets LoyaltyApi |
111-
| merchants | Gets MerchantsApi |
107+
| checkout | Gets CheckoutApi |
108+
| transactions | Gets TransactionsApi |
109+
| loyalty | Gets LoyaltyApi |
110+
| merchants | Gets MerchantsApi |
112111
| merchant_custom_attributes | Gets MerchantCustomAttributesApi |
113-
| orders | Gets OrdersApi |
114-
| order_custom_attributes | Gets OrderCustomAttributesApi |
115-
| payments | Gets PaymentsApi |
116-
| payouts | Gets PayoutsApi |
117-
| refunds | Gets RefundsApi |
118-
| sites | Gets SitesApi |
119-
| snippets | Gets SnippetsApi |
120-
| subscriptions | Gets SubscriptionsApi |
121-
| team | Gets TeamApi |
122-
| terminal | Gets TerminalApi |
123-
| vendors | Gets VendorsApi |
124-
| webhook_subscriptions | Gets WebhookSubscriptionsApi |
125-
112+
| orders | Gets OrdersApi |
113+
| order_custom_attributes | Gets OrderCustomAttributesApi |
114+
| payments | Gets PaymentsApi |
115+
| payouts | Gets PayoutsApi |
116+
| refunds | Gets RefundsApi |
117+
| sites | Gets SitesApi |
118+
| snippets | Gets SnippetsApi |
119+
| subscriptions | Gets SubscriptionsApi |
120+
| team | Gets TeamApi |
121+
| terminal | Gets TerminalApi |
122+
| vendors | Gets VendorsApi |
123+
| webhook_subscriptions | Gets WebhookSubscriptionsApi |

examples/customers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
require 'square'
1+
require 'square_legacy'
22

33
# Initialize Square Client
4-
square = Square::Client.new(
4+
square = SquareLegacy::Client.new(
55
access_token: 'ACCESS_TOKEN'
66
)
77

lib/square.rb

Lines changed: 0 additions & 76 deletions
This file was deleted.

lib/square_legacy.rb

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
require 'date'
2+
require 'json'
3+
4+
require 'apimatic_core_interfaces'
5+
require 'apimatic_core'
6+
require 'apimatic_faraday_client_adapter'
7+
8+
require_relative 'square_legacy/api_helper'
9+
require_relative 'square_legacy/client'
10+
11+
# Utilities
12+
require_relative 'square_legacy/utilities/file_wrapper'
13+
require_relative 'square_legacy/utilities/date_time_helper'
14+
15+
# Http
16+
require_relative 'square_legacy/http/api_response'
17+
require_relative 'square_legacy/http/http_call_back'
18+
require_relative 'square_legacy/http/http_method_enum'
19+
require_relative 'square_legacy/http/http_request'
20+
require_relative 'square_legacy/http/http_response'
21+
22+
# Logger
23+
require_relative 'square_legacy/http/auth/o_auth2'
24+
25+
# Models
26+
27+
# Exceptions
28+
require_relative 'square_legacy/exceptions/api_exception'
29+
30+
require_relative 'square_legacy/configuration'
31+
32+
# Controllers
33+
require_relative 'square_legacy/api/base_api'
34+
require_relative 'square_legacy/api/mobile_authorization_api'
35+
require_relative 'square_legacy/api/o_auth_api'
36+
require_relative 'square_legacy/api/v1_transactions_api'
37+
require_relative 'square_legacy/api/apple_pay_api'
38+
require_relative 'square_legacy/api/bank_accounts_api'
39+
require_relative 'square_legacy/api/bookings_api'
40+
require_relative 'square_legacy/api/booking_custom_attributes_api'
41+
require_relative 'square_legacy/api/cards_api'
42+
require_relative 'square_legacy/api/cash_drawers_api'
43+
require_relative 'square_legacy/api/catalog_api'
44+
require_relative 'square_legacy/api/customers_api'
45+
require_relative 'square_legacy/api/customer_custom_attributes_api'
46+
require_relative 'square_legacy/api/customer_groups_api'
47+
require_relative 'square_legacy/api/customer_segments_api'
48+
require_relative 'square_legacy/api/devices_api'
49+
require_relative 'square_legacy/api/disputes_api'
50+
require_relative 'square_legacy/api/employees_api'
51+
require_relative 'square_legacy/api/events_api'
52+
require_relative 'square_legacy/api/gift_cards_api'
53+
require_relative 'square_legacy/api/gift_card_activities_api'
54+
require_relative 'square_legacy/api/inventory_api'
55+
require_relative 'square_legacy/api/invoices_api'
56+
require_relative 'square_legacy/api/labor_api'
57+
require_relative 'square_legacy/api/locations_api'
58+
require_relative 'square_legacy/api/location_custom_attributes_api'
59+
require_relative 'square_legacy/api/checkout_api'
60+
require_relative 'square_legacy/api/transactions_api'
61+
require_relative 'square_legacy/api/loyalty_api'
62+
require_relative 'square_legacy/api/merchants_api'
63+
require_relative 'square_legacy/api/merchant_custom_attributes_api'
64+
require_relative 'square_legacy/api/orders_api'
65+
require_relative 'square_legacy/api/order_custom_attributes_api'
66+
require_relative 'square_legacy/api/payments_api'
67+
require_relative 'square_legacy/api/payouts_api'
68+
require_relative 'square_legacy/api/refunds_api'
69+
require_relative 'square_legacy/api/sites_api'
70+
require_relative 'square_legacy/api/snippets_api'
71+
require_relative 'square_legacy/api/subscriptions_api'
72+
require_relative 'square_legacy/api/team_api'
73+
require_relative 'square_legacy/api/terminal_api'
74+
require_relative 'square_legacy/api/vendors_api'
75+
require_relative 'square_legacy/api/webhook_subscriptions_api'
76+
require_relative 'square_legacy/utilities/webhooks_helper'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Square
1+
module SquareLegacy
22
# ApplePayApi
33
class ApplePayApi < BaseApi
44
# Activates a domain for use with Apple Pay on the Web and Square. A

lib/square/api/bank_accounts_api.rb renamed to lib/square_legacy/api/bank_accounts_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Square
1+
module SquareLegacy
22
# BankAccountsApi
33
class BankAccountsApi < BaseApi
44
# Returns a list of [BankAccount]($m/BankAccount) objects linked to a Square
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Square
1+
module SquareLegacy
22
# BaseApi.
33
class BaseApi
44
include CoreLibrary

0 commit comments

Comments
 (0)