class ExtendWarranties::Api::Products

Public Instance Methods

all(store_id, args = {}) click to toggle source
# File lib/extend_warranties/api/products.rb, line 5
def all(store_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?

  resp = connection.get "/stores/#{store_id}/products", args
  handle_response(resp)
end
create(store_id, args = {}) click to toggle source
# File lib/extend_warranties/api/products.rb, line 12
def create(store_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?

  resp = connection.post "/stores/#{store_id}/products", args
  handle_response(resp)
end
delete(store_id, product_id, args={}) click to toggle source
# File lib/extend_warranties/api/products.rb, line 34
def delete(store_id, product_id, args={})
  raise ArgumentError, 'store_id is required' if store_id.blank?
  raise ArgumentError, 'product_id is required' if product_id.blank?

  resp = connection.delete "/stores/#{store_id}/products/#{product_id}", args
  handle_response(resp)
end
find_by_id(store_id, product_id, args = {}) click to toggle source
# File lib/extend_warranties/api/products.rb, line 26
def find_by_id(store_id, product_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?
  raise ArgumentError, 'product_id is required' if product_id.blank?

  resp = connection.get "/stores/#{store_id}/products/#{product_id}", args
  handle_response(resp)
end
update(store_id, product_id, args = {}) click to toggle source
# File lib/extend_warranties/api/products.rb, line 19
def update(store_id, product_id, args = {})
  raise ArgumentError, 'store_id is required' if store_id.blank?

  resp = connection.put "/stores/#{store_id}/products/#{product_id}", args
  handle_response(resp)
end