ignacio-chiazzo/ruby_whatsapp_sdk

Responses must return objects, never copy the attributes

Opened this issue · 0 comments

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: