Sha256: c696983dffb68ec017ada54c2697058c1f737d55b2a7e9553d639f1d0df82c2a
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
module Evrythng class Client # Defines methods related to properties module Properties # Returns a list of properties for a given thng # # @param thng_id [String] The id of the thng to get properties for. # @param options [Hash] A customizable set of options. # @return [Array] The requested list of properties. # @see http://dev.evrythng.com/properties # @example Return the list of properties for thng 4f2133f39f5c550c2000016a # Evrythng.properties('4f2133f39f5c550c2000016a') def properties(thng_id, options={}) get("thngs/#{thng_id}/properties", options) end # Returns a single property, specified by key # # @param thng_id [String] The id of the thng to get property for. # @param key [String] The key of a property to fetch. # @param options [Hash] A customizable set of options. # @return [Hash] The requested property. # @see http://dev.evrythng.com/properties # @example Return the property with key 'Volume' for the thng with id 4f2133f39f5c550c2000016a # Evrythng.property('4f2133f39f5c550c2000016a', 'Volume') def property(thng_id, key, options={}) get("thngs/#{thng_id}/properties/#{key}", options) end # Creates a property # # @param thng_id [String] The id of the thng to create property for. # @param key [String] The key of property. # @param value [String] The value of property. # @param options [Hash] A customizable set of options. # @return [Hash] The created property. # @see http://dev.evrythng.com/properties # @example Create a property for a thng with id 4f2133f39f5c550c2000016a # Evrythng.property_create('4f2133f39f5c550c2000016a', 'Volume', '30') def property_create(thng_id, key, value, options={}) post("thngs/#{thng_id}/properties", options.merge(:key => key, :value => value)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
evrythng-0.1.0 | lib/evrythng/client/properties.rb |