This is a little out of order since it's been a while since my last post on the gem I helped build, but I wanted to get it out there. Feel free to refresh your memory by re-reading these posts 1, 2, and 3. The action class is a small, fairly simple class that is mostly used to just outline all of the attributes in an action item and then also distinguished a few method for specific attributes which are more common or may be requested more often.
The whole class looks like this:
class Action
attr_reader :attributes
def initialize(params)
@attributes = params
end
def title
@title = attributes['title']
end
def description
@description = attributes['description']
end
def reference_name
@reference_name = attributes['reference_name']
end
def action_key
@action_key = attributes['action_key']
end
end
The initialize method sets up the class by just creating a hash that is the attributes hash and then the rest of the methods are just pulling out specific pieces from that hash. I’m not sure if by the end of this project, this class will be separate, but to me, it felt like it was doing different stuff than the ActionFetch class so I chose to separate it out.