Class: ShopifyApiBruv::Clients::Rest::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_api_bruv/clients/rest/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Client

Returns a new instance of Client.



9
10
11
12
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 9

def initialize(config:)
  @config = config
  @http_client = HttpClient.new(config:, path: "admin/api/#{config.api_version}")
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 7

def config
  @config
end

#http_clientObject (readonly)

Returns the value of attribute http_client.



7
8
9
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 7

def http_client
  @http_client
end

Instance Method Details

#delete(path:, body: nil, query: nil, headers: nil) ⇒ Object



18
19
20
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 18

def delete(path:, body: nil, query: nil, headers: nil)
  request(method: :delete, path:, body:, query:, headers:)
end

#get(path:, body: nil, query: nil, headers: nil) ⇒ Object



14
15
16
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 14

def get(path:, body: nil, query: nil, headers: nil)
  request(method: :get, path:, body:, query:, headers:)
end

#post(path:, body:, query: nil, headers: nil) ⇒ Object



26
27
28
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 26

def post(path:, body:, query: nil, headers: nil)
  request(method: :post, path:, body:, query:, headers:)
end

#put(path:, body:, query: nil, headers: nil) ⇒ Object



22
23
24
# File 'lib/shopify_api_bruv/clients/rest/client.rb', line 22

def put(path:, body:, query: nil, headers: nil)
  request(method: :put, path:, body:, query:, headers:)
end