pjf / WebService-HabitRPG

Access the HabitRPG API from Perl
8 stars 5 forks source link

Proper objects, rather than digging around in hashes. #14

Closed pjf closed 11 years ago

pjf commented 11 years ago

Right now we return a lot of hashes that are converted straight from JSON. The result is lots of mucking around client-side, and it's not very nice to test.

Instead, we should return objects. This means we can do things like call ->up or ->down directly on a task object, or ->fmt_status directly on a user object.

We should also provide a ->raw or ->json method to get the actual original data. This means if the API gets extended or changed, and WS::HRPG isn't updated (heaven forbid!), then end-developers still have a way to get to the info they need. It's also really useful for debugging and testing.

pjf commented 11 years ago

This is being implemented in the task_obj branch.

https://github.com/pjf/WebService-HabitRPG/tree/task_obj

pjf commented 11 years ago

Implemented for tasks. See https://github.com/pjf/WebService-HabitRPG/blob/master/lib/WebService/HabitRPG/Task.pm for implementation.