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



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

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

#get(id) ⇒ Object



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

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

#list(filters = {}) ⇒ Object



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

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

#normalized_base_pathObject



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

def normalized_base_path
  "#{base_path}/"
end

#update(id, params) ⇒ Object



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

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