Module: Buffet::User
- Defined in:
- lib/buffet.rb
Overview
The user object shouldn't be one of ours. All we care about are the tokens for each service the gem consumer wants to write to. So when the consumer passes a "user" to one of our methods, we need to check for the presence of a "get_facebook_token" method or whatever service is being called.
Not sure how to accomplish this technically. It could be a single method that's called from each pure-type method. It could be wrapped up in a User module that is included in the consumer's User class.
Also, need a way of listing services linked to this user.
Where do we handle permissions? Do we need to track it somewhere, or just let the request fail if you try to do something you're not auth'd for? We could know before we make the request, but that seems like more work and more complexity/fragility. Probably better to make the request and let it fail? The consumer should have requested the appropriate API permissions and know what methods are available given the permissions requested. Maybe we do, however, need to help the consumer know what permissions they need to ask for?
Instance Method Summary (collapse)
-
- (Object) get_facebook_token
This method is only conditionally necessary.
Instance Method Details
- (Object) get_facebook_token
This method is only conditionally necessary. If the consumer never uses FB it doesn't matter if they implement this method on their user object. So is it okay for our module to define and raise an error on this method? At least this way, if the user DOES try to connect to FB but hasn't implemented the method they'll get the proper error.
Also, can we dynamically create these methods based on the proxies we've defined? Seems silly to write the same code over again for every proxy. Maybe we need a list of proxies somewhere?
What if someone adds their own proxy but it isn't in the official list? We absolutely want to allow 3rd-party proxies. Hopefully those will ultimately get folded in to this gem, but we need to make it easy for people to write them. How will those proxies ensure data consistency with respect to tokens? However WE do it needs to be extensible by consumers.
59 60 61 |
# File 'lib/buffet.rb', line 59 def get_facebook_token raise "needs to implement 'get_facebook_token'" end |