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
127 changes: 126 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,139 @@
PATH
remote: .
specs:
square.rb (44.0.0.0)
apimatic_core (~> 0.3.11)
apimatic_core_interfaces (~> 0.2.1)
apimatic_faraday_client_adapter (~> 0.1.4)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
apimatic_core (0.3.19)
apimatic_core_interfaces (~> 0.2.0)
certifi (~> 2018.1, >= 2018.01.18)
faraday-multipart (~> 1.0)
nokogiri (~> 1.13, >= 1.13.10)
apimatic_core_interfaces (0.2.2)
apimatic_faraday_client_adapter (0.1.6)
apimatic_core_interfaces (~> 0.2.0)
certifi (~> 2018.1, >= 2018.01.18)
faraday (~> 2.0, >= 2.0.1)
faraday-follow_redirects (~> 0.2)
faraday-gzip (>= 1, < 4)
faraday-http-cache (~> 2.2)
faraday-multipart (~> 1.0)
faraday-net_http_persistent (~> 2.0)
faraday-retry (~> 2.0)
ast (2.4.3)
bigdecimal (3.2.2)
certifi (2018.01.18)
coderay (1.1.3)
connection_pool (2.5.3)
crack (1.0.0)
bigdecimal
rexml
faraday (2.13.4)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-gzip (3.0.4)
faraday (>= 2.0, < 3)
zlib (~> 3.0)
faraday-http-cache (2.5.1)
faraday (>= 0.8)
faraday-multipart (1.1.1)
multipart-post (~> 2.0)
faraday-net_http (3.4.1)
net-http (>= 0.5.0)
faraday-net_http_persistent (2.3.1)
faraday (~> 2.5)
net-http-persistent (>= 4.0.4, < 5)
faraday-retry (2.3.2)
faraday (~> 2.0)
hashdiff (1.2.0)
json (2.13.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
method_source (1.1.0)
mini_portile2 (2.8.9)
minitest (5.19.0)
minitest-proveit (1.0.0)
minitest (> 5, < 7)
minitest-rg (5.3.0)
minitest (~> 5.0)
multipart-post (2.4.1)
net-http (0.6.0)
uri
net-http-persistent (4.0.6)
connection_pool (~> 2.2, >= 2.2.4)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.18.9-x86_64-linux-musl)
racc (~> 1.4)
parallel (1.27.0)
parser (3.3.9.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.0)
regexp_parser (2.11.2)
rexml (3.4.1)
rubocop (1.79.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-minitest (0.38.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (1.13.0)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
zlib (3.2.1)

PLATFORMS
ruby
x86_64-linux-musl

DEPENDENCIES
rake
minitest (~> 5.19.0)
minitest-proveit (~> 1.0)
minitest-rg
pry
rake (~> 13.0)
rubocop (~> 1.21)
rubocop-minitest
square.rb!
webmock

BUNDLED WITH
2.5.22
4 changes: 2 additions & 2 deletions test/square/integration/client_tests/test_cash_drawers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Square::CashDrawers::Shifts::Client do
describe "#list" do
it "list cash drawer shifts" do
skip "Skipping for now."
skip '{"errors": [{"code": "BAD_REQUEST","detail": "The location_id is missing.","category": "INVALID_REQUEST_ERROR"}]}'
start_time = Time.now - 3600 # 1 hour ago
end_time = Time.now

Expand All @@ -17,7 +17,7 @@

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

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

Expand Down
86 changes: 65 additions & 21 deletions test/square/integration/client_tests/test_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,68 @@ def get_test_file
end

before do
@catalog_modifier_list_id = nil
@catalog_modifier_id = nil
@catalog_tax_id = nil
sleep(2)
modifier = {
type: "MODIFIER",
id: "#temp-modifier-id",
modifier_data: {
name: "Limited Time Only Price",
price_money: {
amount: 200,
currency: "USD"
}
}
}

modifier_list = {
type: "MODIFIER_LIST",
id: "#temp-modifier-list-id",
modifier_list_data: {
name: "Special weekend deals",
modifiers: [modifier]
}
}

tax = {
type: "TAX",
id: "#temp-tax-id",
tax_data: {
name: "Online only Tax",
calculation_phase: "TAX_SUBTOTAL_PHASE",
inclusion_type: "ADDITIVE",
percentage: "5.0",
applies_to_custom_amounts: true,
enabled: true
}
}

_request = Square::Catalog::Types::BatchUpsertCatalogObjectsRequest.new(
idempotency_key: SecureRandom.uuid,
batches: [
{
objects: [tax, modifier_list]
}
]
)

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

# Store IDs for later use
response.id_mappings&.each do |mapping|
case mapping.client_object_id
when "#temp-tax-id"
@catalog_tax_id = mapping.object_id
when "#temp-modifier-id"
@catalog_modifier_id = mapping.object_id
when "#temp-modifier-list-id"
@catalog_modifier_list_id = mapping.object_id
end
end
end

describe "#batch_upsert" do
it "creates multiple catalog objects" do
skip "Getting rate limited. Skipping for now."
_request = Square::Catalog::Types::BatchUpsertCatalogObjectsRequest.new(
idempotency_key: SecureRandom.uuid,
batches: [
Expand Down Expand Up @@ -145,7 +200,6 @@ def get_test_file
end

it "batch upsert catalog objects with modifiers and taxes" do
skip "Skipping for now."
sleep(2) # Wait before batch upsert

modifier = {
Expand Down Expand Up @@ -217,7 +271,7 @@ def get_test_file

describe "#bulk operations and pagination" do
it "bulk create and iterate through paginated catalog objects" do
skip "Skipping for now."
skip "Getting rate limited. Skipping for now."
delete_all_catalog_objects(client)
sleep(2) # Wait after deletion

Expand Down Expand Up @@ -267,7 +321,7 @@ def get_test_file

describe "#images" do
it "upload catalog image" do
skip "Skipping for now."
skip "Getting rate limited. Skipping for now."
# Add retry logic for the image upload
max_retries = 5
last_error = nil
Expand Down Expand Up @@ -376,7 +430,6 @@ def get_test_file

describe "#info" do
it "catalog info" do
skip "Skipping for now."
sleep(2) # Wait before info request

response = client.catalog.info
Expand All @@ -389,7 +442,6 @@ def get_test_file

describe "#list" do
it "list catalog" do
skip "Skipping for now."
sleep(2) # Wait before list request

response = client.catalog.list
Expand All @@ -402,7 +454,6 @@ def get_test_file

describe "#search" do
it "search catalog objects" do
skip "Skipping for now."
sleep(2) # Wait before search

_request = Square::Catalog::Types::SearchCatalogObjectsRequest.new(
Expand All @@ -419,7 +470,6 @@ def get_test_file

describe "#search_items" do
it "search catalog items" do
skip "Skipping for now."
sleep(2) # Wait before search items

_request = { limit: 1 }
Expand All @@ -435,11 +485,10 @@ def get_test_file

describe "#batch_get" do
it "batch retrieve catalog objects" do
skip "Skipping for now."
sleep(2) # Wait before batch retrieve

# Use the IDs created in the batch upsert test
_request = Square::Catalog::Types::BatchRetrieveCatalogObjectsRequest.new(
_request = Square::Catalog::Types::BatchGetCatalogObjectsRequest.new(
object_ids: [@catalog_modifier_id, @catalog_modifier_list_id, @catalog_tax_id]
)

Expand All @@ -448,7 +497,7 @@ def get_test_file
response = client.catalog.batch_get(**_request.to_h)

refute_nil response
assert_equal response.class, Square::Types::BatchRetrieveCatalogObjectsResponse
assert_equal response.class, Square::Types::BatchGetCatalogObjectsResponse
refute_nil response.objects
assert_equal 3, response.objects.length
assert_equal [@catalog_modifier_id, @catalog_modifier_list_id, @catalog_tax_id].sort,
Expand All @@ -460,7 +509,6 @@ def get_test_file

describe "#update_item_taxes" do
it "update item taxes" do
skip "Skipping for now."
sleep(2) # Wait before test start

# First create a test item
Expand Down Expand Up @@ -498,7 +546,6 @@ def get_test_file

describe "#update_item_modifier_lists" do
it "update item modifier lists" do
skip "Skipping for now."
sleep(2) # Wait before test start

# First create a test item
Expand Down Expand Up @@ -536,8 +583,7 @@ def get_test_file

describe "#upsert" do
it "upserts an object" do
skip "Skipping for now."
_request = Square::Catalog::Types::UpsertCatalogObjectRequest.new(
_request = Square::Catalog::Object_::Types::UpsertCatalogObjectRequest.new(
idempotency_key: SecureRandom.uuid,
object: {
type: "ITEM",
Expand Down Expand Up @@ -578,7 +624,6 @@ def get_test_file
end

it "upsert catalog object with custom data" do
skip "Skipping for now."
coffee = create_test_catalog_item(
name: "Coffee",
description: "Strong coffee",
Expand All @@ -589,7 +634,7 @@ def get_test_file

sleep(2) # Wait before upsert

_request = Square::Catalog::Types::UpsertCatalogObjectRequest.new(
_request = Square::Catalog::Object_::Types::UpsertCatalogObjectRequest.new(
object: coffee,
idempotency_key: SecureRandom.uuid
)
Expand All @@ -616,13 +661,12 @@ def get_test_file

describe "#get" do
it "retrieve catalog object" do
skip "Skipping for now."
sleep(2) # Wait before test start

# First create a catalog object
coffee = create_test_catalog_item

_create_request = Square::Catalog::Types::UpsertCatalogObjectRequest.new(
_create_request = Square::Catalog::Object_::Types::UpsertCatalogObjectRequest.new(
object: coffee,
idempotency_key: SecureRandom.uuid
)
Expand Down
1 change: 0 additions & 1 deletion test/square/integration/client_tests/test_customers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
describe Square::Customers::Client do
describe "#create and delete customer" do
it "creates a customer" do

_create_request = Square::Customers::Types::CreateCustomerRequest.new(
given_name: "Amelia",
family_name: "Earhart",
Expand Down
Loading