Class: Spice::Environment

Inherits:
Object
  • Object
show all
Extended by:
Persistence
Includes:
Persistence, Toy::Store
Defined in:
lib/spice/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Persistence

all, connection, do_delete, do_post, do_put, endpoint, get, included

Instance Attribute Details

#attrsHash

Returns the attrs attribute

Returns:

  • (Hash)

    the attrs attribute



16
# File 'lib/spice/environment.rb', line 16

attribute :attrs, Hash, :default => {}

#chef_typeString

Returns the chef_type attribute

Returns:

  • (String)

    the chef_type attribute



18
# File 'lib/spice/environment.rb', line 18

attribute :chef_type, String, :default => "environment"

#cookbook_versionsHash

Returns the cookbook_versions attribute

Returns:

  • (Hash)

    the cookbook_versions attribute



19
# File 'lib/spice/environment.rb', line 19

attribute :cookbook_versions, Hash, :default => {}

#descriptionString

Returns the description attribute

Returns:

  • (String)

    the description attribute



15
# File 'lib/spice/environment.rb', line 15

attribute :description, String

#json_classString

Returns the json_class attribute

Returns:

  • (String)

    the json_class attribute



17
# File 'lib/spice/environment.rb', line 17

attribute :json_class, String, :default => "Chef::Environment"

#nameString

Returns the name attribute

Returns:

  • (String)

    the name attribute



14
# File 'lib/spice/environment.rb', line 14

attribute :name, String

Instance Method Details

#new_record?Boolean

Check if the environment exists on the Chef server

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/spice/environment.rb', line 24

def new_record?
  connection.get("/environments/#{name}")
  return false
rescue Spice::Error::NotFound
  return true
end