Module: InfobipApi::InfobipApiAccessorModifier

Included in:
InfobipApiModel
Defined in:
lib/infobipapi/objects.rb

Constant Summary collapse

@@field_conversion_rules =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_field_conversion_rules(classs) ⇒ Object



177
178
179
# File 'lib/infobipapi/objects.rb', line 177

def InfobipApiAccessorModifier.get_field_conversion_rules(classs)
    @@field_conversion_rules[classs]
end

Instance Method Details

#infobipapi_attr_accessor(attr, field_conversion_rule) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/infobipapi/objects.rb', line 160

def infobipapi_attr_accessor(attr, field_conversion_rule)
    attr_accessor attr

    field_conversion_rule.object_field_name = attr

    if Utils.empty(field_conversion_rule.json_field_name)
        field_conversion_rule.json_field_name = attr
    end

    if not @@field_conversion_rules.has_key? self then
        @@field_conversion_rules[self] = []
    end

    @@field_conversion_rules[self].push field_conversion_rule
    #puts "field_conversion_rules is now #{@@field_conversion_rules}"
end