Class: Runcible::Resources::Unit

Inherits:
Base
  • Object
show all
Defined in:
lib/runcible/resources/unit.rb

Overview

Direct Known Subclasses

Extensions::Unit

Class Method Summary collapse

Methods inherited from Base

add_http_auth_header, add_oauth_header, call, combine_get_params, config, config=, generate_log_message, generate_payload, get_response, log_debug, log_exception, process_response, required_params

Class Method Details

.path(type) ⇒ String

Generates the API path for Units

Parameters:

  • type (String)

    the unit type

Returns:

  • (String)

    the unit search path



34
35
36
# File 'lib/runcible/resources/unit.rb', line 34

def self.path(type)
  "content/units/#{type}/search/"
end

.search(type, criteria, optional = {}) ⇒ RestClient::Response

Searches a given unit type based on criteria

Parameters:

  • type (String)

    the unit type

  • criteria (Hash)

    criteria object containing Mongo syntax

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

    container for all optional parameters

Returns:

  • (RestClient::Response)


44
45
46
# File 'lib/runcible/resources/unit.rb', line 44

def self.search(type, criteria, optional={})
  call(:post, path(type), :payload=>{:required=>{:criteria=>criteria}, :optional=>optional})
end