Module: CyberCoach::PutCreateable::InstanceMethods

Defined in:
lib/cybercoach/put_createable.rb

Overview

The instance methods to install.

Instance Method Summary collapse

Instance Method Details

#create(options = {}) ⇒ Object

:category: CRUD

Creates it. Reads itself from the response. Raises HttpError if the request is unsuccessful.

options

A hash of options to send with the request.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cybercoach/put_createable.rb', line 33

def create(options = {})
  invalidate_uri
  invalidate_options
  options = @options.merge(options).merge(
    body: serialize
  )
  response = self.class.put(@uri, options)
  if response.success?
    deserialize(response)
  else
    raise HttpError.new(response.response)
  end
end