lib/evrythng/client/properties.rb in evrythng-0.1.0 vs lib/evrythng/client/properties.rb in evrythng-0.1.1
- old
+ new
@@ -38,8 +38,22 @@
# @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
+
+ # Updates a property
+ #
+ # @param thng_id [String] The id of the thng to update 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 updated property.
+ # @see http://dev.evrythng.com/properties
+ # @example Update 'Volume' property for a thng with id 4f2133f39f5c550c2000016a
+ # Evrythng.property_update('4f2133f39f5c550c2000016a', 'Volume', '40')
+ def property_update(thng_id, key, value, options={})
+ put("thngs/#{thng_id}/properties/#{key}", options.merge(:value => value))
+ end
end
end
end