Class: ShopifyAPI::Clients::Rest::Admin
- Inherits:
-
HttpClient
- Object
- HttpClient
- ShopifyAPI::Clients::Rest::Admin
show all
- Extended by:
- T::Sig
- Defined in:
- lib/shopify_api/clients/rest/admin.rb
Constant Summary
Constants inherited
from HttpClient
HttpClient::RETRY_WAIT_TIME
Instance Method Summary
collapse
-
#delete(path:, body: nil, query: nil, headers: nil, tries: 1) ⇒ Object
-
#get(path:, body: nil, query: nil, headers: nil, tries: 1) ⇒ Object
-
#initialize(session: nil, api_version: nil) ⇒ Admin
constructor
-
#post(path:, body:, query: nil, headers: nil, tries: 1) ⇒ Object
-
#put(path:, body:, query: nil, headers: nil, tries: 1) ⇒ Object
Methods inherited from HttpClient
#request
Constructor Details
#initialize(session: nil, api_version: nil) ⇒ Admin
Returns a new instance of Admin.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 11
def initialize(session: nil, api_version: nil)
if Context.rest_disabled
raise Errors::DisabledResourceError,
"The Admin REST API has been deprecated. Please use the GraphQL Admin API. For more information see https://www.shopify.com/ca/partners/blog/all-in-on-graphql"
end
@api_version = T.let(api_version || Context.api_version, String)
if api_version
if api_version == Context.api_version
Context.logger.debug("Rest client has a redundant API version override "\
"to the default #{Context.api_version}")
else
Context.logger.debug("Rest client overriding default API version "\
"#{Context.api_version} with #{api_version}")
end
end
super(session: session, base_path: "/admin/api/#{@api_version}")
end
|
Instance Method Details
#delete(path:, body: nil, query: nil, headers: nil, tries: 1) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 56
def delete(path:, body: nil, query: nil, headers: nil, tries: 1)
request(
make_request(http_method: :delete, path: path, body: body, query: query, headers: ,
tries: T.must(tries)),
)
end
|
#get(path:, body: nil, query: nil, headers: nil, tries: 1) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 40
def get(path:, body: nil, query: nil, headers: nil, tries: 1)
request(
make_request(http_method: :get, path: path, body: body, query: query, headers: ,
tries: T.must(tries)),
)
end
|
#post(path:, body:, query: nil, headers: nil, tries: 1) ⇒ Object
88
89
90
91
92
93
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 88
def post(path:, body:, query: nil, headers: nil, tries: 1)
request(
make_request(http_method: :post, path: path, body: body, query: query, headers: ,
tries: T.must(tries)),
)
end
|
#put(path:, body:, query: nil, headers: nil, tries: 1) ⇒ Object
72
73
74
75
76
77
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 72
def put(path:, body:, query: nil, headers: nil, tries: 1)
request(
make_request(http_method: :put, path: path, body: body, query: query, headers: ,
tries: T.must(tries)),
)
end
|