Sha256: 38f735c743958478ed2ba7d7056a39b48db28a105c1dd7144cbf993ac4aac0fe
Contents?: true
Size: 1.09 KB
Versions: 31
Compression:
Stored size: 1.09 KB
Contents
# typed: strict # frozen_string_literal: true module ShopifyAPI module Clients class HttpRequest < T::Struct extend T::Sig prop :http_method, Symbol prop :path, String prop :body, T.nilable(T.any(T::Hash[T.any(Symbol, String), T.untyped], String)) prop :body_type, T.nilable(String) prop :query, T.nilable(T::Hash[T.any(Symbol, String), T.untyped]) prop :extra_headers, T.nilable(T::Hash[T.any(Symbol, String), T.untyped]) prop :tries, Integer, default: 1 sig { void } def verify unless [:get, :delete, :put, :post].include?(http_method) raise ShopifyAPI::Errors::InvalidHttpRequestError, "Invalid Http method #{http_method}." end if body && !body_type raise ShopifyAPI::Errors::InvalidHttpRequestError, "Cannot set a body without also setting body_type." end return unless [:put, :post].include?(http_method) unless body raise ShopifyAPI::Errors::InvalidHttpRequestError, "Cannot use #{http_method} without specifying data." end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems