Method: ApiClient::ClassMethods#post

Defined in:
lib/api-client/class_methods.rb

#post(attributes, header = {}) ⇒ Base Also known as: create

Make a post requisition and initialize an object with the response.



23
24
25
26
27
28
# File 'lib/api-client/class_methods.rb', line 23

def post(attributes, header = {})
  return new(attributes) if ApiClient.config.mock
  url = "#{ApiClient.config.path[path]}#{self.resource_path}"
  response = ApiClient::Dispatcher.post(url, { self.root_node.to_sym => attributes }, header)
  build(response, url)
end