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.
17 18 19 20 21 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 17 def initialize(name, version, attributes = {}) @name = name @version = version @attributes = ::Mash.new(attributes) end |
Instance Attribute Details
#name ⇒ String (readonly)
10 11 12 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 10 def name @name end |
#version ⇒ String (readonly)
12 13 14 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 12 def version @version end |
Instance Method Details
#dependencies ⇒ Hash
24 25 26 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 24 def dependencies @attributes[:dependencies] end |
#location_path ⇒ String
39 40 41 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 39 def location_path @attributes[:location_path] end |
#location_type ⇒ Symbol
34 35 36 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 34 def location_type @attributes[:location_type].to_sym end |
#platforms ⇒ Hash
29 30 31 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 29 def platforms @attributes[:platforms] end |
#to_hash ⇒ Object
43 44 45 46 47 48 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 43 def to_hash { name: name, version: version } end |
#to_json(options = {}) ⇒ Object
50 51 52 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 50 def to_json( = {}) ::JSON.pretty_generate(to_hash, ) end |