module Evrythng class Client # Defines methods related to thngs module Thngs # Returns a list of thngs # # @format :json, :xml # @authenticated true # @rate_limited true # @param options [Hash] A customizable set of options. # @return [Hashie::Rash] The requested list of thngs. # @see http://developer.evrythng.net/thngs # @example Return the list of thngs # Evrythng.thngs def thngs(options={}) response = get('thngs', options) format.to_s.downcase == 'xml' ? response['thngs'] : response end # Creates a thng # # @format :json, :xml # @authenticated true # @rate_limited false # @param identifier [String] The identifier of thng. # @param description [String] The description of thng. # @param options [Hash] A customizable set of options. # @return [Hashie::Rash] The created thng. # @see http://developer.evrythng.net/thngs # @example Create the authenticating user's thng # Evrythng.thng_create("my.test.thng", "Here comes the description.") def thng_create(identifier, description=nil, options={}) response = post('thngs', options.merge(:thng => { :identifier => identifier, :description => description })) format.to_s.downcase == 'xml' ? response['thng'] : response end end end end