Class: Onering::API::Configuration

Inherits:
Onering::API show all
Defined in:
lib/onering/plugins/config.rb

Constant Summary

Constants inherited from Onering::API

DEFAULT_BASE, DEFAULT_CLIENT_KEY, DEFAULT_CLIENT_PEM, DEFAULT_PATH, DEFAULT_VALIDATION_PEM

Constants included from Util

Util::HTTP_STATUS_CODES

Instance Attribute Summary

Attributes inherited from Onering::API

#url

Instance Method Summary collapse

Methods inherited from Onering::API

#_default_param, #_setup_auth, #_setup_auth_token, #connect, #delete, #initialize, #method_missing, #post, #put, #request, #status

Methods included from Util

#fact, #gem_path, #http_status, #make_filter

Constructor Details

This class inherits a constructor from Onering::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Onering::API

Instance Method Details

#get(key, options = {}) ⇒ Object



4
5
6
# File 'lib/onering/plugins/config.rb', line 4

def get(key, options={})
  get("/config/#{key}").parsed_response
end

#save(key, data = nil, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/onering/plugins/config.rb', line 16

def save(key, data=nil, &block)
  if block_given?
    post("/config/#{key}", {}, &block)
  else
    post("/config/#{key}", {
      :body => data
    })
  end
end

#set(key, value) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/onering/plugins/config.rb', line 8

def set(key, value)
  if not value.is_a?(Hash) and not value.is_a?(Array)
    return save(key, value)
  end

  return nil
end