Class: OctocatalogDiff::API::V1::Catalog
- Inherits:
-
Object
- Object
- OctocatalogDiff::API::V1::Catalog
- Defined in:
- lib/octocatalog-diff/api/v1/catalog.rb
Overview
This is a wrapper class around OctocatalogDiff::Catalog. This contains the methods we are choosing to expose, and will be a compatibility layer should underlying methods change in the future. The raw object will be available as ‘#raw` but this is not guaranteed to be stable.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#builder ⇒ String
Public: Get the builder for the catalog.
-
#compilation_dir ⇒ String
Public: Get the compilation directory.
-
#error_message ⇒ String
Public: Get the error message.
-
#initialize(raw) ⇒ Catalog
constructor
Constructor: Accepts a raw OctocatalogDiff::Catalog object and stores it.
-
#puppet_version ⇒ String
Public: Get the Puppet version used to compile the catalog.
-
#resource(opts = {}) ⇒ Hash
Public: Get a specific resource identified by type and title.
-
#resources ⇒ Array
Public: Get the resources in the catalog.
-
#to_h ⇒ Hash
Public: Return catalog as hash.
-
#to_json ⇒ String
Public: Get the JSON for the catalog.
-
#valid? ⇒ Boolean
Public: Determine if the catalog build was successful.
Constructor Details
#initialize(raw) ⇒ Catalog
Constructor: Accepts a raw OctocatalogDiff::Catalog object and stores it.
18 19 20 21 22 23 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 18 def initialize(raw) unless raw.is_a?(OctocatalogDiff::Catalog) raise ArgumentError, 'OctocatalogDiff::API::V1::Catalog#initialize expects OctocatalogDiff::Catalog argument' end @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
14 15 16 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 14 def raw @raw end |
Instance Method Details
#builder ⇒ String
Public: Get the builder for the catalog
27 28 29 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 27 def builder @raw.builder end |
#compilation_dir ⇒ String
Public: Get the compilation directory
39 40 41 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 39 def compilation_dir @raw.compilation_dir end |
#error_message ⇒ String
Public: Get the error message
45 46 47 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 45 def @raw. end |
#puppet_version ⇒ String
Public: Get the Puppet version used to compile the catalog
51 52 53 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 51 def puppet_version @raw.puppet_version end |
#resource(opts = {}) ⇒ Hash
Public: Get a specific resource identified by type and title. This is intended for use when a O(1) lookup is required.
60 61 62 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 60 def resource(opts = {}) @raw.resource(opts) end |
#resources ⇒ Array
Public: Get the resources in the catalog
66 67 68 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 66 def resources @raw.resources end |
#to_h ⇒ Hash
Public: Return catalog as hash.
78 79 80 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 78 def to_h @raw.catalog end |
#to_json ⇒ String
Public: Get the JSON for the catalog
33 34 35 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 33 def to_json @raw.catalog_json end |
#valid? ⇒ Boolean
Public: Determine if the catalog build was successful.
72 73 74 |
# File 'lib/octocatalog-diff/api/v1/catalog.rb', line 72 def valid? @raw.valid? end |