Sha256: 5c95bd59d31137e12bba94ef69f396813e98f55256c0eb6e9e737bc47d6b64d0
Contents?: true
Size: 799 Bytes
Versions: 7
Compression:
Stored size: 799 Bytes
Contents
module ActionKitRest class Base < Vertebrae::Model def list(filters = {}) client.get_request(normalized_base_path, filters) end def get(id) client.get_request("#{normalized_base_path}#{id}/") end def create(params) resp = client.post_json_request(normalized_base_path, params) id = extract_id_from_response(resp) get(id) end def update(id, params) client.put_json_request("#{normalized_base_path}#{id}/", params) get(id) end def normalized_base_path "#{base_path}/" end private def extract_id_from_response(resp) extract_id_from_location(resp.response.headers["location"]) end def extract_id_from_location(location) location.scan(/\/(\d+)\/$/).first.first end end end
Version data entries
7 entries across 7 versions & 1 rubygems