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.
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
#name ⇒ String (readonly)
9 10 11 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 9 def name @name end |
#version ⇒ String (readonly)
11 12 13 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 11 def version @version end |
Instance Method Details
#dependencies ⇒ Hash
23 24 25 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 23 def dependencies @attributes[:dependencies] end |
#location_path ⇒ String
38 39 40 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 38 def location_path @attributes[:location_path] end |
#location_type ⇒ Symbol
33 34 35 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 33 def location_type @attributes[:location_type].to_sym end |
#platforms ⇒ Hash
28 29 30 |
# File 'lib/berkshelf/api_client/remote_cookbook.rb', line 28 def platforms @attributes[:platforms] end |
#to_hash ⇒ Object
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( = {}) ::JSON.pretty_generate(to_hash, ) end |