class SenseiApi::Base
Public Class Methods
create(params)
click to toggle source
# File lib/sensei_api/base.rb, line 12 def create(params) response = HTTParty.post(url, body: params.compact.reject { |key, _| key == :id }, format: :json) JSON.parse(response.body, object_class: OpenStruct) end
delete(params)
click to toggle source
# File lib/sensei_api/base.rb, line 22 def delete(params) response = HTTParty.delete(url, body: params.compact, format: :json) JSON.parse(response.body, object_class: OpenStruct) end
find_by(params)
click to toggle source
# File lib/sensei_api/base.rb, line 7 def find_by(params) response = HTTParty.get(url, query: params.compact, format: :json) JSON.parse(response.body, object_class: OpenStruct) end
update(params)
click to toggle source
# File lib/sensei_api/base.rb, line 17 def update(params) response = HTTParty.put(url, body: params.compact, format: :json) JSON.parse(response.body, object_class: OpenStruct) end
url()
click to toggle source
# File lib/sensei_api/base.rb, line 27 def url raise NotImplementedError end