Class: OneApi::Conversions
- Inherits:
-
Object
- Object
- OneApi::Conversions
- Defined in:
- lib/oneapi-ruby/objects.rb
Class Method Summary collapse
- .fill_from_json(object, json, is_error = nil) ⇒ Object
- .from_json(classs, json, is_error = nil) ⇒ Object
- .to_json ⇒ Object
Class Method Details
.fill_from_json(object, json, is_error = nil) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/oneapi-ruby/objects.rb', line 111 def self.fill_from_json(object, json, is_error=nil) if is_error object.exception = Conversions.from_json(OneApiError, json, false) return end json = JSONUtils.get_json(json) conversion_rules = OneApiAccessorModifier.get_field_conversion_rules(object.class) for conversion_rule in conversion_rules json_value = JSONUtils.get(json, conversion_rule.json_field_name) value = conversion_rule.from_json(json_value) object.instance_variable_set("@#{conversion_rule.object_field_name}", value) end end |
.from_json(classs, json, is_error = nil) ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/oneapi-ruby/objects.rb', line 103 def self.from_json(classs, json, is_error=nil) object = classs.new Conversions.fill_from_json(object, json, is_error) object end |
.to_json ⇒ Object
126 127 128 |
# File 'lib/oneapi-ruby/objects.rb', line 126 def self.to_json # TODO(TK) end |