diff --git a/Gemfile.lock b/Gemfile.lock index d5600e09..827baa7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,9 +37,9 @@ GEM connection_pool (2.4.1) crack (0.4.5) rexml - diff-lcs (1.5.0) drb (2.2.0) ruby2_keywords + erubi (1.12.0) fakefs (1.4.1) hash_diff (1.1.1) hashdiff (1.0.1) @@ -60,25 +60,25 @@ GEM oj (3.16.3) bigdecimal (>= 3.0) openssl (3.2.0) - parallel (1.22.1) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc - pry (0.14.1) + prettier_print (1.2.1) + prism (0.21.0) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) public_suffix (4.0.6) - racc (1.7.1) + racc (1.7.3) rainbow (3.1.1) rake (13.0.6) - rbi (0.0.15) - ast - parser (>= 2.6.4.0) + rbi (0.1.8) + prism (>= 0.18.0, < 0.22) sorbet-runtime (>= 0.5.9204) - unparser regexp_parser (2.5.0) rexml (3.2.5) rubocop (1.36.0) @@ -100,44 +100,40 @@ GEM ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) securerandom (0.3.1) - sorbet (0.5.10438) - sorbet-static (= 0.5.10438) - sorbet-runtime (0.5.10438) - sorbet-static (0.5.10438-universal-darwin-21) - sorbet-static (0.5.10438-universal-darwin-22) - sorbet-static (0.5.10438-x86_64-linux) - sorbet-static-and-runtime (0.5.10438) - sorbet (= 0.5.10438) - sorbet-runtime (= 0.5.10438) - spoom (1.1.11) - sorbet (>= 0.5.9204) - sorbet-runtime (>= 0.5.9204) + sorbet (0.5.11230) + sorbet-static (= 0.5.11230) + sorbet-runtime (0.5.11230) + sorbet-static (0.5.11230-universal-darwin) + sorbet-static (0.5.11230-x86_64-linux) + sorbet-static-and-runtime (0.5.11230) + sorbet (= 0.5.11230) + sorbet-runtime (= 0.5.11230) + spoom (1.2.4) + erubi (>= 1.10.0) + sorbet-static-and-runtime (>= 0.5.10187) + syntax_tree (>= 6.1.1) thor (>= 0.19.2) - tapioca (0.10.2) - bundler (>= 1.17.3) + syntax_tree (6.2.0) + prettier_print (>= 1.2.0) + tapioca (0.12.0) + bundler (>= 2.2.25) netrc (>= 0.11.0) parallel (>= 1.21.0) - pry (>= 0.12.2) - rbi (~> 0.0.0, >= 0.0.14) - sorbet-static-and-runtime (>= 0.5.9204) - spoom (~> 1.1.0, >= 1.1.11) + rbi (>= 0.1.4, < 0.2) + sorbet-static-and-runtime (>= 0.5.10820) + spoom (~> 1.2.0, >= 1.2.0) thor (>= 1.2.0) yard-sorbet - thor (1.2.1) + thor (1.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.3.0) - unparser (0.6.5) - diff-lcs (~> 1.3) - parser (>= 3.1.0) webmock (3.14.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.7.0) - yard (0.9.28) - webrick (~> 1.7.0) - yard-sorbet (0.7.0) + yard (0.9.34) + yard-sorbet (0.8.1) sorbet-runtime (>= 0.5) yard (>= 0.9) zeitwerk (2.6.12) diff --git a/lib/shopify_api/logger.rb b/lib/shopify_api/logger.rb index a2e5d7f3..0f29687f 100644 --- a/lib/shopify_api/logger.rb +++ b/lib/shopify_api/logger.rb @@ -75,7 +75,7 @@ def enabled_for_log_level?(log_level) def valid_version(version) current_version = Gem::Version.create(ShopifyAPI::VERSION) deprecate_version = Gem::Version.create(version) - current_version < deprecate_version + T.must(current_version) < deprecate_version end end end diff --git a/lib/shopify_api/rest/base.rb b/lib/shopify_api/rest/base.rb index 46b89de1..1d94f290 100644 --- a/lib/shopify_api/rest/base.rb +++ b/lib/shopify_api/rest/base.rb @@ -13,6 +13,8 @@ class Base @has_one = T.let({}, T::Hash[Symbol, Class]) @has_many = T.let({}, T::Hash[Symbol, Class]) + @has_one = T.let({}, T::Hash[Symbol, T::Class[T.anything]]) + @has_many = T.let({}, T::Hash[Symbol, T::Class[T.anything]]) @paths = T.let([], T::Array[T::Hash[Symbol, T.any(T::Array[Symbol], String, Symbol)]]) @custom_prefix = T.let(nil, T.nilable(String)) @read_only_attributes = T.let([], T.nilable(T::Array[Symbol])) @@ -55,10 +57,10 @@ class << self sig { returns(T.nilable(String)) } attr_reader :custom_prefix - sig { returns(T::Hash[Symbol, Class]) } + sig { returns(T::Hash[Symbol, T::Class[T.anything]]) } attr_reader :has_many - sig { returns(T::Hash[Symbol, Class]) } + sig { returns(T::Hash[Symbol, T::Class[T.anything]]) } attr_reader :has_one sig do @@ -440,7 +442,7 @@ def get_property(key) sig do params( element: T.nilable(T.any(T::Hash[String, T.untyped], ShopifyAPI::Rest::Base)), - attribute_class: Class, + attribute_class: T::Class[T.anything], saving: T::Boolean, ).returns(T.nilable(T::Hash[String, T.untyped])) end diff --git a/lib/shopify_api/utils/hmac_validator.rb b/lib/shopify_api/utils/hmac_validator.rb index c8b3808e..76e2f47b 100644 --- a/lib/shopify_api/utils/hmac_validator.rb +++ b/lib/shopify_api/utils/hmac_validator.rb @@ -27,7 +27,7 @@ def validate(verifiable_query) def validate_signature(verifiable_query, secret) received_signature = verifiable_query.hmac computed_signature = compute_signature(verifiable_query.to_signable_string, secret) - OpenSSL.secure_compare(computed_signature, received_signature) + OpenSSL.secure_compare(computed_signature, T.must(received_signature)) end sig { params(signable_string: String, secret: String).returns(String) } diff --git a/test/test_helpers/fake_resource.rb b/test/test_helpers/fake_resource.rb index f9622ed0..f2ede71e 100644 --- a/test/test_helpers/fake_resource.rb +++ b/test/test_helpers/fake_resource.rb @@ -7,11 +7,11 @@ class FakeResource < ShopifyAPI::Rest::Base @has_one = T.let({ has_one_attribute: FakeResource, - }, T::Hash[Symbol, Class]) + }, T::Hash[Symbol, T::Class[T.anything]]) @has_many = T.let({ has_many_attribute: FakeResource, - }, T::Hash[Symbol, Class]) + }, T::Hash[Symbol, T::Class[T.anything]]) @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) diff --git a/test/test_helpers/fake_resource_with_custom_prefix.rb b/test/test_helpers/fake_resource_with_custom_prefix.rb index 810f95e8..d4e25f6f 100644 --- a/test/test_helpers/fake_resource_with_custom_prefix.rb +++ b/test/test_helpers/fake_resource_with_custom_prefix.rb @@ -10,8 +10,8 @@ class FakeResourceWithCustomPrefix < ShopifyAPI::Rest::Base @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) - @has_one = T.let({}, T::Hash[Symbol, Class]) - @has_many = T.let({}, T::Hash[Symbol, Class]) + @has_one = T.let({}, T::Hash[Symbol, T::Class[T.anything]]) + @has_many = T.let({}, T::Hash[Symbol, T::Class[T.anything]]) @paths = T.let([ { http_method: :get, operation: :get, ids: [:id], path: "fake_resource_with_custom_prefix/.json" }, ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])