Class: ArtRest::Artifact

Inherits:
Resource
  • Object
show all
Includes:
DirEntry
Defined in:
lib/artrest/dir_entry.rb

Overview

Represents an Artifactory File Info resource.

Example

file = ArtRest::File.new('http://localhost:8081/artifactory/api/storage/libs-release-local/commons-lang/commons-lang/3.2/commons-lang-3.2.jar', { ... })

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DirEntry

create_node

Methods inherited from Resource

#base_url, check_options, #content, #content!, #content=, create, inherited, #initialize, mime_type=, resource_attributes, #unparsed_content

Constructor Details

This class inherits a constructor from ArtRest::Resource

Class Method Details

.matches_path(path, options) ⇒ Object

:nodoc:



82
83
84
85
86
# File 'lib/artrest/dir_entry.rb', line 82

def matches_path(path, options) # :nodoc:
    return false unless path =~ %r|^/api/storage/[a-zA-Z0-9_.+-]+/.+$|
        content_hash = JSON.parse(RestClient::Resource.new([options[:base_url], path].join, options[:user], options[:password]).get)
    return ! content_hash['children']
end

Instance Method Details

#[](suburl, &new_block) ⇒ Object

Overwritten to always throw NotImplementedError since ArtRest::Artifacts don’t have sub resources.

Raises:

  • (NotImplementedError)


111
112
113
# File 'lib/artrest/dir_entry.rb', line 111

def [](suburl, &new_block)
    raise NotImplementedError.new("Instances of ArtRest::Artifact don't have child resources")
end