Module: CyberCoach::PutCreateable::InstanceMethods
- Defined in:
- lib/cybercoach/put_createable.rb
Overview
The instance methods to install.
Instance Method Summary collapse
-
#create(options = {}, invalidate = true) ⇒ Object
:category: CRUD.
Instance Method Details
#create(options = {}, invalidate = true) ⇒ 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.
- invalidate
Invalidates it when true, skips invalidation when false.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cybercoach/put_createable.rb', line 34 def create( = {}, invalidate = true) if invalidate self.invalidate end = @options.merge().merge( body: serialize ) response = self.class.put(@uri, ) if response.success? deserialize(response) else fail HttpError, response.response end end |