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: {})


16
17
18
19
20
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 16

def initialize(name, version, attributes = {})
  @name       = name
  @version    = version
  @attributes = attributes
end

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 9

def name
  @name
end

#versionString (readonly)

Returns:

  • (String)


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

def version
  @version
end

Instance Method Details

#dependenciesHash

Returns:

  • (Hash)


23
24
25
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 23

def dependencies
  @attributes[:dependencies]
end

#location_pathString

Returns:

  • (String)


38
39
40
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 38

def location_path
  @attributes[:location_path]
end

#location_typeSymbol

Returns:

  • (Symbol)


33
34
35
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 33

def location_type
  @attributes[:location_type].to_sym
end

#platformsHash

Returns:

  • (Hash)


28
29
30
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 28

def platforms
  @attributes[:platforms]
end

#to_hashObject



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

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

#to_json(options = {}) ⇒ Object



49
50
51
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 49

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