Sha256: dd7c17935f0275958cb124042018d82a5b6071c4087552a0b37ea14627d8b65b

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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