Sha256: 220c4269bc8c88e9bf1a6e25ec5aa606713b92ab749249038ace984711e41d10

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true

module CircleCIReporter
  # Encapsulate a CircleCI artifact
  #
  # @attr path [String] abstract path to the artifact in CircleCI container
  # @attr url [String] URL of the artifact
  # @attr node_index [Integer] the ID of the artifact's container
  Artifact = Struct.new(:path, :url, :node_index) do
    # @param value [String]
    # @param node_index [Integer, nil]
    # @return [Boolean]
    def match?(value, node_index: nil)
      path.end_with?(value) && (node_index.nil? || self.node_index == node_index)
    end

    # @return [String] content of the artifact
    def body
      @body ||= CircleCIReporter.client.get(url).body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
circleci_reporter-1.0.1 lib/circleci_reporter/artifact.rb
circleci_reporter-1.0.0 lib/circleci_reporter/artifact.rb