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
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 11
def initialize(session: nil, api_version: nil)
@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
51
52
53
54
55
56
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 51
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
35
36
37
38
39
40
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 35
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
83
84
85
86
87
88
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 83
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
67
68
69
70
71
72
|
# File 'lib/shopify_api/clients/rest/admin.rb', line 67
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
|