Class: Refile::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/refile/signature.rb

Overview

A signature summarizes an HTTP request a client can make to upload a file to directly upload a file to a backend. This signature is usually generated by a backend's presign method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#asString (readonly)

Returns the name of the field that the file will be uploaded as.

Returns:

  • (String)

    the name of the field that the file will be uploaded as.


7
8
9
# File 'lib/refile/signature.rb', line 7

def as
  @as
end

#fieldsString (readonly)

Returns additional fields to be sent alongside the file.

Returns:

  • (String)

    additional fields to be sent alongside the file.


16
17
18
# File 'lib/refile/signature.rb', line 16

def fields
  @fields
end

#idString (readonly)

Returns the id the file will receive once uploaded.

Returns:

  • (String)

    the id the file will receive once uploaded.


10
11
12
# File 'lib/refile/signature.rb', line 10

def id
  @id
end

#urlString (readonly)

Returns the url the file should be uploaded to.

Returns:

  • (String)

    the url the file should be uploaded to.


13
14
15
# File 'lib/refile/signature.rb', line 13

def url
  @url
end

Instance Method Details

#as_jsonHash{Symbol => Object}

Returns an object suitable for serialization to JSON.

Returns:

  • (Hash{Symbol => Object})

    an object suitable for serialization to JSON


27
28
29
# File 'lib/refile/signature.rb', line 27

def as_json(*)
  { as: @as, id: @id, url: @url, fields: @fields }
end