Sha256: 49d96a67afcd5e7b5f73211c0d5b33ee9993be6d916fea367a9950ec79aee0df
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
module Percy class Client module Snapshots def create_snapshot(build_id, resources, options = {}) unless resources.respond_to?(:each) raise ArgumentError, 'resources argument must be an iterable of Percy::Client::Resource objects' end widths = options[:widths] || config.default_widths data = { 'data' => { 'type' => 'snapshots', 'attributes' => { 'name' => options[:name], 'enable-javascript' => options[:enable_javascript], 'scope' => options[:scope_selector], 'minimum-height' => options[:minimum_height], 'widths' => widths, }, 'relationships' => { 'resources' => { 'data' => resources.map(&:serialize), }, }, }, } post("#{config.api_url}/builds/#{build_id}/snapshots/", data) end def finalize_snapshot(snapshot_id) post("#{config.api_url}/snapshots/#{snapshot_id}/finalize", {}) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems