Class: Berkshelf::APIClient::RemoteCookbook
- Inherits:
-
Object
- Object
- Berkshelf::APIClient::RemoteCookbook
- 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
- #name ⇒ String readonly
- #version ⇒ String readonly
Instance Method Summary collapse
- #dependencies ⇒ Hash
-
#initialize(name, version, attributes = {}) ⇒ RemoteCookbook
constructor
A new instance of RemoteCookbook.
- #location_path ⇒ String
- #location_type ⇒ Symbol
- #platforms ⇒ Hash
- #to_hash ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(name, version, attributes = {}) ⇒ RemoteCookbook
Returns a new instance of RemoteCookbook.
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
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 11 def name @name end |
#version ⇒ String (readonly)
13 14 15 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 13 def version @version end |
Instance Method Details
#dependencies ⇒ Hash
25 26 27 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 25 def dependencies @attributes[:dependencies] end |
#location_path ⇒ String
40 41 42 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 40 def location_path @attributes[:location_path] end |
#location_type ⇒ Symbol
35 36 37 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 35 def location_type @attributes[:location_type].to_sym end |
#platforms ⇒ Hash
30 31 32 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 30 def platforms @attributes[:platforms] end |
#to_hash ⇒ Object
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( = {}) ::JSON.pretty_generate(to_hash, ) end |