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: {}) ⇒ Conversion

Returns a new instance of Conversion.



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

def initialize(target: "", id: nil, category: nil, options: {}, metadata: {})
  @target = target
  @id = id
  @category = category
  @options = options
  @metadata = 
  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

#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



18
19
20
21
22
23
24
25
26
27
# File 'lib/api2convert/model/conversion.rb', line 18

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"])
  )
end