diff --git a/app/models/callout_participation.rb b/app/models/callout_participation.rb index 42630034d..3860a6571 100644 --- a/app/models/callout_participation.rb +++ b/app/models/callout_participation.rb @@ -32,6 +32,13 @@ def self.still_trying(max_phone_calls) where(answered: false).where(arel_table[:phone_calls_count].lt(max_phone_calls)) end + # NOTE: This is for backward compatibility until we moved to the new API + def as_json(*) + result = super + result["msisdn"] = result.delete("phone_number") + result + end + private def set_phone_number_from_contact diff --git a/app/models/contact.rb b/app/models/contact.rb index 551a325f8..66a6051ac 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -31,7 +31,7 @@ def self.jsonapi_serializer_class # NOTE: This is for backward compatibility until we moved to the new API def as_json(*) result = super - result["msisdn"] = result["phone_number"] + result["msisdn"] = result.delete("phone_number") result end end diff --git a/app/models/phone_call.rb b/app/models/phone_call.rb index 223e6d22a..0071dc1f2 100644 --- a/app/models/phone_call.rb +++ b/app/models/phone_call.rb @@ -140,7 +140,7 @@ def remote_call_expired? # NOTE: This is for backward compatibility until we moved to the new API def as_json(*) result = super - result["msisdn"] = result["phone_number"] + result["msisdn"] = result.delete("phone_number") result end