Sha256: 7f3b7d4276a32aa1398ba01245b55cf142cf23ed8f51f374f62ce62b41892465

Contents?: true

Size: 868 Bytes

Versions: 22

Compression:

Stored size: 868 Bytes

Contents

module Percy
  class Client
    module Snapshots
      def create_snapshot(build_id, resources, options = {})
        if !resources.respond_to?(:each)
          raise ArgumentError.new(
            'resources argument must be an iterable of Percy::Client::Resource objects')
        end
        name = options[:name]
        data = {
          'data' => {
            'type' => 'snapshots',
            'attributes' => {
              'name' => name,
            },
            'relationships' => {
              'resources' => {
                'data' => resources.map { |r| r.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

22 entries across 22 versions & 1 rubygems

Version Path
percy-client-1.1.0 lib/percy/client/snapshots.rb
percy-client-1.0.0 lib/percy/client/snapshots.rb
percy-client-0.11.0 lib/percy/client/snapshots.rb
percy-client-0.10.0 lib/percy/client/snapshots.rb
percy-client-0.9.0 lib/percy/client/snapshots.rb
percy-client-0.8.0 lib/percy/client/snapshots.rb
percy-client-0.7.0 lib/percy/client/snapshots.rb
percy-client-0.6.0 lib/percy/client/snapshots.rb
percy-client-0.5.0 lib/percy/client/snapshots.rb
percy-client-0.4.1 lib/percy/client/snapshots.rb
percy-client-0.4.0 lib/percy/client/snapshots.rb
percy-client-0.3.2 lib/percy/client/snapshots.rb
percy-client-0.3.1 lib/percy/client/snapshots.rb
percy-client-0.3.0 lib/percy/client/snapshots.rb
percy-client-0.2.11 lib/percy/client/snapshots.rb
percy-client-0.2.10 lib/percy/client/snapshots.rb
percy-client-0.2.9 lib/percy/client/snapshots.rb
percy-client-0.2.8 lib/percy/client/snapshots.rb
percy-client-0.2.7 lib/percy/client/snapshots.rb
percy-client-0.2.6 lib/percy/client/snapshots.rb