Responses must return objects, never copy the attributes
Opened this issue · 0 comments
ignacio-chiazzo commented
Responses must return objects never copy the fields.
Context
The API returns a JSON object which is converted to a Response object.
We also have resources that model the different artifacts Whatsapp provides: Message, Media (image/video/document), component among others.
Problem
Some of the responses have implemented fields as opposed to contain resources. For example
# bad
class MessageDataResponse
attr_accessor: URL
attr_accessor: id
end
# good
class MessageDataResponse
attr_accessor: message # message contains URL, id and others
end
Action items
Update the following responses:
- The MediaDataResponse must contain a media.
- The PhoneNumberDataResponse must contain phone numbers.
-
BusinessProfileDataResponse
must contain a business resource (it doesn't exist yet).