Class: Berkshelf::APIClient::RemoteCookbook

Inherits:
Object
  • Object
show all
Defined in:
lib/berkshelf/api_client/remote_cookbook.rb

Overview

A representation of cookbook metadata indexed by a Berkshelf API Server. Returned by sending messages to a Berkshelf::APIClient and used to download cookbooks indexed by the Berkshelf API Server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, attributes = {}) ⇒ RemoteCookbook

Returns a new instance of RemoteCookbook.

Parameters:

  • name (String)
  • version (String)
  • attributes (Hash) (defaults to: {})


18
19
20
21
22
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 18

def initialize(name, version, attributes = {})
  @name       = name
  @version    = version
  @attributes = ::Mash.new(attributes)
end

Instance Attribute Details

#nameString (readonly)

Returns:



11
12
13
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 11

def name
  @name
end

#versionString (readonly)

Returns:



13
14
15
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 13

def version
  @version
end

Instance Method Details

#dependenciesHash

Returns:

  • (Hash)


25
26
27
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 25

def dependencies
  @attributes[:dependencies]
end

#location_pathString

Returns:



40
41
42
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 40

def location_path
  @attributes[:location_path]
end

#location_typeSymbol

Returns:

  • (Symbol)


35
36
37
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 35

def location_type
  @attributes[:location_type].to_sym
end

#platformsHash

Returns:

  • (Hash)


30
31
32
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 30

def platforms
  @attributes[:platforms]
end

#to_hashObject



44
45
46
47
48
49
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 44

def to_hash
  {
    name: name,
    version: version,
  }
end

#to_json(options = {}) ⇒ Object



51
52
53
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 51

def to_json(options = {})
  ::JSON.pretty_generate(to_hash, options)
end