Class: Zm::Client::ServersCollection

Inherits:
Base::ObjectsCollection show all
Defined in:
lib/zm/client/server/servers_collection.rb

Overview

Collection servers

Constant Summary

Constants inherited from Base::ObjectsCollection

Base::ObjectsCollection::METHODS_MISSING_LIST

Instance Attribute Summary

Attributes inherited from Base::ObjectsCollection

#parent

Instance Method Summary collapse

Methods inherited from Base::ObjectsCollection

#all, #all!, #attrs, #build_from_entry, #count, #find, #first, #method_missing, #new, #order, #page, #per_page, #respond_to_missing?

Constructor Details

#initialize(parent) ⇒ ServersCollection

Returns a new instance of ServersCollection.



7
8
9
10
11
# File 'lib/zm/client/server/servers_collection.rb', line 7

def initialize(parent)
  @parent = parent
  # @service = ServerServices::MAILBOX
  @service = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zm::Client::Base::ObjectsCollection

Instance Method Details

#find_by(hash) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/zm/client/server/servers_collection.rb', line 13

def find_by(hash)
  rep = sac.get_server(hash.values.first, hash.keys.first)
  entry = rep[:Body][:GetServerResponse][:server].first
  server = Server.new(@parent)
  server.init_from_json(entry)
  server
end

#where(service) ⇒ Object



21
22
23
24
# File 'lib/zm/client/server/servers_collection.rb', line 21

def where(service)
  @service = service
  self
end