module Evrythng class Client # Defines methods related to collections module Collections # Returns a list of collections # # @format :json, :xml # @authenticated true # @rate_limited true # @param options [Hash] A customizable set of options. # @return [Hashie::Rash] The requested list of collections. # @see http://dev.evrythng.net/doc/get/collections # @example Return the list of collections # 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