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

raw[R]

Public Class Methods

new(raw) click to toggle source

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

builder() click to toggle source

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
compilation_dir() click to toggle source

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
error_message() click to toggle source

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
puppet_version() click to toggle source

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
resource(opts = {}) click to toggle source

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
resources() click to toggle source

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
to_h() click to toggle source

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
to_json() click to toggle source

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
valid?() click to toggle source

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