lib/evrythng/client/collections.rb in evrythng-0.0.1 vs lib/evrythng/client/collections.rb in evrythng-0.0.2
- old
+ new
@@ -14,8 +14,25 @@
# Evrythng.collections
def collections(options={})
response = get('collections', options)
format.to_s.downcase == 'xml' ? response['collections'] : response
end
+
+ # Creates a collection
+ #
+ # @format :json, :xml
+ # @authenticated true
+ # @rate_limited false
+ # @param name [String] The name of collection.
+ # @param description [String] The description of collection.
+ # @param options [Hash] A customizable set of options.
+ # @return [Hashie::Rash] The created collection.
+ # @see http://dev.evrythng.net/doc/post/collections
+ # @example Create the authenticating user's collection
+ # Evrythng.collection_create("This is a new collection!", "Here comes the description.")
+ def collection_create(name, description=nil, options={})
+ response = post('collections', options.merge(:collection => { :name => name, :description => description }))
+ format.to_s.downcase == 'xml' ? response['collection'] : response
+ end
end
end
end