Sha256: 5a72e6775b0479ee3622bc348db4c06376b14f9bbf20c8364755298270082541

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
percy-client-0.2.3 lib/percy/client/snapshots.rb