Connect v2 Ruby SDKs
This repository contains the released Ruby client SDK. Check out our API specification repository for the specification and template files we used to generate this.
This SDK is automatically generated by the Swagger Codegen project:
- API version: 2.0
- Package version: 2.0.2
- Build package: io.swagger.codegen.languages.RubyClientCodegen
For more information, please visit https://squareup.com/developers
Installation
RubyGems
The Ruby SDK is published as a gem. Simply run:
$ gem install square_connect
Or add this line to your Gemfile:
gem 'square_connect'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/square/connect-ruby-sdk, then add the following in the Gemfile:
gem 'square_connect', :git => 'https://github.com/square/connect-ruby-sdk.git'
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
# Load the gem
require 'square_connect'
api_instance = SquareConnect::CheckoutApi.new
= "authorization_example" # String | The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
location_id = "location_id_example" # String | The ID of the business location to associate the checkout with.
body = SquareConnect::CreateCheckoutRequest.new # CreateCheckoutRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
begin
#CreateCheckout
result = api_instance.create_checkout(, location_id, body)
p result
rescue SquareConnect::ApiError => e
puts "Exception when calling CheckoutApi->create_checkout: #{e}"
end
Documentation for API Endpoints
All URIs are relative to https://connect.squareup.com
Class | Method | HTTP request | Description |
---|---|---|---|
SquareConnect::CheckoutApi | create_checkout | POST /v2/locations/location_id/checkouts | CreateCheckout |
SquareConnect::CustomerApi | create_customer | POST /v2/customers | CreateCustomer |
SquareConnect::CustomerApi | delete_customer | DELETE /v2/customers/customer_id | DeleteCustomer |
SquareConnect::CustomerApi | list_customers | GET /v2/customers | ListCustomers |
SquareConnect::CustomerApi | retrieve_customer | GET /v2/customers/customer_id | RetrieveCustomer |
SquareConnect::CustomerApi | update_customer | PUT /v2/customers/customer_id | UpdateCustomer |
SquareConnect::CustomerCardApi | create_customer_card | POST /v2/customers/customer_id/cards | CreateCustomerCard |
SquareConnect::CustomerCardApi | delete_customer_card | DELETE /v2/customers/customer_id/cards/card_id | DeleteCustomerCard |
SquareConnect::LocationApi | list_locations | GET /v2/locations | ListLocations |
SquareConnect::RefundApi | create_refund | POST /v2/locations/location_id/transactions/transaction_id/refund | CreateRefund |
SquareConnect::RefundApi | list_refunds | GET /v2/locations/location_id/refunds | ListRefunds |
SquareConnect::TransactionApi | capture_transaction | POST /v2/locations/location_id/transactions/transaction_id/capture | CaptureTransaction |
SquareConnect::TransactionApi | charge | POST /v2/locations/location_id/transactions | Charge |
SquareConnect::TransactionApi | list_transactions | GET /v2/locations/location_id/transactions | ListTransactions |
SquareConnect::TransactionApi | retrieve_transaction | GET /v2/locations/location_id/transactions/transaction_id | RetrieveTransaction |
SquareConnect::TransactionApi | void_transaction | POST /v2/locations/location_id/transactions/transaction_id/void | VoidTransaction |
Documentation for Models
- SquareConnect::Address
- SquareConnect::CaptureTransactionRequest
- SquareConnect::CaptureTransactionResponse
- SquareConnect::Card
- SquareConnect::CardBrand
- SquareConnect::ChargeRequest
- SquareConnect::ChargeResponse
- SquareConnect::Checkout
- SquareConnect::Country
- SquareConnect::CreateCheckoutRequest
- SquareConnect::CreateCheckoutResponse
- SquareConnect::CreateCustomerCardRequest
- SquareConnect::CreateCustomerCardResponse
- SquareConnect::CreateCustomerRequest
- SquareConnect::CreateCustomerResponse
- SquareConnect::CreateOrderRequest
- SquareConnect::CreateOrderRequestLineItem
- SquareConnect::CreateOrderRequestOrder
- SquareConnect::CreateRefundRequest
- SquareConnect::CreateRefundResponse
- SquareConnect::Currency
- SquareConnect::Customer
- SquareConnect::CustomerGroupInfo
- SquareConnect::CustomerPreferences
- SquareConnect::DeleteCustomerCardRequest
- SquareConnect::DeleteCustomerCardResponse
- SquareConnect::DeleteCustomerRequest
- SquareConnect::DeleteCustomerResponse
- SquareConnect::Error
- SquareConnect::ErrorCategory
- SquareConnect::ErrorCode
- SquareConnect::ListCustomersRequest
- SquareConnect::ListCustomersResponse
- SquareConnect::ListLocationsRequest
- SquareConnect::ListLocationsResponse
- SquareConnect::ListRefundsRequest
- SquareConnect::ListRefundsResponse
- SquareConnect::ListTransactionsRequest
- SquareConnect::ListTransactionsResponse
- SquareConnect::Location
- SquareConnect::LocationCapability
- SquareConnect::Money
- SquareConnect::Order
- SquareConnect::OrderLineItem
- SquareConnect::Refund
- SquareConnect::RefundStatus
- SquareConnect::RetrieveCustomerRequest
- SquareConnect::RetrieveCustomerResponse
- SquareConnect::RetrieveTransactionRequest
- SquareConnect::RetrieveTransactionResponse
- SquareConnect::SortOrder
- SquareConnect::Tender
- SquareConnect::TenderCardDetails
- SquareConnect::TenderCardDetailsEntryMethod
- SquareConnect::TenderCardDetailsStatus
- SquareConnect::TenderCashDetails
- SquareConnect::TenderType
- SquareConnect::Transaction
- SquareConnect::TransactionProduct
- SquareConnect::UpdateCustomerRequest
- SquareConnect::UpdateCustomerResponse
- SquareConnect::VoidTransactionRequest
- SquareConnect::VoidTransactionResponse
Documentation for Authorization
oauth2
- Type: OAuth
- Flow: accessCode
- Authorization URL:
https://connect.squareup.com/oauth2/authorize?<PARAMETERS>
- Scopes:
- MERCHANT_PROFILE_READ: GET endpoints related to a merchant's business and location entities. Almost all Connect API applications need this permission in order to obtain a merchant's location IDs
- PAYMENTS_READ: GET endpoints related to transactions and refunds
- PAYMENTS_WRITE: POST, PUT, and DELETE endpoints related to transactions and refunds. E-commerce applications must request this permission
- CUSTOMERS_READ: GET endpoints related to customer management
- CUSTOMERS_WRITE: POST, PUT, and DELETE endpoints related to customer management
- SETTLEMENTS_READ: GET endpoints related to settlements (deposits)
- BANK_ACCOUNTS_READ: GET endpoints related to a merchant's bank accounts
- ITEMS_READ: GET endpoints related to a merchant's item library
- ITEMS_WRITE: POST, PUT, and DELETE endpoints related to a merchant's item library
- ORDERS_READ: GET endpoints related to a merchant's Square online store.
- ORDERS_WRITE: POST, PUT, and DELETE endpoints related to a merchant's Square online store
- EMPLOYEES_READ: GET endpoints related to employee management
- EMPLOYEES_WRITE: POST, PUT, and DELETE endpoints related to employee management
- TIMECARDS_READ: GET endpoints related to employee timecards
- TIMECARDS_WRITE: POST, PUT, and DELETE endpoints related to employee timecards
Contributing
Send bug reports, feature requests, and code contributions to the API specifications repository, as this repository contains only the generated SDK code.
License
Copyright 2017 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.