Class: BuildkiteGraphqlRuby::ResultsParsers::Artifact

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/buildkite_graphql_ruby/results_parsers/artifact.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_response(response) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/buildkite_graphql_ruby/results_parsers/artifact.rb', line 4

def self.from_response(response)
  node = response['node']
  # node.keys ["id", "path", "state", "downloadURL"]
  
  new(
    id: node['id'],
    path: node['path'],
    state: node['state'],
    download_url: node['downloadURL'],
  )
end

Instance Method Details

#downloadObject



18
19
20
21
22
# File 'lib/buildkite_graphql_ruby/results_parsers/artifact.rb', line 18

def download
  require 'open-uri'
  file_contents = open(self.download_url) { |f| f.read }
  file_contents
end