Module: SecondAmendmentWholesale::API

Included in:
Attribute, Catalog, Category, Image, Inventory, Order, Shipping, User
Defined in:
lib/second_amendment_wholesale/api.rb

Constant Summary collapse

ROOT_API_URL =
'https://www.2ndamendmentwholesale.com/rest/V1'.freeze

Instance Method Summary collapse

Instance Method Details

#delete_request(endpoint, headers = {}) ⇒ Object



26
27
28
29
30
# File 'lib/second_amendment_wholesale/api.rb', line 26

def delete_request(endpoint, headers = {})
  request = Net::HTTP::Delete.new(request_url(endpoint))

  submit_request(request, {}, headers)
end

#get_request(endpoint, headers = {}) ⇒ Object



8
9
10
11
12
# File 'lib/second_amendment_wholesale/api.rb', line 8

def get_request(endpoint, headers = {})
  request = Net::HTTP::Get.new(request_url(endpoint))

  submit_request(request, {}, headers)
end

#post_request(endpoint, data = {}, headers = {}) ⇒ Object



14
15
16
17
18
# File 'lib/second_amendment_wholesale/api.rb', line 14

def post_request(endpoint, data = {}, headers = {})
  request = Net::HTTP::Post.new(request_url(endpoint))

  submit_request(request, data, headers)
end

#put_request(endpoint, data = {}, headers = {}) ⇒ Object



20
21
22
23
24
# File 'lib/second_amendment_wholesale/api.rb', line 20

def put_request(endpoint, data = {}, headers = {})
  request = Net::HTTP::Put.new(request_url(endpoint))

  submit_request(request, data, headers)
end