Module: ChefAPI

Extended by:
Configurable
Defined in:
lib/chef-api/authentication.rb,
lib/chef-api.rb,
lib/chef-api/util.rb,
lib/chef-api/errors.rb,
lib/chef-api/schema.rb,
lib/chef-api/version.rb,
lib/chef-api/boolean.rb,
lib/chef-api/defaults.rb,
lib/chef-api/resource.rb,
lib/chef-api/validator.rb,
lib/chef-api/multipart.rb,
lib/chef-api/connection.rb,
lib/chef-api/configurable.rb,
lib/chef-api/resources/base.rb,
lib/chef-api/resources/user.rb,
lib/chef-api/resources/role.rb,
lib/chef-api/resources/node.rb,
lib/chef-api/validators/base.rb,
lib/chef-api/validators/type.rb,
lib/chef-api/resources/search.rb,
lib/chef-api/error_collection.rb,
lib/chef-api/resources/client.rb,
lib/chef-api/resources/data_bag.rb,
lib/chef-api/resources/data_bag.rb,
lib/chef-api/resources/cookbook.rb,
lib/chef-api/resources/principal.rb,
lib/chef-api/validators/required.rb,
lib/chef-api/resources/environment.rb,
lib/chef-api/resources/organization.rb,
lib/chef-api/resources/data_bag_item.rb,
lib/chef-api/resources/partial_search.rb,
lib/chef-api/resources/collection_proxy.rb,
lib/chef-api/resources/cookbook_version.rb

Overview

DEBUG steps:

check .chomp

Defined Under Namespace

Modules: Boolean, Configurable, Defaults, Error, Multipart, Resource, Util, Validator Classes: Authentication, Connection, ErrorCollection, Schema

Constant Summary collapse

UNSET =
TODO:

Document this and why it's important

Object.new
VERSION =
'0.5.0'

Class Method Summary collapse

Methods included from Configurable

configure, keys, reset!

Class Method Details

.connectionChefAPI::Connection

API connection object based off the configured options in Configurable.

Returns:


68
69
70
71
72
73
74
# File 'lib/chef-api.rb', line 68

def connection
  unless @connection && @connection.same_options?(options)
    @connection = ChefAPI::Connection.new(options)
  end

  @connection
end

.log_levelSymbol

Get the current log level.

Returns:

  • (Symbol)

49
50
51
# File 'lib/chef-api.rb', line 49

def log_level
  Logify.level
end

.log_level=(level) ⇒ Object

Set the log level.

Examples:

Set the log level to :info

ChefAPI.log_level = :info

Parameters:

  • level (Symbol)

    the log level to set


40
41
42
# File 'lib/chef-api.rb', line 40

def log_level=(level)
  Logify.level = level
end

.method_missing(m, *args, &block) ⇒ Object

Delegate all methods to the connection object, essentially making the module object behave like a Connection.


80
81
82
83
84
85
86
# File 'lib/chef-api.rb', line 80

def method_missing(m, *args, &block)
  if connection.respond_to?(m)
    connection.send(m, *args, &block)
  else
    super
  end
end

.respond_to_missing?(m, include_private = false) ⇒ Boolean

Delegating respond_to to the Connection.

Returns:


91
92
93
# File 'lib/chef-api.rb', line 91

def respond_to_missing?(m, include_private = false)
  connection.respond_to?(m) || super
end

.rootPathname

The source root of the ChefAPI gem. This is useful when requiring files that are relative to the root of the project.

Returns:

  • (Pathname)

59
60
61
# File 'lib/chef-api.rb', line 59

def root
  @root ||= Pathname.new(File.expand_path('../../', __FILE__))
end