Sha256: f051bb25c26418da13a6e0d4cd5458cb9bdb751aa0b708d42f656592fefbf9fd

Contents?: true

Size: 437 Bytes

Versions: 8

Compression:

Stored size: 437 Bytes

Contents

module HammerCLIForeman

  class OperationNotSupportedError < StandardError; end

  module ResourceSupportedTest

    def execute
      if resource_supported?
        super
      else
        raise OperationNotSupportedError, "The server does not support such operation."
      end
    end

    def resource_supported?
      resource.call(:index)
      true
    rescue RestClient::ResourceNotFound => e
      false
    end

  end

end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hammer_cli_foreman-0.0.18 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.17 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.16 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.15 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.14 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.13 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.12 lib/hammer_cli_foreman/resource_supported_test.rb
hammer_cli_foreman-0.0.11 lib/hammer_cli_foreman/resource_supported_test.rb