Class: Api2Convert::Model::OutputTarget
- Inherits:
-
Object
- Object
- Api2Convert::Model::OutputTarget
- Defined in:
- lib/api2convert/model/output_target.rb
Overview
A cloud-storage delivery target for a conversion's output:
{ type:<provider>, parameters, credentials }.
Attach one (or more) to a conversion via
client.convert(..., output_targets: [...]) / convert_async(...), or
inline in a raw jobs.create conversion map. When any output target is set
the conversion delivers straight to your storage and produces no local
output — so convert returns the completed job without downloading.
This wave ships the generic shape only (type + free-form
parameters/credentials); the per-provider output keys live in a separate
service and diverge per provider, so there are no per-provider output
factories yet.
Serialization (#to_h) emits { type, parameters, credentials } and
omits status (server-set, read-only). On read (OutputTarget.from_hash) type,
parameters and status round-trip as raw values; credentials are
never surfaced (the API returns them empty). credentials ride in the
plaintext body, so #inspect masks the whole object to [REDACTED].
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.from_hash(data) ⇒ Object
Hydrate from a
GET /jobs/{id}output_target[]element. -
.of(type, parameters: {}, credentials: {}) ⇒ Object
Generic constructor accepting a CloudProvider constant or a forward-compat string.
Instance Method Summary collapse
-
#initialize(type:, parameters: {}, credentials: {}, status: nil) ⇒ OutputTarget
constructor
statusis server-set on read (waiting|uploading|completed|failed) and never sent on create. -
#inspect ⇒ Object
Redacted representation — credentials masked.
-
#to_h ⇒ Object
The wire descriptor sent on create —
{ type, parameters, credentials }, withstatusomitted (server-set, read-only). - #to_s ⇒ Object
Constructor Details
#initialize(type:, parameters: {}, credentials: {}, status: nil) ⇒ OutputTarget
status is server-set on read (waiting|uploading|completed|failed) and
never sent on create.
29 30 31 32 33 34 35 |
# File 'lib/api2convert/model/output_target.rb', line 29 def initialize(type:, parameters: {}, credentials: {}, status: nil) @type = type @parameters = parameters @credentials = credentials @status = status freeze end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
25 26 27 |
# File 'lib/api2convert/model/output_target.rb', line 25 def credentials @credentials end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
25 26 27 |
# File 'lib/api2convert/model/output_target.rb', line 25 def parameters @parameters end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
25 26 27 |
# File 'lib/api2convert/model/output_target.rb', line 25 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
25 26 27 |
# File 'lib/api2convert/model/output_target.rb', line 25 def type @type end |
Class Method Details
.from_hash(data) ⇒ Object
Hydrate from a GET /jobs/{id} output_target[] element. type/status
stay raw strings (an unknown provider round-trips untyped); credentials
are deliberately not surfaced.
56 57 58 59 60 61 62 63 64 |
# File 'lib/api2convert/model/output_target.rb', line 56 def self.from_hash(data) d = Support::Data.as_object(data) new( type: Support::Data.as_str(d["type"]), parameters: Support::Data.as_object(d["parameters"]), credentials: {}, status: Support::Data.nullable_str(d["status"]) ) end |
.of(type, parameters: {}, credentials: {}) ⇒ Object
Generic constructor accepting a CloudProvider constant or a forward-compat string.
39 40 41 |
# File 'lib/api2convert/model/output_target.rb', line 39 def self.of(type, parameters: {}, credentials: {}) new(type: type.to_s, parameters: parameters, credentials: credentials) end |
Instance Method Details
#inspect ⇒ Object
Redacted representation — credentials masked. Safe to log.
67 68 69 70 71 |
# File 'lib/api2convert/model/output_target.rb', line 67 def inspect "#<#{self.class.name} type=#{@type.inspect} " \ "parameters=#{Support::Redactor.parameters(@parameters).inspect} " \ "credentials=#{Support::Redactor::MARKER} status=#{@status.inspect}>" end |
#to_h ⇒ Object
The wire descriptor sent on create — { type, parameters, credentials },
with status omitted (server-set, read-only).
45 46 47 48 49 50 51 |
# File 'lib/api2convert/model/output_target.rb', line 45 def to_h { "type" => @type, "parameters" => @parameters, "credentials" => @credentials } end |
#to_s ⇒ Object
73 74 75 |
# File 'lib/api2convert/model/output_target.rb', line 73 def to_s inspect end |