Sha256: 37c00fcbb96ff0935ff004d3029a76c91cfb35e7f9bbe0c27fcfd54910ed89a5
Contents?: true
Size: 919 Bytes
Versions: 28
Compression:
Stored size: 919 Bytes
Contents
module Onering module API class Auth < Base class<<self def _check_type(type) raise "Invalid authentication module object '#{type}'" unless %w{ users groups capabilities }.include?(type.to_s) end def get(type, id='current') _check_type(type) request("#{type}/#{id}") end def list(type, field='id', options={ :unique => true, :sort => true, :filter => nil }) _check_type(type) rv = request("#{type}/list").collect{|i| i[field.to_s] } rv = rv.uniq if options[:unique] rv = rv.sort if options[:sort] rv end def save(type, id, data) _check_type(type) request("#{type}/#{id}", { :method => :post, :data => data }) end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems