Sha256: dc340e6e21809a3acb6db905dd83ac3ab6a3b4cc7210e9ef59fe58702b892b62
Contents?: true
Size: 1.31 KB
Versions: 53
Compression:
Stored size: 1.31 KB
Contents
class Ey::Core::Client class Real def get_users(params={}) query = Ey::Core.paging_parameters(params) url = params.delete("url") request( :params => params, :path => "/users", :query => query, :url => url, ) end end # Real class Mock def get_users(params={}) resources = if url = params.delete("url") if account_id = path_params(url)["accounts"] account = self.find(:accounts, account_id) if url.index("/owners") account[:account_owners].inject({}){|r,id| r.merge(id => self.data[:users][id])} elsif url.index("/users") account[:account_users].inject({}){|r,id| r.merge(id => self.data[:users][id])} else raise "Mock doesn't know how to handle url: #{url}" end else [] end else self.data[:users] end headers, users_page = search_and_page(params, :users, search_keys: %w[name email first_name last_name], resources: resources) response( :body => {"users" => users_page}, :headers => headers ) end end # Mock end
Version data entries
53 entries across 53 versions & 3 rubygems