Giter Site home page Giter Site logo

square / square-ruby-sdk Goto Github PK

View Code? Open in Web Editor NEW
69.0 12.0 42.0 3.05 MB

Ruby client library for the Square API

Home Page: https://developer.squareup.com/docs

License: Other

Ruby 100.00%
sdk-ruby ecommerce sdk payment-processing credit-card-payments api-client api

square-ruby-sdk's Introduction

Square logo

Square Ruby SDK

Build Gem version Apache-2 license

Use this library to integrate Square payments into your app and grow your business with Square APIs including Catalog, Customers, Employees, Inventory, Labor, Locations, and Orders.

Requirements

Use of the Square Ruby SDK requires:

  • Ruby 2.6 through 3.1

Installation

For more information, see Set Up Your Square SDK for a Ruby Project.

Quickstart

For more information, see Square Ruby SDK Quickstart.

Usage

For more information, see Using the Square Ruby SDK.

Tests

First, clone the repo locally and cd into the directory.

git clone https://github.com/square/square-ruby-sdk.git
cd square-ruby-sdk

Next, make sure Bundler is installed and install the development dependencies.

gem install bundler
bundle

Before running the tests, find a sandbox token in your Developer Dashboard and set a SQUARE_SANDBOX_TOKEN environment variable.

export SQUARE_SANDBOX_TOKEN="YOUR SANDBOX TOKEN HERE"

And run the tests.

rake

SDK Reference

Payments

Terminal

Orders

Subscriptions

Invoices

Items

Customers

Loyalty

Gift Cards

Bookings

Business

Team

Financials

Online

Authorization

Webhook Subscriptions

Deprecated APIs

The following Square APIs are deprecated:

square-ruby-sdk's People

Contributors

daphnechiu avatar deanpapastrat avatar dotspencer avatar gkchestertron avatar havenwood avatar jessdelacruzsantos avatar jguze avatar joanc-sq avatar lindzeng avatar mcurtis-squareup avatar mohsin-sq avatar okenshields avatar shaofu88 avatar square-sdk-deployer avatar sseaman avatar steefan-square avatar wolfadex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

square-ruby-sdk's Issues

Not working for Ruby 3.0

Hi there

I've noticed that the method patterns used in this repo will only work for Ruby 2.x for many endpoints. The minimum failure case for me is this:

require 'square'

# Initialize Square Client
square = Square::Client.new(
  access_token: 'EAAAE...'
)

result = square.devices.list_device_codes

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

Running this returns

~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/square.rb-9.0.0.20210226/lib/square/api_helper.rb:67:in `append_url_with_query_parameters': wrong number of arguments (given 1, expected 2) (ArgumentError)
	from ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/square.rb-9.0.0.20210226/lib/square/api/devices_api.rb:30:in `list_device_codes'
	from square-test.rb:10:in `<main>'

Are there any plans to support Ruby 3.0?

README.md is cut off in default display

There must be a length limit on the README.md when it is automatically displayed at the root of the project. The last data structure displayed is "Tender", and there are quite a few more data structures that should display after that. As a result, clicking on links like "#update-customer-request" doesn't do anything.

If you click on the README.md file in the source listing, it loads the full page.

Perhaps a better solution would be to have a short readme with a link to a separate file with the documentation, so a user would not have broken links.

Connection failure raises "TypeError: Server responded with invalid JSON"

Describe the bug
Occasionally, an API request fails due to an intermittent network error, and the SDK raises a TypeError when attempting to parse the error response as JSON. An example error I've observed had the following response body:

upstream connect error or disconnect/reset before headers. reset reason: connection failure

Expected behavior
I'm not sure how best to handle this scenario, but I think raising a more semantically-meaningful error would be preferable, as that would help clients implement reasonable error-handling.

To Reproduce
Because this is caused by intermittent network failures, I'm not sure how to reliably reproduce the issue.

Backtrace
Here's an extract from the backtrace of such an error:

/gems/square.rb-19.0.0.20220420/lib/square/api_helper.rb:130 in rescue in json_deserialize
/gems/square.rb-19.0.0.20220420/lib/square/api_helper.rb:127 in json_deserialize
/gems/square.rb-19.0.0.20220420/lib/square/api/cards_api.rb:58 in list_cards

Caused by JSON::ParserError: 783: unexpected token at 'upstream connect error or disconnect/reset before headers. reset reason: connection failure'

Square SDK version
19.0.0.20220420

Support faraday v1.x

Use of this gem in our Rails app is restricting our ability to update some other gems which now require faraday v1.0.x. In order to allow faraday v1.0.x, you would need to relax the dependency requirement for faraday, but also update faraday_middleware to v1.0.0

Any chance you would be willing to update those to? And/or would you be willing to accept a PR which makes those changes?

Orders Search: results sort ASC is ignored

Version: square.rb (4.0.0.20191217)

search params:

{
  :location_ids => [ "my location id" ], 
  :query => {
    :filter => {
      :date_time_filter => {
        :updated_at => { :start_at => "2019-11-08T01:38:45Z", :end_at => "2020-01-06T20:52:08Z" }
      }
    }, 
    :sort => { :sort_field => "UPDATED_AT", :order => "ASC" }
  }, 
  :limit => 500
}
2.5.5 :071 > result = square.orders.search_orders(body: search_params)
2.5.5 :072 > result.data.orders.collect {|o| o[:updated_at]}
 => ["2020-01-03T21:19:31Z", "2019-12-13T03:28:18.000Z", "2019-11-22T18:47:35.000Z", "2019-11-20T22:26:54.000Z", "2019-11-11T22:57:31.000Z", "2019-11-08T01:38:45Z"]

Orders are in descending order, despite being specified to sort ASC.

DELETE on Invoice API failing

Describe the bug
A previously fixed issue where a DELETE API call on Invoices was passing an empty object (as opposed to nil) which the Square API server didn't like, and assumed it was a bad request. This was fixed by changing the default parameters variable to nil instead of {}. With the latest API (31.x, atleast - I've not kept up) - the change was reverted, but the parameters are not as clearly exposed due to the APIMatic changes.

Expected behavior
The body should be empty, if Square requires this, and the Invoice should be deleted.

To Reproduce
Steps to reproduce the bug:

  1. Create Invoice (whether API or UI driven does not apply)
  2. Attempt to delete Invoice using client.invoices.delete() passing the correct invoice_id.

Screenshots
If applicable, add screenshots to help explain the bug.

Square SDK version
31.0.0.20230816

Checkout API Change

I noticed that this is no longer valid -

order: {
reference_id: reference_id,
line_items: [
{
name: name,
quantity: '1',
base_price_money: {
amount: amount,
currency: 'USD'
}
}]
}

I found the fix after doing some research and updated to this -

order: {
idempotency_key: idempotency_key,
order: {
location_id: location_id,
reference_id: reference_id,
line_items: [
{
name: name,
quantity: '1',
base_price_money: {
amount: amount,
currency: 'USD'
}
}]
}
}

It looks like it was updated on July 22nd but I don't see this noted here or on the Square website.

Client.new uninitiated constant

Ryby 2.7.0
Having issues with Client.new:

client = Square::Client.new(environment: 'sandbox', access_token: $sandbox_access_token)
==> uninitialized constant Square::Client (NameError)

The gem is indeed loaded, but can't get past this for some reason.

Tried this as well:

require 'square'
client = Square::Client.new(access_token: $sandbox_access_token)
==> uninitialized constant Square::Client (NameError)

Same error. Not sure what to do.

Excessive Code Duplication

So I have access to an alpha-stage square API which does not currently have an SDK available. As a result, I attempted to extend this gem for internal use to cover additional API endpoints/methods.

In reviewing the code present in the lib/square/api directory, I was unpleasantly surprised to find that every single function in this directory consists of 90+% duplicated code. This was frustrating and time-consuming for me to have to work with, and it must be even more frustrating and time-consuming for those who maintain it.

In approaching what I needed to code, I ended up piecing together this (albeit not yet tested/polished) straightforward ~50-line function that generates SDK methods dynamically (in true ruby fashion). If used everywhere possible, the api subdirectory -- not including comments -- which currently is 4,387 lines of code can (quite realistically) be reduced to < 500 lines of code.

No pressure to actually use this code, but please do consider a major refactoring effort because the code as it is hurts to read.

module Square
  # BaseApi.
  class BaseApi
    DEFAULT_HEADERS = { 'accept' => 'application/json' }
    class << self
      def configure_endpoint(name, http_method, path, *optional_parameter_names, request_body: nil, extra_headers: {})
        name = name.to_sym
        query_parameters.map!(&:to_sym)
        http_method = http_method.to_s.upcase.to_sym
        request_body = %i[POST PUT PATCH].include?(http_method) ? true : false if request_body.nil?
        _headers = DEFAULT_HEADERS.dup
        _headers['content-type'] = 'application/json; charset=utf-8' if request_body
        _headers.merge!(extra_headers)

        required_parameter_names = path.scan(/(?<={)\w+(?=})/).map(&:to_sym)
        required_parameter_names << :body if request_body
        allowed_parameter_names = required_parameter_names + optional_parameter_names

        define_method name do |**kwargs|
          missing_keywords = required_parameter_names - kwargs.keys
          unknown_keywords = kwargs.keys - allowed_parameter_names
          raise ArgumentError, "missing keyword: #{missing_keywords.first}" unless missing_keywords.empty?
          raise ArgumentError, "unknown keyword: #{unknown_keywords.first}" unless unknown_keywords.empty?

          # Prepare query url.
          _query_builder = config.get_base_uri
          _query_builder << path

          _template_parameter_names = required_parameter_names - %i[body]
          _template_parameters = kwargs.slice(*_template_parameter_names).stringify_keys
          _query_builder = APIHelper.append_url_with_template_parameters(_query_builder, _query_parameters)

          _query_parameter_names = allowed_parameter_names - required_parameter_names
          _query_parameters = kwargs.slice(*_query_parameter_names).stringify_keys
          _query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters)

          _query_url = APIHelper.clean_url _query_builder

          # Prepare and execute HttpRequest.
          _request_parameters = { headers: _headers }
          _request_parameters[:parameters] = kwargs[:body].to_json if request_body
          _request = config.http_client.send(http_method, **_request_parameters)
          OAuth2.apply(config, _request)
          _response = execute_request(_request)

          # Return appropriate response type.
          decoded = APIHelper.json_deserialize(_response.raw_body)
          _errors = APIHelper.map_response(decoded, ['errors'])
          ApiResponse.new(_response, data: decoded, errors: _errors)
        end
      end
    end

    # Insert existing BaseApi code here
  end
end

To use:

module Square
  # CustomersApi
  class CustomersApi < BaseApi
    configure_endpoint :list_customers,        :GET,     '/v2/customers', :cursor, :sort_field, :sort_order
    configure_endpoint :create_customer,       :POST,    '/v2/customers'
    configure_endpoint :search_customers,      :POST,    '/v2/customers/search'
    configure_endpoint :retrieve_customer,     :GET,     '/v2/customers/{customer_id}'
    configure_endpoint :update_customer,       :PUT,     '/v2/customers/{customer_id}'
    configure_endpoint :delete_customer,       :DELETE,  '/v2/customers/{customer_id}'
    configure_endpoint :create_customer_card,  :POST,    '/v2/customers/{customer_id}/cards'
    configure_endpoint :delete_customer_card,  :DELETE,  '/v2/customers/{customer_id}/cards/{card_id}'
  end
end

from plain ruby to rails

I am building with Ruby on Rails and now I have this awesome form. I also tested both
connect v2 and square-ruby-sdk then finally decided to stick with square-ruby sdk. I have put the working example into my controller but it shows that client is undefined.
It works on plain ruby tho, did I miss anything. Any tips would be appreciated.
Screenshots link

Docs are broken

All requests and response documents are with wrong links.

image

Support Faraday versions greater than 1.3.0

Hi, I've tried to upgrade from 10.0.0.202104217 to 12.0.0.20210616 but it seems the new version is more restrictive with the faraday version. We're currently using 1.4.1 and the previous dependency used to be ~> 1.0, >= 1.0.1 but now the dependencies indicates ~> 1.0', '<= 1.3.0. Why was it restricted this way?

rubocop reports 73 offenses detected

Ran rubocop -c .rubocop.yml and got the following:

Inspecting 36 files
CC......C.....C....C..CC....CC..C.C.

Offenses:

spec/user_journey_spec.rb:6:10: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
describe "UserJourney" do
         ^^^^^^^^^^^^^
spec/user_journey_spec.rb:10:24: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  let(:phone_number) { "1-212-555-4240" }
                       ^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:11:25: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  let(:phone_number2) { "1-917-500-1000" }
                        ^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:12:23: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  let(:postal_code) { "10003" }
                      ^^^^^^^
spec/user_journey_spec.rb:13:24: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
  let(:postal_code2) { "98100" }
                       ^^^^^^^
spec/user_journey_spec.rb:17:9: C: Layout/IndentHash: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
        "given_name": "Amelia",
        ^^^^^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:17:23: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        "given_name": "Amelia",
                      ^^^^^^^^
spec/user_journey_spec.rb:18:24: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        "family_name": "Earhart",
                       ^^^^^^^^^
spec/user_journey_spec.rb:20:17: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        "note": "a customer",
                ^^^^^^^^^^^^
spec/user_journey_spec.rb:22:13: C: Layout/IndentHash: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
            "address_line_1": "500 Electric Ave",
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:22:31: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
            "address_line_1": "500 Electric Ave",
                              ^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:23:31: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
            "address_line_2": "Suite 600",
                              ^^^^^^^^^^^
spec/user_journey_spec.rb:24:25: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
            "locality": "New York",
                        ^^^^^^^^^^
spec/user_journey_spec.rb:25:48: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
            "administrative_district_level_1": "NY",
                                               ^^^^
spec/user_journey_spec.rb:27:24: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
            "country": "US"
                       ^^^^
spec/user_journey_spec.rb:37:38: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Square::Client.new(access_token: "bad_token")
                                     ^^^^^^^^^^^
spec/user_journey_spec.rb:48:8: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    it "should contain following fields" do
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:73:1: C: Layout/EmptyLines: Extra blank line detected.
spec/user_journey_spec.rb:74:81: C: Metrics/LineLength: Line is too long. [104/80]
  # There is no sandbox support for V1 endpoints as production token is required for the following tests
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:84:81: C: Metrics/LineLength: Line is too long. [85/80]
  #     response = api.create_category(location_id: location_id, body: {name: name1})
                                                                                ^^^^^
spec/user_journey_spec.rb:97:81: C: Metrics/LineLength: Line is too long. [110/80]
  #     response = api.update_category(location_id: location_id, category_id: created_id, body: {name: name2})
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:102:81: C: Metrics/LineLength: Line is too long. [89/80]
  #     response = api.delete_category(location_id: location_id, category_id: created_id)
                                                                                ^^^^^^^^^
spec/user_journey_spec.rb:114:1: C: Layout/EmptyLines: Extra blank line detected.
spec/user_journey_spec.rb:119:81: C: Metrics/LineLength: Line is too long. [83/80]
      response = sq.customers.retrieve_customer(customer_id: created_customer[:id])
                                                                                ^^^
spec/user_journey_spec.rb:130:81: C: Metrics/LineLength: Line is too long. [98/80]
      response = sq.customers.update_customer(customer_id: created_customer[:id], body: customer2)
                                                                                ^^^^^^^^^^^^^^^^^^
spec/user_journey_spec.rb:136:81: C: Metrics/LineLength: Line is too long. [83/80]
      response = sq.customers.retrieve_customer(customer_id: created_customer[:id])
                                                                                ^^^
spec/user_journey_spec.rb:142:81: C: Metrics/LineLength: Line is too long. [81/80]
      response = sq.customers.delete_customer(customer_id: created_customer[:id])
                                                                                ^
examples/customers.rb:5:31: C: Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call.
  access_token: 'ACCESS_TOKEN',
                              ^
examples/customers.rb:12:7: C: Layout/IndentHash: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
      "given_name": "John",
      ^^^^^^^^^^^^^^^^^^^^
examples/customers.rb:12:21: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      "given_name": "John",
                    ^^^^^^
examples/customers.rb:13:22: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      "family_name": "Smith",
                     ^^^^^^^
examples/customers.rb:15:11: C: Layout/IndentHash: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
          "address_line_1": "500 Electric Ave",
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
examples/customers.rb:15:29: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "address_line_1": "500 Electric Ave",
                            ^^^^^^^^^^^^^^^^^^
examples/customers.rb:16:29: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "address_line_2": "Suite 600",
                            ^^^^^^^^^^^
examples/customers.rb:17:23: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "locality": "New York",
                      ^^^^^^^^^^
examples/customers.rb:18:46: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "administrative_district_level_1": "NY",
                                             ^^^^
examples/customers.rb:19:26: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "postal_code": "98100",
                         ^^^^^^^
examples/customers.rb:20:22: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
          "country": "US"
                     ^^^^
examples/customers.rb:22:3: C: Layout/IndentHash: Indent the right brace the same as the start of the line where the left brace is.
  }
  ^
examples/customers.rb:43:80: C: Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
result = customers_api.update_customer(customer_id: created_customer_id, body: {"family_name": "Jackson"})
                                                                               ^
examples/customers.rb:43:81: C: Metrics/LineLength: Line is too long. [106/80]
result = customers_api.update_customer(customer_id: created_customer_id, body: {"family_name": "Jackson"})
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
examples/customers.rb:43:96: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
result = customers_api.update_customer(customer_id: created_customer_id, body: {"family_name": "Jackson"})
                                                                                               ^^^^^^^^^
examples/customers.rb:43:105: C: Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
result = customers_api.update_customer(customer_id: created_customer_id, body: {"family_name": "Jackson"})
                                                                                                        ^
lib/square/http/api_response.rb:33:30: C: Style/MultipleComparison: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
          data.reject! { |k| k == :cursor || k == :errors }
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/square/api/payments_api.rb:142:81: C: Metrics/LineLength: Line is too long. [85/80]
    # @return [CancelPaymentByIdempotencyKeyResponse Hash] response from the API call
                                                                                ^^^^^
lib/square/api/inventory_api.rb:17:81: C: Metrics/LineLength: Line is too long. [83/80]
    # @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
                                                                                ^^^
lib/square/api/inventory_api.rb:91:81: C: Metrics/LineLength: Line is too long. [85/80]
    # @return [BatchRetrieveInventoryChangesResponse Hash] response from the API call
                                                                                ^^^^^
lib/square/api/inventory_api.rb:132:81: C: Metrics/LineLength: Line is too long. [84/80]
    # @return [BatchRetrieveInventoryCountsResponse Hash] response from the API call
                                                                                ^^^^
lib/square/api/inventory_api.rb:164:81: C: Metrics/LineLength: Line is too long. [86/80]
    # @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
                                                                                ^^^^^^
lib/square/api/catalog_api.rb:27:81: C: Metrics/LineLength: Line is too long. [81/80]
    # @return [BatchDeleteCatalogObjectsResponse Hash] response from the API call
                                                                                ^
lib/square/api/catalog_api.rb:66:81: C: Metrics/LineLength: Line is too long. [83/80]
    # @return [BatchRetrieveCatalogObjectsResponse Hash] response from the API call
                                                                                ^^^
lib/square/api/catalog_api.rb:111:81: C: Metrics/LineLength: Line is too long. [81/80]
    # @return [BatchUpsertCatalogObjectsResponse Hash] response from the API call
                                                                                ^
lib/square/api/v1_items_api.rb:871:81: C: Metrics/LineLength: Line is too long. [93/80]
      _query_builder << '/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}'
                                                                                ^^^^^^^^^^^^^
lib/square/api/v1_items_api.rb:913:81: C: Metrics/LineLength: Line is too long. [93/80]
      _query_builder << '/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}'
                                                                                ^^^^^^^^^^^^^
lib/square/api/v1_items_api.rb:999:81: C: Metrics/LineLength: Line is too long. [85/80]
      _query_builder << '/v1/{location_id}/items/{item_id}/variations/{variation_id}'
                                                                                ^^^^^
lib/square/api/v1_items_api.rb:1044:81: C: Metrics/LineLength: Line is too long. [85/80]
      _query_builder << '/v1/{location_id}/items/{item_id}/variations/{variation_id}'
                                                                                ^^^^^
lib/square/api/v1_items_api.rb:1281:81: C: Metrics/LineLength: Line is too long. [94/80]
      _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options'
                                                                                ^^^^^^^^^^^^^^
lib/square/api/v1_items_api.rb:1326:81: C: Metrics/LineLength: Line is too long. [115/80]
      _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}'
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/square/api/v1_items_api.rb:1371:81: C: Metrics/LineLength: Line is too long. [115/80]
      _query_builder << '/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}'
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/square/api/transactions_api.rb:215:81: C: Metrics/LineLength: Line is too long. [83/80]
      _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
                                                                                ^^^
lib/square/api/transactions_api.rb:257:81: C: Metrics/LineLength: Line is too long. [91/80]
      _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
                                                                                ^^^^^^^^^^^
lib/square/api/transactions_api.rb:308:81: C: Metrics/LineLength: Line is too long. [90/80]
      _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
                                                                                ^^^^^^^^^^
lib/square/api/transactions_api.rb:352:81: C: Metrics/LineLength: Line is too long. [88/80]
      _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
                                                                                ^^^^^^^^
lib/square/api/reporting_api.rb:36:81: C: Metrics/LineLength: Line is too long. [96/80]
    # @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
                                                                                ^^^^^^^^^^^^^^^^
lib/square/api/reporting_api.rb:46:81: C: Metrics/LineLength: Line is too long. [93/80]
      _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
                                                                                ^^^^^^^^^^^^^
lib/square/api/reporting_api.rb:102:81: C: Metrics/LineLength: Line is too long. [90/80]
    # @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
                                                                                ^^^^^^^^^^
lib/square/api/reporting_api.rb:112:81: C: Metrics/LineLength: Line is too long. [86/80]
      _query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
                                                                                ^^^^^^
lib/square/api/mobile_authorization_api.rb:28:81: C: Metrics/LineLength: Line is too long. [85/80]
    # @return [CreateMobileAuthorizationCodeResponse Hash] response from the API call
                                                                                ^^^^^
lib/square/api_helper.rb:140:7: C: Style/RedundantReturn: Redundant return detected.
      return JSON.parse(json, symbolize_names: true)
      ^^^^^^
lib/square/api_helper.rb:164:27: C: Naming/UncommunicativeMethodParamName: Method parameter must be at least 3 characters long.
    def self.custom_merge(a, b)
                          ^
lib/square/api_helper.rb:164:30: C: Naming/UncommunicativeMethodParamName: Method parameter must be at least 3 characters long.
    def self.custom_merge(a, b)
                             ^
lib/square/api_helper.rb:275:9: C: Style/DateTime: Prefer Date or Time over DateTime.
        DateTime.rfc3339(date_time)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/square/api_helper.rb:277:9: C: Style/DateTime: Prefer Date or Time over DateTime.
        DateTime.rfc3339(date_time + 'Z')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

36 files inspected, 73 offenses detected

Using -a can auto fix these if the code quality is of a priority.

or maybe removing .rubocop.yml if rubocopy is not supposed to run against this repo.

Out of date documentation

Working through the Get an Instance of an API object and call its methods section of the README, it seems following line is out of date:

# Call create_customer method to create a new customer in this Square account
result = client.customers.create_customer(request_body)

results in this error:

missing keyword: :body (ArgumentError)

It runs fine when you add the body: keyword argument like this:

# Call create_customer method to create a new customer in this Square account
result = client.customers.create_customer(body: request_body)

Just thought I'd let you all know! Thanks for all the work on Square, I just started working with it but so far the documentation has been great ๐Ÿ‘๐Ÿผ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.