Class: Buildbox::Artifact

Inherits:
Object
  • Object
show all
Defined in:
lib/buildbox/artifact.rb

Defined Under Namespace

Classes: Collector, Poster, Uploader

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, glob_path, name, path, original_path) ⇒ Artifact

Returns a new instance of Artifact.



16
17
18
19
20
21
22
# File 'lib/buildbox/artifact.rb', line 16

def initialize(id, glob_path, name, path, original_path)
  @id            = id
  @glob_path     = glob_path
  @name          = name
  @path          = path
  @original_path = original_path
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/buildbox/artifact.rb', line 9

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/buildbox/artifact.rb', line 9

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/buildbox/artifact.rb', line 9

def path
  @path
end

#remote_idObject

Returns the value of attribute remote_id.



10
11
12
# File 'lib/buildbox/artifact.rb', line 10

def remote_id
  @remote_id
end

#upload_instructionsObject

Returns the value of attribute upload_instructions.



10
11
12
# File 'lib/buildbox/artifact.rb', line 10

def upload_instructions
  @upload_instructions
end

Class Method Details

.create(glob_path, name, path, original_path) ⇒ Object



12
13
14
# File 'lib/buildbox/artifact.rb', line 12

def self.create(glob_path, name, path, original_path)
  new(SecureRandom.uuid, glob_path, name, path, original_path)
end

Instance Method Details

#as_jsonObject



28
29
30
31
32
33
34
35
# File 'lib/buildbox/artifact.rb', line 28

def as_json
  { :id            => @id,
    :glob_path     => @glob_path,
    :name          => @name,
    :path          => @path,
    :original_path => @original_path,
    :file_size     => File.size(@path) }
end

#basenameObject



24
25
26
# File 'lib/buildbox/artifact.rb', line 24

def basename
  File.basename(@path)
end