Class: Api2Convert::Model::Preset
- Inherits:
-
Object
- Object
- Api2Convert::Model::Preset
- Defined in:
- lib/api2convert/model/preset.rb
Overview
A saved conversion preset (a reusable named set of target + options).
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id: nil, name: "", target: nil, category: nil, scope: nil, options: {}) ⇒ Preset
constructor
A new instance of Preset.
Constructor Details
#initialize(id: nil, name: "", target: nil, category: nil, scope: nil, options: {}) ⇒ Preset
Returns a new instance of Preset.
9 10 11 12 13 14 15 16 17 |
# File 'lib/api2convert/model/preset.rb', line 9 def initialize(id: nil, name: "", target: nil, category: nil, scope: nil, options: {}) @id = id @name = name @target = target @category = category @scope = scope @options = freeze end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def category @category end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def @options end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def scope @scope end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
7 8 9 |
# File 'lib/api2convert/model/preset.rb', line 7 def target @target end |
Class Method Details
.from_hash(data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/api2convert/model/preset.rb', line 19 def self.from_hash(data) d = Support::Data.as_object(data) new( id: Support::Data.nullable_str(d["id"]), name: Support::Data.as_str(d["name"]), target: Support::Data.nullable_str(d["target"]), category: Support::Data.nullable_str(d["category"]), scope: Support::Data.nullable_str(d["scope"]), options: Support::Data.as_object(d["options"]) ) end |