Class: Api2Convert::Model::Conversion

Inherits:
Object
  • Object
show all
Defined in:
lib/api2convert/model/conversion.rb

Overview

A single conversion within a job: the target format plus its options.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target: "", id: nil, category: nil, options: {}, metadata: {}, output_targets: []) ⇒ Conversion

Returns a new instance of Conversion.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/api2convert/model/conversion.rb', line 9

def initialize(target: "", id: nil, category: nil, options: {}, metadata: {},
               output_targets: [])
  @target = target
  @id = id
  @category = category
  @options = options
  @metadata = 
  # Cloud delivery targets for this conversion's output, if any.
  @output_targets = output_targets
  freeze
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def category
  @category
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def 
  @metadata
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def options
  @options
end

#output_targetsObject (readonly)

Returns the value of attribute output_targets.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def output_targets
  @output_targets
end

#targetObject (readonly)

Returns the value of attribute target.



7
8
9
# File 'lib/api2convert/model/conversion.rb', line 7

def target
  @target
end

Class Method Details

.from_hash(data) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/api2convert/model/conversion.rb', line 21

def self.from_hash(data)
  d = Support::Data.as_object(data)
  new(
    target: Support::Data.as_str(d["target"]),
    id: Support::Data.nullable_str(d["id"]),
    category: Support::Data.nullable_str(d["category"]),
    options: Support::Data.as_object(d["options"]),
    metadata: Support::Data.as_object(d["metadata"]),
    output_targets: Support::Data.map_objects(d["output_target"]) { |x| OutputTarget.from_hash(x) }
  )
end