Class: ShopifyAPI::Clients::HttpRequest

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/clients/http_request.rb

Instance Method Summary collapse

Instance Method Details

#verifyObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/shopify_api/clients/http_request.rb', line 18

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