Class: ActionKitRest::Base

Inherits:
Vertebrae::Model
  • Object
show all
Defined in:
lib/action_kit_rest/base.rb

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Object



12
13
14
15
16
# File 'lib/action_kit_rest/base.rb', line 12

def create(params)
  resp = client.post_json_request(normalized_base_path, params)
  id = extract_id_from_response(resp)
  get(id)
end

#get(id) ⇒ Object



8
9
10
# File 'lib/action_kit_rest/base.rb', line 8

def get(id)
  client.get_request("#{normalized_base_path}#{url_escape(id)}/")
end

#list(filters = {}) ⇒ Object



4
5
6
# File 'lib/action_kit_rest/base.rb', line 4

def list(filters = {})
  client.get_request(normalized_base_path, filters)
end

#normalized_base_pathObject



23
24
25
# File 'lib/action_kit_rest/base.rb', line 23

def normalized_base_path
  "#{base_path}/"
end

#update(id, params) ⇒ Object



18
19
20
21
# File 'lib/action_kit_rest/base.rb', line 18

def update(id, params)
  client.put_json_request("#{normalized_base_path}#{url_escape(id)}/", params)
  get(id)
end