Sha256: fd2f9ad0c774a56e3699f0243890f82725e9a3ec9c258ca58684d461398d8cd1

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

module Evrythng
  class Client
    # Defines methods related to thngs
    module Thngs
      # Returns a list of thngs
      #
      # @format :json, :xml
      # @authenticated true
      # @rate_limited true
      # @param options [Hash] A customizable set of options.
      # @return [Hashie::Mash] The requested list of thngs.
      # @see http://developer.evrythng.net/thngs
      # @example Return the list of thngs
      #   Evrythng.thngs
      def thngs(options={})
        response = get('thngs', options)
        format.to_s.downcase == 'xml' ? response['thngs'] : response
      end

      # Creates a thng
      #
      # @format :json, :xml
      # @authenticated true
      # @rate_limited false
      # @param identifier [String] The identifier of thng.
      # @param description [String] The description of thng.
      # @param options [Hash] A customizable set of options.
      # @return [Hashie::Mash] The created thng.
      # @see http://developer.evrythng.net/thngs
      # @example Create the authenticating user's thng
      #   Evrythng.thng_create("my.test.thng", "Here comes the description.")
      def thng_create(identifier, description=nil, options={})
        response = post('thngs', options.merge(:thng => { :identifier => identifier, :description => description }))
        format.to_s.downcase == 'xml' ? response['thng'] : response
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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