square.rb 26.0.0.20221214 → 26.2.0.20230315
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/square/api/apple_pay_api.rb +14 -30
- data/lib/square/api/bank_accounts_api.rb +40 -90
- data/lib/square/api/base_api.rb +42 -42
- data/lib/square/api/booking_custom_attributes_api.rb +164 -329
- data/lib/square/api/bookings_api.rb +135 -260
- data/lib/square/api/cards_api.rb +56 -118
- data/lib/square/api/cash_drawers_api.rb +47 -103
- data/lib/square/api/catalog_api.rb +197 -423
- data/lib/square/api/checkout_api.rb +85 -175
- data/lib/square/api/customer_custom_attributes_api.rb +150 -303
- data/lib/square/api/customer_groups_api.rb +69 -145
- data/lib/square/api/customer_segments_api.rb +26 -61
- data/lib/square/api/customers_api.rb +147 -294
- data/lib/square/api/devices_api.rb +42 -89
- data/lib/square/api/disputes_api.rb +130 -288
- data/lib/square/api/employees_api.rb +28 -63
- data/lib/square/api/gift_card_activities_api.rb +33 -65
- data/lib/square/api/gift_cards_api.rb +103 -202
- data/lib/square/api/inventory_api.rb +179 -366
- data/lib/square/api/invoices_api.rb +118 -237
- data/lib/square/api/labor_api.rb +223 -459
- data/lib/square/api/location_custom_attributes_api.rb +419 -0
- data/lib/square/api/locations_api.rb +54 -112
- data/lib/square/api/loyalty_api.rb +259 -512
- data/lib/square/api/merchants_api.rb +25 -60
- data/lib/square/api/mobile_authorization_api.rb +14 -30
- data/lib/square/api/o_auth_api.rb +54 -109
- data/lib/square/api/order_custom_attributes_api.rb +168 -333
- data/lib/square/api/orders_api.rb +115 -222
- data/lib/square/api/payments_api.rb +106 -208
- data/lib/square/api/payouts_api.rb +47 -100
- data/lib/square/api/refunds_api.rb +46 -93
- data/lib/square/api/sites_api.rb +11 -28
- data/lib/square/api/snippets_api.rb +42 -90
- data/lib/square/api/subscriptions_api.rb +150 -299
- data/lib/square/api/team_api.rb +114 -224
- data/lib/square/api/terminal_api.rb +162 -328
- data/lib/square/api/transactions_api.rb +62 -126
- data/lib/square/api/v1_transactions_api.rb +155 -296
- data/lib/square/api/vendors_api.rb +99 -192
- data/lib/square/api/webhook_subscriptions_api.rb +115 -235
- data/lib/square/api_helper.rb +1 -437
- data/lib/square/client.rb +82 -46
- data/lib/square/configuration.rb +28 -53
- data/lib/square/exceptions/api_exception.rb +1 -11
- data/lib/square/http/api_response.rb +13 -19
- data/lib/square/http/auth/o_auth2.rb +14 -7
- data/lib/square/http/http_call_back.rb +1 -15
- data/lib/square/http/http_method_enum.rb +1 -4
- data/lib/square/http/http_request.rb +1 -45
- data/lib/square/http/http_response.rb +1 -20
- data/lib/square/utilities/date_time_helper.rb +1 -146
- data/lib/square/utilities/file_wrapper.rb +5 -5
- data/lib/square.rb +7 -6
- data/spec/user_journey_spec.rb +2 -2
- data/test/api/api_test_base.rb +13 -5
- data/test/api/test_catalog_api.rb +5 -4
- data/test/api/test_customers_api.rb +3 -2
- data/test/api/test_employees_api.rb +4 -3
- data/test/api/test_labor_api.rb +6 -5
- data/test/api/test_locations_api.rb +3 -2
- data/test/api/test_merchants_api.rb +4 -3
- data/test/api/test_payments_api.rb +4 -3
- data/test/api/test_refunds_api.rb +4 -3
- metadata +12 -111
- data/lib/square/exceptions/validation_exception.rb +0 -13
- data/lib/square/http/faraday_client.rb +0 -93
- data/lib/square/http/http_client.rb +0 -118
- data/test/test_helper.rb +0 -89
@@ -1,49 +1,5 @@
|
|
1
1
|
module Square
|
2
2
|
# Represents a single Http Request.
|
3
|
-
class HttpRequest
|
4
|
-
attr_accessor :http_method, :query_url, :headers,
|
5
|
-
:parameters, :username, :password,
|
6
|
-
:context
|
7
|
-
|
8
|
-
# The constructor.
|
9
|
-
# @param [HttpMethodEnum] The HTTP method.
|
10
|
-
# @param [String] The URL to send the request to.
|
11
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
12
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
13
|
-
# @param [Hash, Optional] The context for the HTTP Request.
|
14
|
-
def initialize(http_method,
|
15
|
-
query_url,
|
16
|
-
headers: {},
|
17
|
-
parameters: {},
|
18
|
-
context: {})
|
19
|
-
@http_method = http_method
|
20
|
-
@query_url = query_url
|
21
|
-
@headers = headers
|
22
|
-
@parameters = parameters
|
23
|
-
@context = context
|
24
|
-
end
|
25
|
-
|
26
|
-
# Add a header to the HttpRequest.
|
27
|
-
# @param [String] The name of the header.
|
28
|
-
# @param [String] The value of the header.
|
29
|
-
def add_header(name, value)
|
30
|
-
@headers[name] = value
|
31
|
-
end
|
32
|
-
|
33
|
-
# Add a parameter to the HttpRequest.
|
34
|
-
# @param [String] The name of the parameter.
|
35
|
-
# @param [String] The value of the parameter.
|
36
|
-
def add_parameter(name, value)
|
37
|
-
@parameters[name] = value
|
38
|
-
end
|
39
|
-
|
40
|
-
# Add a query parameter to the HttpRequest.
|
41
|
-
# @param [String] The name of the query parameter.
|
42
|
-
# @param [String] The value of the query parameter.
|
43
|
-
def add_query_parameter(name, value)
|
44
|
-
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
45
|
-
name => value)
|
46
|
-
@query_url = APIHelper.clean_url(@query_url)
|
47
|
-
end
|
3
|
+
class HttpRequest < CoreLibrary::HttpRequest
|
48
4
|
end
|
49
5
|
end
|
@@ -1,24 +1,5 @@
|
|
1
1
|
module Square
|
2
2
|
# Http response received.
|
3
|
-
class HttpResponse
|
4
|
-
attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
|
5
|
-
|
6
|
-
# The constructor
|
7
|
-
# @param [Integer] The status code returned by the server.
|
8
|
-
# @param [String] The reason phrase returned by the server.
|
9
|
-
# @param [Hash] The headers sent by the server in the response.
|
10
|
-
# @param [String] The raw body of the response.
|
11
|
-
# @param [HttpRequest] The request that resulted in this response.
|
12
|
-
def initialize(status_code,
|
13
|
-
reason_phrase,
|
14
|
-
headers,
|
15
|
-
raw_body,
|
16
|
-
request)
|
17
|
-
@status_code = status_code
|
18
|
-
@reason_phrase = reason_phrase
|
19
|
-
@headers = headers
|
20
|
-
@raw_body = raw_body
|
21
|
-
@request = request
|
22
|
-
end
|
3
|
+
class HttpResponse < CoreLibrary::HttpResponse
|
23
4
|
end
|
24
5
|
end
|
@@ -1,151 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
module Square
|
3
3
|
# A utility that supports dateTime conversion to different formats
|
4
|
-
class DateTimeHelper
|
5
|
-
# Safely converts a DateTime object into a rfc1123 format string
|
6
|
-
# @param [DateTime] The DateTime object
|
7
|
-
# @return [String] The rfc1123 formatted datetime string
|
8
|
-
def self.to_rfc1123(date_time)
|
9
|
-
date_time&.httpdate
|
10
|
-
end
|
11
|
-
|
12
|
-
# Safely converts a map of DateTime objects into a map of rfc1123 format string
|
13
|
-
# @param [hash] a map of DateTime objects
|
14
|
-
# @return [hash] a map of rfc1123 formatted datetime string
|
15
|
-
def self.to_rfc1123_map(date_time, hash, key)
|
16
|
-
return if date_time.nil?
|
17
|
-
|
18
|
-
hash[key] = {}
|
19
|
-
date_time.each do |k, v|
|
20
|
-
hash[key][k] =
|
21
|
-
if v.is_a?(BaseModel)
|
22
|
-
v.to_hash
|
23
|
-
else
|
24
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_rfc1123(v) : v
|
25
|
-
end
|
26
|
-
end
|
27
|
-
hash[key]
|
28
|
-
end
|
29
|
-
|
30
|
-
# Safely converts an array of DateTime objects into an array of rfc1123 format string
|
31
|
-
# @param [Array] an array of DateTime objects
|
32
|
-
# @return [Array] an array of rfc1123 formatted datetime string
|
33
|
-
def self.to_rfc1123_array(date_time, hash, key)
|
34
|
-
return if date_time.nil?
|
35
|
-
|
36
|
-
hash[key] = date_time.map do |v|
|
37
|
-
if v.is_a?(BaseModel)
|
38
|
-
v.to_hash
|
39
|
-
else
|
40
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_rfc1123(v) : v
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Safely converts a DateTime object into a unix format string
|
46
|
-
# @param [DateTime] The DateTime object
|
47
|
-
# @return [String] The unix formatted datetime string
|
48
|
-
def self.to_unix(date_time)
|
49
|
-
date_time.to_time.utc.to_i unless date_time.nil?
|
50
|
-
end
|
51
|
-
|
52
|
-
# Safely converts a map of DateTime objects into a map of unix format string
|
53
|
-
# @param [hash] a map of DateTime objects
|
54
|
-
# @return [hash] a map of unix formatted datetime string
|
55
|
-
def self.to_unix_map(date_time, hash, key)
|
56
|
-
return if date_time.nil?
|
57
|
-
|
58
|
-
hash[key] = {}
|
59
|
-
date_time.each do |k, v|
|
60
|
-
hash[key][k] =
|
61
|
-
if v.is_a?(BaseModel)
|
62
|
-
v.to_hash
|
63
|
-
else
|
64
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_unix(v) : v
|
65
|
-
end
|
66
|
-
end
|
67
|
-
hash[key]
|
68
|
-
end
|
69
|
-
|
70
|
-
# Safely converts an array of DateTime objects into a map of unix format string
|
71
|
-
# @param [hash] an array of DateTime objects
|
72
|
-
# @return [hash] an array of unix formatted datetime string
|
73
|
-
def self.to_unix_array(date_time, hash, key)
|
74
|
-
return if date_time.nil?
|
75
|
-
|
76
|
-
hash[key] = date_time.map do |v|
|
77
|
-
if v.is_a?(BaseModel)
|
78
|
-
v.to_hash
|
79
|
-
else
|
80
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_unix(v) : v
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# Safely converts a DateTime object into a rfc3339 format string
|
86
|
-
# @param [DateTime] The DateTime object
|
87
|
-
# @return [String] The rfc3339 formatted datetime string
|
88
|
-
def self.to_rfc3339(date_time)
|
89
|
-
date_time&.rfc3339
|
90
|
-
end
|
91
|
-
|
92
|
-
# Safely converts a map of DateTime objects into a map of rfc1123 format string
|
93
|
-
# @param [hash] a map of DateTime objects
|
94
|
-
# @return [hash] a map of rfc1123 formatted datetime string
|
95
|
-
def self.to_rfc3339_map(date_time, hash, key)
|
96
|
-
return if date_time.nil?
|
97
|
-
|
98
|
-
hash[key] = {}
|
99
|
-
date_time.each do |k, v|
|
100
|
-
hash[key][k] =
|
101
|
-
if v.is_a?(BaseModel)
|
102
|
-
v.to_hash
|
103
|
-
else
|
104
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_rfc3339(v) : v
|
105
|
-
end
|
106
|
-
end
|
107
|
-
hash[key]
|
108
|
-
end
|
109
|
-
|
110
|
-
# Safely converts an array of DateTime objects into an array of rfc1123 format string
|
111
|
-
# @param [Array] an array of DateTime objects
|
112
|
-
# @return [Array] an array of rfc1123 formatted datetime string
|
113
|
-
def self.to_rfc3339_array(date_time, hash, key)
|
114
|
-
return if date_time.nil?
|
115
|
-
|
116
|
-
hash[key] = date_time.map do |v|
|
117
|
-
if v.is_a?(BaseModel)
|
118
|
-
v.to_hash
|
119
|
-
else
|
120
|
-
v.is_a?(DateTime) ? DateTimeHelper.to_rfc3339(v) : v
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Safely converts a rfc1123 format string into a DateTime object
|
126
|
-
# @param [String] The rfc1123 formatted datetime string
|
127
|
-
# @return [DateTime] A DateTime object
|
128
|
-
def self.from_rfc1123(date_time)
|
129
|
-
DateTime.httpdate(date_time)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Safely converts a unix format string into a DateTime object
|
133
|
-
# @param [String] The unix formatted datetime string
|
134
|
-
# @return [DateTime] A DateTime object
|
135
|
-
def self.from_unix(date_time)
|
136
|
-
Time.at(date_time.to_i).utc.to_datetime
|
137
|
-
end
|
138
|
-
|
139
|
-
# Safely converts a rfc3339 format string into a DateTime object
|
140
|
-
# @param [String] The rfc3339 formatted datetime string
|
141
|
-
# @return [DateTime] A DateTime object
|
142
|
-
def self.from_rfc3339(date_time)
|
143
|
-
# missing timezone information
|
144
|
-
if date_time.end_with?('Z') || date_time.index('+')
|
145
|
-
DateTime.rfc3339(date_time)
|
146
|
-
else
|
147
|
-
DateTime.rfc3339("#{date_time}Z")
|
148
|
-
end
|
149
|
-
end
|
4
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
150
5
|
end
|
151
6
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Square
|
2
2
|
# A utility to allow users to set the content-type for files
|
3
|
-
class FileWrapper
|
4
|
-
|
5
|
-
|
3
|
+
class FileWrapper < CoreLibrary::FileWrapper
|
4
|
+
# The constructor.
|
5
|
+
# @param [File] file The file to be sent in the request.
|
6
|
+
# @param [string] content_type The content type of the provided file.
|
6
7
|
def initialize(file, content_type: 'application/octet-stream')
|
7
|
-
|
8
|
-
@content_type = content_type
|
8
|
+
super
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/square.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'json'
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'apimatic_core_interfaces'
|
4
|
+
require 'apimatic_core'
|
5
|
+
require 'apimatic_faraday_client_adapter'
|
6
|
+
# rubocop:disable Style/MixinUsage
|
7
|
+
include CoreLibrary
|
8
|
+
# rubocop:enable Style/MixinUsage
|
6
9
|
|
7
10
|
require_relative 'square/api_helper'
|
8
11
|
require_relative 'square/client'
|
@@ -14,8 +17,6 @@ require_relative 'square/utilities/date_time_helper'
|
|
14
17
|
# Http
|
15
18
|
require_relative 'square/http/api_response'
|
16
19
|
require_relative 'square/http/http_call_back'
|
17
|
-
require_relative 'square/http/http_client'
|
18
|
-
require_relative 'square/http/faraday_client'
|
19
20
|
require_relative 'square/http/http_method_enum'
|
20
21
|
require_relative 'square/http/http_request'
|
21
22
|
require_relative 'square/http/http_response'
|
@@ -25,7 +26,6 @@ require_relative 'square/http/auth/o_auth2'
|
|
25
26
|
|
26
27
|
# Exceptions
|
27
28
|
require_relative 'square/exceptions/api_exception'
|
28
|
-
require_relative 'square/exceptions/validation_exception'
|
29
29
|
|
30
30
|
require_relative 'square/configuration'
|
31
31
|
|
@@ -54,6 +54,7 @@ require_relative 'square/api/inventory_api'
|
|
54
54
|
require_relative 'square/api/invoices_api'
|
55
55
|
require_relative 'square/api/labor_api'
|
56
56
|
require_relative 'square/api/locations_api'
|
57
|
+
require_relative 'square/api/location_custom_attributes_api'
|
57
58
|
require_relative 'square/api/checkout_api'
|
58
59
|
require_relative 'square/api/transactions_api'
|
59
60
|
require_relative 'square/api/loyalty_api'
|
data/spec/user_journey_spec.rb
CHANGED
@@ -4,8 +4,8 @@ require_relative '../test/api/api_test_base'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
describe "UserJourney" do
|
7
|
-
let(:access_token) {
|
8
|
-
let(:environment) {
|
7
|
+
let(:access_token) { ENV.fetch('SQUARE_SANDBOX_TOKEN', 'AccessToken')}
|
8
|
+
let(:environment) { "sandbox" }
|
9
9
|
|
10
10
|
let(:phone_number) { "1-212-555-4240" }
|
11
11
|
let(:phone_number2) { "1-917-500-1000" }
|
data/test/api/api_test_base.rb
CHANGED
@@ -4,7 +4,6 @@ require 'minitest/hell'
|
|
4
4
|
require 'minitest/pride'
|
5
5
|
require 'minitest/proveit'
|
6
6
|
require 'square'
|
7
|
-
require_relative '../test_helper'
|
8
7
|
require_relative '../http_response_catcher'
|
9
8
|
|
10
9
|
class ApiTestBase < Minitest::Test
|
@@ -12,8 +11,17 @@ class ApiTestBase < Minitest::Test
|
|
12
11
|
include Square
|
13
12
|
|
14
13
|
# Create configuration and set any test parameters
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def create_configuration
|
15
|
+
Configuration.new(
|
16
|
+
access_token: ENV.fetch('SQUARE_SANDBOX_TOKEN', 'AccessToken'),
|
17
|
+
environment: 'sandbox', http_callback: HttpResponseCatcher.new
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Initializes the base test controller
|
22
|
+
def setup_class
|
23
|
+
_config = create_configuration
|
24
|
+
@client = Client.new(config: _config)
|
25
|
+
_auth_managers = @client.auth_managers
|
26
|
+
end
|
19
27
|
end
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class CatalogApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.catalog
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Returns information about the Square Catalog API, such as batch size
|
@@ -23,7 +24,7 @@ class CatalogApiTests < ApiTestBase
|
|
23
24
|
expected_headers = {}
|
24
25
|
expected_headers['content-type'] = 'application/json'
|
25
26
|
|
26
|
-
assert(
|
27
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
27
28
|
end
|
28
29
|
|
29
30
|
# Returns a list of [CatalogObject](#type-catalogobject)s that includes
|
@@ -50,7 +51,7 @@ class CatalogApiTests < ApiTestBase
|
|
50
51
|
expected_headers = {}
|
51
52
|
expected_headers['content-type'] = 'application/json'
|
52
53
|
|
53
|
-
assert(
|
54
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
54
55
|
end
|
55
56
|
|
56
57
|
end
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class CustomersApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.customers
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Creates a new customer for a business, which can have associated cards on file.
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class EmployeesApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.employees
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Gets a list of `Employee` objects for a business.
|
@@ -27,7 +28,7 @@ class EmployeesApiTests < ApiTestBase
|
|
27
28
|
expected_headers = {}
|
28
29
|
expected_headers['content-type'] = 'application/json'
|
29
30
|
|
30
|
-
assert(
|
31
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
31
32
|
end
|
32
33
|
|
33
34
|
end
|
data/test/api/test_labor_api.rb
CHANGED
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class LaborApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.labor
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Returns a paginated list of `BreakType` instances for a business.
|
@@ -26,7 +27,7 @@ class LaborApiTests < ApiTestBase
|
|
26
27
|
expected_headers = {}
|
27
28
|
expected_headers['content-type'] = 'application/json'
|
28
29
|
|
29
|
-
assert(
|
30
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
30
31
|
end
|
31
32
|
|
32
33
|
# Returns a paginated list of `EmployeeWage` instances for a business.
|
@@ -45,7 +46,7 @@ class LaborApiTests < ApiTestBase
|
|
45
46
|
expected_headers = {}
|
46
47
|
expected_headers['content-type'] = 'application/json'
|
47
48
|
|
48
|
-
assert(
|
49
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
49
50
|
end
|
50
51
|
|
51
52
|
# Returns a list of `WorkweekConfig` instances for a business.
|
@@ -64,7 +65,7 @@ class LaborApiTests < ApiTestBase
|
|
64
65
|
expected_headers = {}
|
65
66
|
expected_headers['content-type'] = 'application/json'
|
66
67
|
|
67
|
-
assert(
|
68
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
68
69
|
end
|
69
70
|
|
70
71
|
end
|
@@ -3,8 +3,9 @@ require_relative 'api_test_base'
|
|
3
3
|
class LocationsApiTests < ApiTestBase
|
4
4
|
# Called only once for the class before any test has executed
|
5
5
|
def setup
|
6
|
-
|
7
|
-
@controller =
|
6
|
+
setup_class
|
7
|
+
@controller = @client.locations
|
8
|
+
@response_catcher = @controller.http_call_back
|
8
9
|
end
|
9
10
|
|
10
11
|
# Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class MerchantsApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.merchants
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Returns `Merchant` information for a given access token.
|
@@ -31,7 +32,7 @@ class MerchantsApiTests < ApiTestBase
|
|
31
32
|
expected_headers = {}
|
32
33
|
expected_headers['content-type'] = 'application/json'
|
33
34
|
|
34
|
-
assert(
|
35
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
35
36
|
end
|
36
37
|
|
37
38
|
end
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class PaymentsApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.payments
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Retrieves a list of payments taken by the account making the request.
|
@@ -33,7 +34,7 @@ class PaymentsApiTests < ApiTestBase
|
|
33
34
|
expected_headers = {}
|
34
35
|
expected_headers['content-type'] = 'application/json'
|
35
36
|
|
36
|
-
assert(
|
37
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
37
38
|
end
|
38
39
|
|
39
40
|
end
|
@@ -5,8 +5,9 @@ require_relative 'api_test_base'
|
|
5
5
|
class RefundsApiTests < ApiTestBase
|
6
6
|
# Called only once for the class before any test has executed
|
7
7
|
def setup
|
8
|
-
|
9
|
-
@controller =
|
8
|
+
setup_class
|
9
|
+
@controller = @client.refunds
|
10
|
+
@response_catcher = @controller.http_call_back
|
10
11
|
end
|
11
12
|
|
12
13
|
# Retrieves a list of refunds for the account making the request.
|
@@ -32,7 +33,7 @@ class RefundsApiTests < ApiTestBase
|
|
32
33
|
expected_headers = {}
|
33
34
|
expected_headers['content-type'] = 'application/json'
|
34
35
|
|
35
|
-
assert(
|
36
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
36
37
|
end
|
37
38
|
|
38
39
|
end
|