{"id":13483963,"url":"https://github.com/square/connect-ruby-sdk","last_synced_at":"2025-03-27T15:30:51.422Z","repository":{"id":59156192,"uuid":"54598346","full_name":"square/connect-ruby-sdk","owner":"square","description":"Ruby client library for the Square Connect APIs","archived":true,"fork":false,"pushed_at":"2019-08-15T17:43:51.000Z","size":1671,"stargazers_count":40,"open_issues_count":1,"forks_count":24,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-03-20T17:11:32.834Z","etag":null,"topics":["deprecated"],"latest_commit_sha":null,"homepage":"https://docs.connect.squareup.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/square.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-23T22:49:23.000Z","updated_at":"2024-12-10T06:42:22.000Z","dependencies_parsed_at":"2022-09-13T17:52:19.823Z","dependency_job_id":null,"html_url":"https://github.com/square/connect-ruby-sdk","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-ruby-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-ruby-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-ruby-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-ruby-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/square","download_url":"https://codeload.github.com/square/connect-ruby-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245871714,"owners_count":20686251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deprecated"],"created_at":"2024-07-31T17:01:17.329Z","updated_at":"2025-03-27T15:30:48.777Z","avatar_url":"https://github.com/square.png","language":"Ruby","readme":"![Square logo]\n\n# Square Connect Ruby SDK - RETIRED\n\n---\n\n[![Build Status](https://travis-ci.org/square/connect-ruby-sdk.svg?branch=master)](https://travis-ci.org/square/connect-ruby-sdk)\n[![Gem Version](https://badge.fury.io/rb/square_connect.svg)](https://badge.fury.io/rb/square_connect)\n[![Apache-2 license](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n==================\n\n## NOTICE: Square Connect Ruby SDK retired\n\nThe Square Connect Ruby SDK is retired (EOL) as of 2019-08-15 and will no longer\nreceive bug fixes or product updates. To continue receiving API and SDK\nimprovements, please follow the instructions below to migrate to the new\n[Square Ruby SDK gem].\n\n\nThe old Connect SDK documentation is available under the\n[`/docs` folder](./docs/README.md).\n\n\u003cbr/\u003e\n\n---\n\n* [Migrate to the Square Ruby SDK](#migrate-to-the-square-ruby-sdk)\n  * [Update your bundle](#update-your-bundle)\n  * [Update your code](#update-your-code)\n* [Example code migration](#example-code-migration)\n* [Ask the Community](#ask-the-community)\n\n---\n\n\u003cbr/\u003e\n\n## Migrate to the Square Ruby SDK\n\nFollow the instructions below to migrate your apps from the deprecated\n`square_connect` gem to the new `square.rb` gem.\n\n### Update your bundle\n\n1. Find the line in your `Gemfile` starting with `gem: 'square_connect'` and\n   change the entire line to `gem: 'square.rb'`.\n1. Run `bundle` to update your `Gemfile.lock`.\n\n### Update your code\n\n1. Change all instances of `require 'square_connect'` to `require 'square'`.\n1. Replace models with plain Ruby Hash equivalents.\n1. Update client instantiation to follow the method outlined below.\n1. Update code for accessing response data to follow the method outlined below.\n1. Check `response.success?` or `response.error?` rather than rescuing\n   exceptions for flow control.\n\nTo simplify your code, we also recommend that you use method chaining to access\nAPIs instead of explicitly instantiating multiple clients.\n\n#### Client instantiation\n\n```ruby\nrequire 'square'\n\nsquare = Square::Client.new(access_token: 'YOUR ACCESS TOKEN')\n\nresponse = square.API.ENDPOINT(body: BODY)\n```\n\n#### Accessing response data\n\n```ruby\nif response.success?\n  p response.data\nelse\n  warn response.errors\nend\n```\n\n\u003cbr/\u003e\n\n---\n\n\u003cbr/\u003e\n\n## Example code migration\n\nAs a specific example, consider the following code for creating a new customer\nfrom the following Hash:\n\n```ruby\nnew_customer = {\n given_name: 'Ava',\n address: {\n   address_line_1: '555 Electric Ave',\n   locality: 'Los Angeles',\n   country: 'US'\n }\n}\n```\n\nWith the deprecated `square_connect` gem, this is how you instantiate a client\nfor the Customers API, format the request, and call the endpoint:\n\n```ruby\nrequire 'square_connect'\n\n# Instantiate the client\nSquareConnect.configure do |config|\n  config.access_token = 'YOUR ACCESS TOKEN'\nend\n\napi_instance = SquareConnect::CustomersApi.new\n\n# Create the models\naddress = SquareConnect::Address.new(new_customer[:address])\n\nbody = SquareConnect::CreateCustomerRequest.new(\n  given_name: new_customer[:given_name],\n  address: address\n)\n\nbegin\n  # Call the endpoint\n  response = api_instance.create_customer(body)\n\n  # Handle the response and warn on errors\n  p response.customer.to_hash\nrescue SquareConnect::ApiError\n  warn response.errors\nend\n```\n\nNow consider equivalent code using the new `square.rb` gem:\n\n```ruby\nrequire 'square'\n\n# Instantiate the client\nsquare = Square::Client.new(access_token: 'YOUR ACCESS TOKEN')\n\n# Call the endpoint\nresponse = square.customers.create_customer(body: new_customer)\n\n# Handle the response and warn on errors\nif response.success?\n  p response.data\nelse\n  warn response.errors\nend\n```\n\nThat's it!\n\nWhat was once a multi-block process can be handled in 2 lines of code and an\n`if/else` block. Migrating to the `square.rb` gem reduces boilerplate and lets\nyou focus on the parts of your code that really matter.\n\n\u003cbr/\u003e\n\n---\n\n\u003cbr/\u003e\n\n## Ask the community\n\nPlease join us in our [Square developer community] if you have any questions!\n\n\n[//]: # \"Link anchor definitions\"\n[Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg\n[Square Ruby SDK gem]: https://github.com/square/square-ruby-sdk\n[Square developer community]: https://squ.re/slack\n","funding_links":[],"categories":["E-Commerce and Payments"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fconnect-ruby-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquare%2Fconnect-ruby-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fconnect-ruby-sdk/lists"}