class Refile::Signature

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.

Attributes

as[R]

@return [String] the name of the field that the file will be uploaded as.

fields[R]

@return [String] additional fields to be sent alongside the file.

id[R]

@return [String] the id the file will receive once uploaded.

url[R]

@return [String] the url the file should be uploaded to.

Public Class Methods

new(as:, id:, url:, fields:) click to toggle source

@api private

# File lib/refile/signature.rb, line 19
def initialize(as:, id:, url:, fields:)
  @as = as
  @id = id
  @url = url
  @fields = fields
end

Public Instance Methods

as_json(*) click to toggle source

@return [Hash{Symbol => Object}] an object suitable for serialization to JSON

# File lib/refile/signature.rb, line 27
def as_json(*)
  { as: @as, id: @id, url: @url, fields: @fields }
end
to_json(*) click to toggle source

@return [String] the signature serialized as JSON

# File lib/refile/signature.rb, line 32
def to_json(*)
  as_json.to_json
end