Module: Eipiai::CollectionResource

Defined in:
lib/eipiai/resources/collection.rb

Overview

CollectionResource

The collection resource is the basis for a resource representing a collection of objects.

It provides basic GET and POST support.

It is the collection version of the ‘SingularResource` resource.

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



15
16
17
# File 'lib/eipiai/resources/collection.rb', line 15

def allowed_methods
  %w(GET POST)
end

#create_pathObject



19
20
21
# File 'lib/eipiai/resources/collection.rb', line 19

def create_path
  new_object.path
end

#from_jsonObject



23
24
25
26
# File 'lib/eipiai/resources/collection.rb', line 23

def from_json
  new_object.save
  handle_post_or_put_with_optional_content
end