module Evrythng class Client # Defines methods related to thngs module Thngs # Returns a list of thngs # # @param options [Hash] A customizable set of options. # @return [Array] The requested list of thngs. # @see http://dev.evrythng.com/thngs # @example Return the list of thngs # Evrythng.thngs def thngs(options={}) get('thngs', options) end # Returns a single thng, specified by id # # @param id [String] The id of the desired thng. # @param options [Hash] A customizable set of options. # @return [Hash] The requested thng. # @see http://dev.evrythng.com/thngs # @example Return the thng with the id 4f2133f39f5c550c2000016a # Evrythng.thng('4f2133f39f5c550c2000016a') def thng(id, options={}) get("thngs/#{id}", options) end # Creates a thng # # @param name [String] The name of thng. # @param description [String] The description of thng. # @param options [Hash] A customizable set of options. # @return [Hash] The created thng. # @see http://dev.evrythng.com/thngs # @example Create the authenticating user's thng # Evrythng.thng_create("my.test.thng", "Here comes the description.") def thng_create(name, description=nil, options={}) post("thngs", options.merge(:name => name, :description => description)) end # Updates a thng # # @param id [String] The id of thng. # @param options [Hash] A customizable set of options. # @return [Hash] The updated thng. # @see http://dev.evrythng.com/thngs # @example Update the authenticating user's thng with id 4f2133f39f5c550c2000016a # Evrythng.thng_update('4f2133f39f5c550c2000016a', :name => 'my.test.thng.updated') def thng_update(id, options={}) put("thngs/#{id}", options) end end end end