class OctocatalogDiff::API::V1::Catalog
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.
Attributes
Public Class Methods
Constructor: Accepts a raw OctocatalogDiff::Catalog
object and stores it. @param raw [OctocatalogDiff::Catalog] Catalog
object
# 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
Public Instance Methods
Public: Get the builder for the catalog @return [String] Class
of backend used
# File lib/octocatalog-diff/api/v1/catalog.rb, line 27 def builder @raw.builder end
Public: Get the compilation directory @return [String] Compilation directory
# File lib/octocatalog-diff/api/v1/catalog.rb, line 39 def compilation_dir @raw.compilation_dir end
Public: Get the error message @return [String] Error message, or nil if no error
# File lib/octocatalog-diff/api/v1/catalog.rb, line 45 def error_message @raw.error_message end
Public: Get the Puppet version used to compile the catalog @return [String] Puppet version
# File lib/octocatalog-diff/api/v1/catalog.rb, line 51 def puppet_version @raw.puppet_version end
Public: Get a specific resource identified by type and title. This is intended for use when a O(1) lookup is required. @param :type [String] Type of resource @param :title [String] Title of resource @return [Hash] Resource item
# File lib/octocatalog-diff/api/v1/catalog.rb, line 60 def resource(opts = {}) @raw.resource(opts) end
Public: Get the resources in the catalog @return [Array] Resource array
# File lib/octocatalog-diff/api/v1/catalog.rb, line 66 def resources @raw.resources end
Public: Return catalog as hash. @return [Hash] Catalog
as hash
# File lib/octocatalog-diff/api/v1/catalog.rb, line 78 def to_h @raw.catalog end
Public: Get the JSON for the catalog @return [String] Catalog
JSON
# File lib/octocatalog-diff/api/v1/catalog.rb, line 33 def to_json @raw.catalog_json end
Public: Determine if the catalog build was successful. @return [Boolean] Whether the catalog is valid
# File lib/octocatalog-diff/api/v1/catalog.rb, line 72 def valid? @raw.valid? end