Module: Evrythng::Client::Thngs

Included in:
Evrythng::Client
Defined in:
lib/evrythng/client/thngs.rb

Overview

Defines methods related to thngs

Instance Method Summary collapse

Instance Method Details

#thng(id, options = {}) ⇒ Hash

Returns a single thng, specified by id

Examples:

Return the thng with the id 4f2133f39f5c550c2000016a

Evrythng.thng('4f2133f39f5c550c2000016a')

Parameters:

  • id (String)

    The id of the desired thng.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

    The requested thng.

See Also:



24
25
26
# File 'lib/evrythng/client/thngs.rb', line 24

def thng(id, options={})
  get("thngs/#{id}", options)
end

#thng_create(name, description = nil, options = {}) ⇒ Hash

Creates a thng

Examples:

Create the authenticating user’s thng

Evrythng.thng_create("my.test.thng", "Here comes the description.")

Parameters:

  • name (String)

    The name of thng.

  • description (String) (defaults to: nil)

    The description of thng.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

    The created thng.

See Also:



37
38
39
# File 'lib/evrythng/client/thngs.rb', line 37

def thng_create(name, description=nil, options={})
  post("thngs", options.merge(:name => name, :description => description))
end

#thng_update(id, options = {}) ⇒ Hash

Updates a thng

Examples:

Update the authenticating user’s thng with id 4f2133f39f5c550c2000016a

Evrythng.thng_update('4f2133f39f5c550c2000016a', :name => 'my.test.thng.updated')

Parameters:

  • id (String)

    The id of thng.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

    The updated thng.

See Also:



49
50
51
# File 'lib/evrythng/client/thngs.rb', line 49

def thng_update(id, options={})
  put("thngs/#{id}", options)
end

#thngs(options = {}) ⇒ Array

Returns a list of thngs

Examples:

Return the list of thngs

Evrythng.thngs

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Array)

    The requested list of thngs.

See Also:



12
13
14
# File 'lib/evrythng/client/thngs.rb', line 12

def thngs(options={})
  get('thngs', options)
end