Class: InfobipApi::Conversions
- Inherits:
-
Object
- Object
- InfobipApi::Conversions
- Defined in:
- lib/infobipapi/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
135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/infobipapi/objects.rb', line 135 def self.fill_from_json(object, json, is_error = nil) if is_error return Conversions.from_json(InfobipApiError, json, false) end json = JSONUtils.get_json(json) conversion_rules = InfobipApiAccessorModifier.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 object end |
.from_json(classs, json, is_error = nil) ⇒ Object
129 130 131 132 133 |
# File 'lib/infobipapi/objects.rb', line 129 def self.from_json(classs, json, is_error = nil) object = classs.new Conversions.fill_from_json(object, json, is_error) end |
.to_json ⇒ Object
150 151 152 |
# File 'lib/infobipapi/objects.rb', line 150 def self.to_json # TODO(TK) end |