Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/square/integration/client_tests/test_cash_drawers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

puts "request #{_request.to_h}" if verbose?

response = client.cash_drawers.shifts.list(request: _request.to_h)
response = client.cash_drawers.shifts.list(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::ListCashDrawerShiftsResponse

Expand Down
28 changes: 14 additions & 14 deletions test/square/integration/client_tests/test_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def delete_all_catalog_objects(client)
_batch_delete_request = Square::Catalog::Types::BatchDeleteCatalogObjectsRequest.new(
object_ids: object_ids
)
client.catalog.batch_delete(request: _batch_delete_request.to_h)
client.catalog.batch_delete(**_batch_delete_request.to_h)
end

def create_test_catalog_item(name: "Test Item #{SecureRandom.uuid}", description: "Test Description", abbreviation: "TI", price: 100, variation_name: "Regular")
Expand Down Expand Up @@ -138,7 +138,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.batch_upsert(request: _request.to_h)
response = client.catalog.batch_upsert(**_request.to_h)
refute_nil response

puts "response #{response.to_h}" if verbose?
Expand Down Expand Up @@ -193,7 +193,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.batch_upsert(request: _request.to_h)
response = client.catalog.batch_upsert(**_request.to_h)

assert response
assert_equal 2, response.objects.length
Expand Down Expand Up @@ -236,7 +236,7 @@ def get_test_file
puts "request #{_request.to_h}" if verbose?

# Create the catalog objects in a bulk request
create_catalog_objects_resp = client.catalog.batch_upsert(request: _request.to_h)
create_catalog_objects_resp = client.catalog.batch_upsert(**_request.to_h)
assert_equal 200, create_catalog_objects_resp.objects.length
assert_equal create_catalog_objects_resp.class, Square::Types::BatchUpsertCatalogObjectsResponse
sleep(2) # Wait after bulk creation
Expand Down Expand Up @@ -305,7 +305,7 @@ def get_test_file

puts "create_catalog_request #{_create_request.keys}" if verbose?

create_catalog_resp = client.catalog.batch_upsert(request: _create_request.to_h)
create_catalog_resp = client.catalog.batch_upsert(**_create_request.to_h)

puts 'Catalog object created' if verbose?
assert_equal 1, create_catalog_resp.objects.length
Expand Down Expand Up @@ -338,7 +338,7 @@ def get_test_file

puts "image_upload_request #{_image_request[:request].to_h}" if verbose?

create_catalog_image_resp = client.catalog.images.create(request: _image_request.to_h)
create_catalog_image_resp = client.catalog.images.create(**_image_request.to_h)

puts 'Image uploaded successfully' if verbose?
assert create_catalog_image_resp.image
Expand All @@ -353,7 +353,7 @@ def get_test_file
_batch_delete_request = Square::Catalog::Types::BatchDeleteCatalogObjectsRequest.new(
object_ids: [created_catalog_object.id, create_catalog_image_resp.image.id]
)
_batch_delete_resp = client.catalog.batch_delete(request: _batch_delete_request.to_h)
_batch_delete_resp = client.catalog.batch_delete(**_batch_delete_request.to_h)
refute_nil _batch_delete_resp
assert_equal _batch_delete_resp.class, Square::Types::BatchDeleteCatalogObjectsResponse

Expand Down Expand Up @@ -409,7 +409,7 @@ def get_test_file
limit: 1
)

response = client.catalog.search(request: _request.to_h)
response = client.catalog.search(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::SearchCatalogObjectsResponse

Expand Down Expand Up @@ -445,7 +445,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.batch_get(request: _request.to_h)
response = client.catalog.batch_get(**_request.to_h)

refute_nil response
assert_equal response.class, Square::Types::BatchRetrieveCatalogObjectsResponse
Expand Down Expand Up @@ -479,7 +479,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.update_item_taxes(request: _request.to_h)
response = client.catalog.update_item_taxes(**_request.to_h)

refute_nil response
assert_equal response.class, Square::Types::UpdateItemTaxesResponse
Expand Down Expand Up @@ -517,7 +517,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.update_item_modifier_lists(request: _request.to_h)
response = client.catalog.update_item_modifier_lists(**_request.to_h)

refute_nil response
assert_equal response.class, Square::Types::UpdateItemModifierListsResponse
Expand Down Expand Up @@ -569,7 +569,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.object.upsert(request: _request.to_h)
response = client.catalog.object.upsert(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::UpsertCatalogObjectResponse
refute_nil response.catalog_object
Expand All @@ -596,7 +596,7 @@ def get_test_file

puts "request #{_request.to_h}" if verbose?

response = client.catalog.object.upsert(request: _request.to_h)
response = client.catalog.object.upsert(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::UpsertCatalogObjectResponse
refute_nil response.catalog_object
Expand Down Expand Up @@ -629,7 +629,7 @@ def get_test_file

puts "create_request #{_create_request.keys}" if verbose?

create_resp = client.catalog.object.upsert(request: _create_request.to_h)
create_resp = client.catalog.object.upsert(**_create_request.to_h)

sleep(2) # Wait before retrieve

Expand Down
4 changes: 2 additions & 2 deletions test/square/integration/client_tests/test_customers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

puts "create customer request #{_create_request.to_h}" if verbose?

response = client.customers.create(request: _create_request.to_h)
response = client.customers.create(**_create_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::CreateCustomerResponse
refute_nil response.customer.id
Expand All @@ -39,7 +39,7 @@

puts "delete customer request #{_delete_request.to_h}" if verbose?

response = client.customers.delete(request: _delete_request.to_h)
response = client.customers.delete(**_delete_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::DeleteCustomerResponse
assert_nil response.errors
Expand Down
6 changes: 3 additions & 3 deletions test/square/integration/client_tests/test_customers_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def create_test_customer_group
name: "Default-#{SecureRandom.uuid}"
}
)
_create_resp = client.customers.groups.create(request: _create_request.to_h)
_create_resp = client.customers.groups.create(**_create_request.to_h)
refute_nil _create_resp
assert_equal _create_resp.class, Square::Types::CreateCustomerGroupResponse
refute_nil _create_resp.group
Expand All @@ -20,7 +20,7 @@ def delete_test_customer_group(group_id)
_delete_request = Square::Customers::Groups::Types::DeleteGroupsRequest.new(
group_id: group_id
)
_delete_resp = client.customers.groups.delete(request: _delete_request.to_h)
_delete_resp = client.customers.groups.delete(**_delete_request.to_h)
refute_nil _delete_resp
assert_equal _delete_resp.class, Square::Types::DeleteCustomerGroupResponse
end
Expand Down Expand Up @@ -146,7 +146,7 @@ def delete_test_customer_group(group_id)
puts "request #{_request.to_h}" if verbose?

assert_raises(Square::SquareError) do
client.customers.groups.create(request: _request.to_h)
client.customers.groups.create(**_request.to_h)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
segment_id: segment_id
)

response = client.customers.segments.get(request: _request.to_h)
response = client.customers.segments.get(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::GetCustomerSegmentResponse
refute_nil response.segment
Expand Down
6 changes: 3 additions & 3 deletions test/square/integration/client_tests/test_devices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
product_type: "TERMINAL_API"
)
)
create_response = client.devices.codes.create(request: _create_request.to_h)
create_response = client.devices.codes.create(**_create_request.to_h)
@device_code_id = create_response.device_code.id
end

Expand Down Expand Up @@ -41,7 +41,7 @@

puts "request #{_request.to_h}" if verbose?

response = client.devices.codes.create(request: _request.to_h)
response = client.devices.codes.create(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::CreateDeviceCodeResponse
refute_nil response.device_code
Expand All @@ -58,7 +58,7 @@
id: @device_code_id
)

response = client.devices.codes.get(request: _request.to_h)
response = client.devices.codes.get(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::GetDeviceCodeResponse
refute_nil response.device_code
Expand Down
2 changes: 1 addition & 1 deletion test/square/integration/client_tests/test_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

puts "request #{_request.to_h}" if verbose?

response = client.inventory.batch_get_changes(request: _request.to_h)
response = client.inventory.batch_get_changes(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::BatchGetInventoryChangesResponse
refute_nil response.changes
Expand Down
2 changes: 1 addition & 1 deletion test/square/integration/client_tests/test_merchants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
merchant_id: @merchant_id
)

response = client.merchants.get(request: _request.to_h)
response = client.merchants.get(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::GetMerchantResponse
refute_nil response.merchant
Expand Down
2 changes: 1 addition & 1 deletion test/square/integration/client_tests/test_mobile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
location_id: client.locations.list.locations.first.id
)

response = client.mobile.authorization_code(request: _request.to_h)
response = client.mobile.authorization_code(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::AuthorizationCodeResponse
refute_nil response.authorization_code
Expand Down
14 changes: 7 additions & 7 deletions test/square/integration/client_tests/test_orders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
)
# Create initial order for testing
order_response = client.orders.create(request: _create_request.to_h)
order_response = client.orders.create(**_create_request.to_h)
refute_nil order_response
assert_equal order_response.class, Square::Types::CreateOrderResponse
refute_nil order_response.order
Expand Down Expand Up @@ -57,7 +57,7 @@

puts "request #{_request.to_h}" if verbose?

response = client.orders.create(request: _request.to_h)
response = client.orders.create(**_request.to_h)
refute_nil response.order
assert_equal response.class, Square::Types::CreateOrderResponse
assert_equal @location_id, response.order.location_id
Expand All @@ -74,7 +74,7 @@
order_ids: [@order_id]
)

response = client.orders.batch_get(request: _request.to_h)
response = client.orders.batch_get(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::BatchGetOrdersResponse
refute_nil response.orders
Expand All @@ -92,7 +92,7 @@
location_ids: [@location_id]
)

response = client.orders.search(request: _request.to_h)
response = client.orders.search(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::SearchOrdersResponse
refute_nil response.orders
Expand Down Expand Up @@ -126,7 +126,7 @@
fields_to_clear: ["line_items[#{@line_item_uid}]"]
)

response = client.orders.update(request: _request.to_h)
response = client.orders.update(**_request.to_h)
refute_nil response.order
assert_equal @order_id, response.order.id
assert_equal "Updated Item", response.order.line_items.first.name
Expand All @@ -145,7 +145,7 @@
payment_ids: []
)

response = client.orders.pay(request: _request.to_h)
response = client.orders.pay(**_request.to_h)
refute_nil response.order
assert_equal @order_id, response.order.id

Expand All @@ -172,7 +172,7 @@
)
)

response = client.orders.calculate(request: _request.to_h)
response = client.orders.calculate(**_request.to_h)
refute_nil response.order
refute_nil response.order.total_money
assert_equal response.class, Square::Types::CalculateOrderResponse
Expand Down
12 changes: 6 additions & 6 deletions test/square/integration/client_tests/test_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
currency: "USD"
),
)
payment_response = client.payments.create(request: _create_request.to_h)
payment_response = client.payments.create(**_create_request.to_h)
refute_nil payment_response
assert_equal payment_response.class, Square::Types::CreatePaymentResponse
refute_nil payment_response.payment
Expand Down Expand Up @@ -57,7 +57,7 @@
autocomplete: true
)

response = client.payments.create(request: _request.to_h)
response = client.payments.create(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::CreatePaymentResponse
refute_nil response.payment
Expand All @@ -77,7 +77,7 @@
payment_id: @payment_id
)

response = client.payments.get(request: _request.to_h)
response = client.payments.get(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::GetPaymentResponse
refute_nil response.payment
Expand All @@ -94,7 +94,7 @@
payment_id: @payment_id
)

response = client.payments.cancel(request: _request.to_h)
response = client.payments.cancel(**_request.to_h)
refute_nil response
assert_equal response.class, Square::Types::CancelPaymentResponse
refute_nil response.payment
Expand Down Expand Up @@ -159,13 +159,13 @@
),
autocomplete: false
)
create_response = client.payments.create(request: _create_request.to_h)
create_response = client.payments.create(**_create_request.to_h)

_request = Square::Payments::Types::CompletePaymentRequest.new(
payment_id: create_response.payment.id
)

response = client.payments.complete(request: _request.to_h)
response = client.payments.complete(**_request.to_h)
refute_nil response.payment
assert_equal "COMPLETED", response.payment.status

Expand Down
Loading