Module: CyberCoach::PostCreateable::InstanceMethods
- Defined in:
- lib/cybercoach/post_createable.rb
Overview
The instance methods to install.
Instance Method Summary collapse
-
#create(options = {}) ⇒ Object
:category: CRUD.
Instance Method Details
#create(options = {}) ⇒ Object
:category: CRUD
Creates it. Gets the URI from the response and reads itself again. 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 46 |
# File 'lib/cybercoach/post_createable.rb', line 33 def create( = {}) invalidate_uri = .merge().merge( body: serialize ) response = self.class.post(resource_base_uri, ) if response.success? @uri = response.headers['location'] read() else raise HttpError.new(response.response) end end |