Sha256: e3088e5918d0ca2c861eb11e972783e45eca2223b03a1bd1a7754ecb78d601a4

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrythng-0.1.1 lib/evrythng/client/thngs.rb