module Percy::Client::Resources
Public Instance Methods
upload_resource(build_id, content)
click to toggle source
# File lib/percy/client/resources.rb, line 69 def upload_resource(build_id, content) sha = Digest::SHA256.hexdigest(content) data = { 'data' => { 'type' => 'resources', 'id' => sha, 'attributes' => { 'base64-content' => Base64.strict_encode64(content), }, }, } begin post("#{config.api_url}/builds/#{build_id}/resources/", data) rescue Percy::Client::ConflictError => e raise e if e.status != 409 STDERR.puts "[percy] Warning: unnecessary resource reuploaded with SHA-256: #{sha}" end true end