Class: Zm::Client::AppointmentsCollection
- Inherits:
-
Base::AccountSearchObjectsCollection
- Object
- Base::ObjectsCollection
- Base::AccountObjectsCollection
- Base::AccountSearchObjectsCollection
- Zm::Client::AppointmentsCollection
- Defined in:
- lib/zm/client/appointment/appointments_collection.rb
Overview
collection of appointments
Constant Summary
Constants inherited from Base::ObjectsCollection
Base::ObjectsCollection::METHODS_MISSING_LIST
Instance Attribute Summary
Attributes inherited from Base::AccountSearchObjectsCollection
Attributes inherited from Base::ObjectsCollection
Instance Method Summary collapse
- #find(id) ⇒ Object
- #find_each(offset: 0, limit: 500, &block) ⇒ Object
-
#initialize(parent) ⇒ AppointmentsCollection
constructor
A new instance of AppointmentsCollection.
Methods inherited from Base::AccountSearchObjectsCollection
#build_find, #build_query, #delete_all, #end_at, #folder_ids, #folders, #ids, #make_query, #order, #reset, #start_at, #where
Methods inherited from Base::ObjectsCollection
#all, #first, #logger, #method_missing, #new, #order, #page, #per_page, #respond_to_missing?
Methods included from Inspector
#inspect, #instance_variables_map, #to_h, #to_s
Constructor Details
#initialize(parent) ⇒ AppointmentsCollection
Returns a new instance of AppointmentsCollection.
7 8 9 10 11 12 13 |
# File 'lib/zm/client/appointment/appointments_collection.rb', line 7 def initialize(parent) super @child_class = Appointment @builder_class = AppointmentsBuilder @type = SoapConstants::APPOINTMENT @sort_by = SoapConstants::DATE_ASC 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(id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/zm/client/appointment/appointments_collection.rb', line 15 def find(id) jsns = { m: { id: id, html: SoapUtils::ON } } soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST) .add_attributes(jsns) rep = @parent.soap_connector.invoke(soap_request) entry = rep[:GetMsgResponse][:m].first AppointmentJsnsInitializer.new(@parent, entry).create end |
#find_each(offset: 0, limit: 500, &block) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/zm/client/appointment/appointments_collection.rb', line 26 def find_each(offset: 0, limit: 500, &block) (Time.at(0).year..(Time.now.year + 10)).each do |year| @start_at ||= Time.new(year, 1, 1).to_i * 1000 @end_at ||= Time.new(year, 12, 31).to_i * 1000 @more = true @offset = offset @limit = limit while @more build_response.each { |item| block.call(item) } @offset += @limit end end end |