class Blaggard::GroupFinder
Public Class Methods
new(config)
click to toggle source
# File lib/blaggard/group_finder.rb, line 5 def initialize(config) # Make your base url and resource something like: # # https://example.com/api/v1/users_groups/user1 # # Ideally this should bring down a list of strings that # will correspond to the group keys in the repo config. # These will be the groups that user is a part of. The # User is identified by their username over http auth # ie. the REMOTE_USER header. @url = "#{config[:base_url]}/#{config[:group_resource]}/:id" end
Public Instance Methods
find(identifier)
click to toggle source
# File lib/blaggard/group_finder.rb, line 18 def find(identifier) uri = URI(@url.gsub(':id', identifier)) res = Net::HTTP.get_response(uri) if res.code == "200" return JSON.load(res.body) else [] end end