Calling .login on a LazyUser caused an API request despite the fact that we already had the value in the instance variable @username. Now we set up a reader called 'login' to optimise for the common case of wanting just the username of a LazyUser object.
This reverts commit bcd02a5306c8ce148d756ea2c1591e72c258773b.
This is part of the grand refactoring. For now, these methods no longer coerce their results into Arrays of Users; this will return.
So as to prevent methods using routes other than the object's default from having to suffer the performance penalty of the main route being called first, we want such methods to be implemented as class methods. Methods like User#followers is an example. It uses the current .property method which is an instance method. This change will allow such methods the desired flexibility.
method_missing now tries to dispatch to the worker's class before initializing @worker. Priority is so given to afford the worker every chance to avoid an expensive initialization when not needed. To make this work, we pass the class method the arguments we received in our constructor.
We want the token and login to be sent for all authenticated queries. They were being sent for POST requests, but, seemingly, not for GETs, causing methods relying on the latter to fail. HTTParty's `default_params` method causes parameters so set to be sent on every request. We specify `login` and `token` as default parameters if the request is authenticated.
Objects with values that are either true or false have an '?' appended to their name to fit with standard Ruby convention. For example, Repository objects now have a .fork? and .private? method. This convention is not reflected in the value of the @keys instance variable, because we assume callers will use it to iterate through the instance variables, whose names do not have a '?' suffix... Note: This commit theoretically breaks backward compatibility, as the unadorned method names no longer work. This closes #2. Signed-off-by: Felipe Coury <firstname.lastname@example.org>
This closes #16. Signed-off-by: Felipe Coury <email@example.com>