module CyberCoach::PutCreateable::InstanceMethods

The instance methods to install.

CRUD

↑ top

Public Instance Methods

create(options = {}, invalidate = true) click to toggle source

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

options

A hash of options to send with the request.

invalidate

Invalidates it when true, skips invalidation when false.

# File lib/cybercoach/put_createable.rb, line 34
def create(options = {}, invalidate = true)
  if invalidate
    self.invalidate
  end
  options = @options.merge(options).merge(
    body: serialize
  )
  response = self.class.put(@uri, options)
  if response.success?
    deserialize(response)
  else
    fail HttpError, response.response
  end
end