zimbra-soap-api 0.0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +4 -0
 - data/.irbrc +6 -0
 - data/Gemfile +6 -0
 - data/README +21 -0
 - data/Rakefile +1 -0
 - data/lib/zimbra.rb +94 -0
 - data/lib/zimbra/account.rb +94 -0
 - data/lib/zimbra/acl.rb +63 -0
 - data/lib/zimbra/alias.rb +4 -0
 - data/lib/zimbra/appointment.rb +274 -0
 - data/lib/zimbra/appointment/alarm.rb +101 -0
 - data/lib/zimbra/appointment/attendee.rb +97 -0
 - data/lib/zimbra/appointment/invite.rb +360 -0
 - data/lib/zimbra/appointment/recur_exception.rb +83 -0
 - data/lib/zimbra/appointment/recur_rule.rb +184 -0
 - data/lib/zimbra/appointment/reply.rb +91 -0
 - data/lib/zimbra/auth.rb +46 -0
 - data/lib/zimbra/base.rb +217 -0
 - data/lib/zimbra/calendar.rb +27 -0
 - data/lib/zimbra/common_elements.rb +51 -0
 - data/lib/zimbra/cos.rb +124 -0
 - data/lib/zimbra/delegate_auth_token.rb +49 -0
 - data/lib/zimbra/directory.rb +175 -0
 - data/lib/zimbra/distribution_list.rb +147 -0
 - data/lib/zimbra/domain.rb +63 -0
 - data/lib/zimbra/ext/handsoap_curb_driver.rb +21 -0
 - data/lib/zimbra/ext/hash.rb +72 -0
 - data/lib/zimbra/ext/string.rb +10 -0
 - data/lib/zimbra/extra/date_helpers.rb +111 -0
 - data/lib/zimbra/folder.rb +100 -0
 - data/lib/zimbra/handsoap_account_service.rb +44 -0
 - data/lib/zimbra/handsoap_service.rb +75 -0
 - data/lib/zimbra/version.rb +3 -0
 - data/spec/fixtures/xml_api_requests/appointments/create.xml +84 -0
 - data/spec/fixtures/xml_api_responses/alarms/15_minutes_before.xml +26 -0
 - data/spec/fixtures/xml_api_responses/alarms/using_all_intervals.xml +26 -0
 - data/spec/fixtures/xml_api_responses/appointments/appointment_response_1.xml +40 -0
 - data/spec/fixtures/xml_api_responses/attendees/one_attendee_and_one_reply.xml +27 -0
 - data/spec/fixtures/xml_api_responses/attendees/three_attendees_response_1.xml +30 -0
 - data/spec/fixtures/xml_api_responses/multiple_invites/recurring_with_exceptions.xml +109 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/day_27_of_every_2_months.xml +27 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_2_days.xml +26 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_3_weeks_on_tuesday_and_friday.xml +30 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_day_50_instances.xml +27 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_monday_wednesday_friday.xml +31 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_tuesday.xml +29 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_weekday_with_end_date.xml +34 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/every_year_on_february_2.xml +28 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/first_day_of_every_month.xml +36 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/first_monday_of_every_february.xml +31 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/first_weekend_day_of_every_month.xml +31 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/last_day_of_every_month.xml +36 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/second_day_of_every_2_months.xml +36 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/second_wednesday_of_every_month.xml +29 -0
 - data/spec/fixtures/xml_api_responses/recur_rules/weekly_with_an_exception.xml +44 -0
 - data/spec/spec_helper.rb +32 -0
 - data/spec/zimbra/acl_spec.rb +11 -0
 - data/spec/zimbra/appointment/alarm_spec.rb +33 -0
 - data/spec/zimbra/appointment/invite_spec.rb +62 -0
 - data/spec/zimbra/appointment/recur_rule_spec.rb +307 -0
 - data/spec/zimbra/appointment_spec.rb +175 -0
 - data/spec/zimbra/common_elements_spec.rb +33 -0
 - data/spec/zimbra/distribution_list_spec.rb +54 -0
 - data/zimbra.gemspec +28 -0
 - metadata +197 -0
 
| 
         @@ -0,0 +1,62 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Zimbra::Appointment::Invite do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'multiple_invites')
         
     | 
| 
      
 6 
     | 
    
         
            +
                @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'recurring_with_exceptions.xml'))
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              describe "#exception" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                before do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @invite = @appointment.invites.find { |i| i.id == 549 }
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
                it "should be set if this invite is an exception" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @invite.exception.to_hash.should == {:recurrence_id=>"20140131T090000", :timezone=>"America/New_York", :range_type=>nil}
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
              describe "basic attributes" do
         
     | 
| 
      
 19 
     | 
    
         
            +
                it "should set the description" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @appointment.invites.first.description.should == "This is a recurring series"
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                it "should set the fragment" do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @appointment.invites.first.fragment.should == "This is a recurring series"
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
                it "should set the organizer_email_address" do
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @appointment.invites.first.organizer_email_address.should == 'mail03@greenviewdata.com'
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
                it "should set is_organizer" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @appointment.invites.first.is_organizer.should be_true
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                it "should set the name" do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @appointment.invites.first.name.should == 'fdsafdsafdsafdsafdsafdsa'
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
                it "should set the computed_free_busy_status" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @appointment.invites.first.computed_free_busy_status.should == :busy
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
                it "should set the free_busy_setting" do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @appointment.invites.first.free_busy_setting.should == :busy
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                it "should set the invite_status" do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @appointment.invites.first.invite_status.should == :confirmed
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
                it "should set all_day" do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  @appointment.invites.first.all_day.should be_false
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
                it "should set the visibility" do
         
     | 
| 
      
 47 
     | 
    
         
            +
                  @appointment.invites.first.visibility.should == :public
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
                it "should set the location" do
         
     | 
| 
      
 50 
     | 
    
         
            +
                  @appointment.invites.first.location.should == 'Conference Room'
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
                it "should set transparency" do
         
     | 
| 
      
 53 
     | 
    
         
            +
                  @appointment.invites.first.transparency.should == :opaque
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
                it "should set start_date_time" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  @appointment.invites.first.start_date_time.should == Time.parse("2013-12-09 09:00:00 -0500")
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
                it "should set end_date_time" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                  @appointment.invites.first.end_date_time.should == Time.parse("2013-12-09 09:30:00 -0500")
         
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,307 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Zimbra::Appointment::RecurRule do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'recur_rules')
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              describe "#create_xml" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                @sample_attribute_files = [
         
     | 
| 
      
 10 
     | 
    
         
            +
                  'second_wednesday_of_every_month.xml',
         
     | 
| 
      
 11 
     | 
    
         
            +
                  'day_27_of_every_2_months.xml',
         
     | 
| 
      
 12 
     | 
    
         
            +
                  'every_2_days.xml',
         
     | 
| 
      
 13 
     | 
    
         
            +
                  'every_3_weeks_on_tuesday_and_friday.xml',
         
     | 
| 
      
 14 
     | 
    
         
            +
                  'every_day_50_instances.xml',
         
     | 
| 
      
 15 
     | 
    
         
            +
                  'every_monday_wednesday_friday.xml',
         
     | 
| 
      
 16 
     | 
    
         
            +
                  'every_tuesday.xml',
         
     | 
| 
      
 17 
     | 
    
         
            +
                  'every_weekday_with_end_date.xml',
         
     | 
| 
      
 18 
     | 
    
         
            +
                  'every_year_on_february_2.xml',
         
     | 
| 
      
 19 
     | 
    
         
            +
                  'first_day_of_every_month.xml',
         
     | 
| 
      
 20 
     | 
    
         
            +
                  'first_monday_of_every_february.xml',
         
     | 
| 
      
 21 
     | 
    
         
            +
                  'first_weekend_day_of_every_month.xml',
         
     | 
| 
      
 22 
     | 
    
         
            +
                  'last_day_of_every_month.xml',
         
     | 
| 
      
 23 
     | 
    
         
            +
                  'second_day_of_every_2_months.xml'
         
     | 
| 
      
 24 
     | 
    
         
            +
                ]
         
     | 
| 
      
 25 
     | 
    
         
            +
                
         
     | 
| 
      
 26 
     | 
    
         
            +
                @sample_attribute_files.each do |file_name|
         
     | 
| 
      
 27 
     | 
    
         
            +
                  context file_name do
         
     | 
| 
      
 28 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 29 
     | 
    
         
            +
                      @xml = File.read(File.join(@xml_api_responses_path, file_name))
         
     | 
| 
      
 30 
     | 
    
         
            +
                      @attributes = Zimbra::Hash.from_xml(@xml)
         
     | 
| 
      
 31 
     | 
    
         
            +
                      @attributes = @attributes[:appt][:inv][:comp][:recur]
         
     | 
| 
      
 32 
     | 
    
         
            +
                      @recur_rule = Zimbra::Appointment::RecurRule.new_from_zimbra_attributes(@attributes)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    
         
     | 
| 
      
 35 
     | 
    
         
            +
                    it "should match the expected attributes" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                      document = Handsoap::XmlMason::Document.new do |doc|
         
     | 
| 
      
 37 
     | 
    
         
            +
                        doc.add "add" do |add_element|
         
     | 
| 
      
 38 
     | 
    
         
            +
                          @recur_rule.create_xml(add_element)
         
     | 
| 
      
 39 
     | 
    
         
            +
                        end
         
     | 
| 
      
 40 
     | 
    
         
            +
                      end
         
     | 
| 
      
 41 
     | 
    
         
            +
                      
         
     | 
| 
      
 42 
     | 
    
         
            +
                      parsed_xml = Zimbra::Hash.from_xml(document.to_s)
         
     | 
| 
      
 43 
     | 
    
         
            +
                      parsed_xml.should == @attributes
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
              describe ".new" do
         
     | 
| 
      
 50 
     | 
    
         
            +
                @sample_attribute_files = {
         
     | 
| 
      
 51 
     | 
    
         
            +
                  'second_wednesday_of_every_month.xml' => {
         
     | 
| 
      
 52 
     | 
    
         
            +
                    :frequency => :monthly,
         
     | 
| 
      
 53 
     | 
    
         
            +
                    :interval => 1,
         
     | 
| 
      
 54 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 55 
     | 
    
         
            +
                      { :day => :wednesday, :week_number => 2 }
         
     | 
| 
      
 56 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 57 
     | 
    
         
            +
                  },
         
     | 
| 
      
 58 
     | 
    
         
            +
                  'day_27_of_every_2_months.xml' => {
         
     | 
| 
      
 59 
     | 
    
         
            +
                    frequency: :monthly,
         
     | 
| 
      
 60 
     | 
    
         
            +
                    interval: 2,
         
     | 
| 
      
 61 
     | 
    
         
            +
                    by_month_day: [27]
         
     | 
| 
      
 62 
     | 
    
         
            +
                  },
         
     | 
| 
      
 63 
     | 
    
         
            +
                  'every_2_days.xml' => {
         
     | 
| 
      
 64 
     | 
    
         
            +
                    frequency: :daily,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    interval: 2
         
     | 
| 
      
 66 
     | 
    
         
            +
                  },
         
     | 
| 
      
 67 
     | 
    
         
            +
                  'every_3_weeks_on_tuesday_and_friday.xml' => {
         
     | 
| 
      
 68 
     | 
    
         
            +
                    :frequency=>:weekly, 
         
     | 
| 
      
 69 
     | 
    
         
            +
                    :interval=>3, 
         
     | 
| 
      
 70 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 71 
     | 
    
         
            +
                      { :day => :tuesday },
         
     | 
| 
      
 72 
     | 
    
         
            +
                      { :day => :friday }
         
     | 
| 
      
 73 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 74 
     | 
    
         
            +
                  },
         
     | 
| 
      
 75 
     | 
    
         
            +
                  'every_day_50_instances.xml' => {
         
     | 
| 
      
 76 
     | 
    
         
            +
                    :frequency => :daily, 
         
     | 
| 
      
 77 
     | 
    
         
            +
                    :interval => 1,
         
     | 
| 
      
 78 
     | 
    
         
            +
                    :count => 50
         
     | 
| 
      
 79 
     | 
    
         
            +
                  },
         
     | 
| 
      
 80 
     | 
    
         
            +
                  'every_monday_wednesday_friday.xml' => {
         
     | 
| 
      
 81 
     | 
    
         
            +
                    :frequency => :weekly, 
         
     | 
| 
      
 82 
     | 
    
         
            +
                    :interval => 1, 
         
     | 
| 
      
 83 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 84 
     | 
    
         
            +
                      {:day=> :monday},
         
     | 
| 
      
 85 
     | 
    
         
            +
                      {:day=> :wednesday},
         
     | 
| 
      
 86 
     | 
    
         
            +
                      {:day=> :friday}
         
     | 
| 
      
 87 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 88 
     | 
    
         
            +
                  },
         
     | 
| 
      
 89 
     | 
    
         
            +
                  'every_tuesday.xml' => {
         
     | 
| 
      
 90 
     | 
    
         
            +
                    :frequency=>:weekly, 
         
     | 
| 
      
 91 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 92 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 93 
     | 
    
         
            +
                      {:day=>:tuesday}
         
     | 
| 
      
 94 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 95 
     | 
    
         
            +
                  },
         
     | 
| 
      
 96 
     | 
    
         
            +
                  'every_weekday_with_end_date.xml' => {
         
     | 
| 
      
 97 
     | 
    
         
            +
                    :frequency=>:daily, 
         
     | 
| 
      
 98 
     | 
    
         
            +
                    :until_date=>Time.parse("20131220T045959Z"), 
         
     | 
| 
      
 99 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 100 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 101 
     | 
    
         
            +
                      {:day=>:monday}, 
         
     | 
| 
      
 102 
     | 
    
         
            +
                      {:day=>:tuesday}, 
         
     | 
| 
      
 103 
     | 
    
         
            +
                      {:day=>:wednesday}, 
         
     | 
| 
      
 104 
     | 
    
         
            +
                      {:day=>:thursday}, 
         
     | 
| 
      
 105 
     | 
    
         
            +
                      {:day=>:friday}
         
     | 
| 
      
 106 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 107 
     | 
    
         
            +
                  },
         
     | 
| 
      
 108 
     | 
    
         
            +
                  'every_year_on_february_2.xml' => {
         
     | 
| 
      
 109 
     | 
    
         
            +
                    :frequency=>:yearly, 
         
     | 
| 
      
 110 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 111 
     | 
    
         
            +
                    :by_month_day=>[2],
         
     | 
| 
      
 112 
     | 
    
         
            +
                    :by_month => [2]
         
     | 
| 
      
 113 
     | 
    
         
            +
                  },
         
     | 
| 
      
 114 
     | 
    
         
            +
                  'first_day_of_every_month.xml' => {
         
     | 
| 
      
 115 
     | 
    
         
            +
                    :frequency=>:monthly, 
         
     | 
| 
      
 116 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 117 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 118 
     | 
    
         
            +
                      {:day=>:sunday}, 
         
     | 
| 
      
 119 
     | 
    
         
            +
                      {:day=>:monday}, 
         
     | 
| 
      
 120 
     | 
    
         
            +
                      {:day=>:tuesday}, 
         
     | 
| 
      
 121 
     | 
    
         
            +
                      {:day=>:wednesday}, 
         
     | 
| 
      
 122 
     | 
    
         
            +
                      {:day=>:thursday}, 
         
     | 
| 
      
 123 
     | 
    
         
            +
                      {:day=>:friday},
         
     | 
| 
      
 124 
     | 
    
         
            +
                      {:day=>:saturday}
         
     | 
| 
      
 125 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 126 
     | 
    
         
            +
                    :by_set_position => [1]
         
     | 
| 
      
 127 
     | 
    
         
            +
                  },
         
     | 
| 
      
 128 
     | 
    
         
            +
                  'first_monday_of_every_february.xml' => {
         
     | 
| 
      
 129 
     | 
    
         
            +
                    :frequency=>:yearly, 
         
     | 
| 
      
 130 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 131 
     | 
    
         
            +
                    :by_set_position=>[1], 
         
     | 
| 
      
 132 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 133 
     | 
    
         
            +
                      {:day=>:monday}
         
     | 
| 
      
 134 
     | 
    
         
            +
                    ], 
         
     | 
| 
      
 135 
     | 
    
         
            +
                    :by_month=>[2]
         
     | 
| 
      
 136 
     | 
    
         
            +
                  },
         
     | 
| 
      
 137 
     | 
    
         
            +
                  'first_weekend_day_of_every_month.xml' => {
         
     | 
| 
      
 138 
     | 
    
         
            +
                    :frequency=>:monthly, 
         
     | 
| 
      
 139 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 140 
     | 
    
         
            +
                    :by_set_position=>[1], 
         
     | 
| 
      
 141 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 142 
     | 
    
         
            +
                      {:day=>:sunday}, 
         
     | 
| 
      
 143 
     | 
    
         
            +
                      {:day=>:saturday}
         
     | 
| 
      
 144 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 145 
     | 
    
         
            +
                  },
         
     | 
| 
      
 146 
     | 
    
         
            +
                  'last_day_of_every_month.xml' => {
         
     | 
| 
      
 147 
     | 
    
         
            +
                    :frequency=>:monthly, 
         
     | 
| 
      
 148 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 149 
     | 
    
         
            +
                    :by_set_position=>[-1], 
         
     | 
| 
      
 150 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 151 
     | 
    
         
            +
                      {:day=>:sunday}, 
         
     | 
| 
      
 152 
     | 
    
         
            +
                      {:day=>:monday}, 
         
     | 
| 
      
 153 
     | 
    
         
            +
                      {:day=>:tuesday}, 
         
     | 
| 
      
 154 
     | 
    
         
            +
                      {:day=>:wednesday}, 
         
     | 
| 
      
 155 
     | 
    
         
            +
                      {:day=>:thursday}, 
         
     | 
| 
      
 156 
     | 
    
         
            +
                      {:day=>:friday},
         
     | 
| 
      
 157 
     | 
    
         
            +
                      {:day=>:saturday}
         
     | 
| 
      
 158 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 159 
     | 
    
         
            +
                  },
         
     | 
| 
      
 160 
     | 
    
         
            +
                  'second_day_of_every_2_months.xml' => {
         
     | 
| 
      
 161 
     | 
    
         
            +
                    :frequency=>:monthly, 
         
     | 
| 
      
 162 
     | 
    
         
            +
                    :interval=>2, 
         
     | 
| 
      
 163 
     | 
    
         
            +
                    :by_set_position=>[2], 
         
     | 
| 
      
 164 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 165 
     | 
    
         
            +
                      {:day=>:sunday}, 
         
     | 
| 
      
 166 
     | 
    
         
            +
                      {:day=>:monday}, 
         
     | 
| 
      
 167 
     | 
    
         
            +
                      {:day=>:tuesday}, 
         
     | 
| 
      
 168 
     | 
    
         
            +
                      {:day=>:wednesday}, 
         
     | 
| 
      
 169 
     | 
    
         
            +
                      {:day=>:thursday}, 
         
     | 
| 
      
 170 
     | 
    
         
            +
                      {:day=>:friday},
         
     | 
| 
      
 171 
     | 
    
         
            +
                      {:day=>:saturday}
         
     | 
| 
      
 172 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 173 
     | 
    
         
            +
                  }
         
     | 
| 
      
 174 
     | 
    
         
            +
                  #'weekly_with_an_exception.xml' => {}
         
     | 
| 
      
 175 
     | 
    
         
            +
                }
         
     | 
| 
      
 176 
     | 
    
         
            +
                
         
     | 
| 
      
 177 
     | 
    
         
            +
                @sample_attribute_files.each do |file_name, expected_attributes|
         
     | 
| 
      
 178 
     | 
    
         
            +
                  context file_name do
         
     | 
| 
      
 179 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 180 
     | 
    
         
            +
                      @attributes = Zimbra::Hash.from_xml(File.read(File.join(@xml_api_responses_path, file_name)))
         
     | 
| 
      
 181 
     | 
    
         
            +
                      @attributes = @attributes[:appt][:inv][:comp][:recur]
         
     | 
| 
      
 182 
     | 
    
         
            +
                      @recur_rule = Zimbra::Appointment::RecurRule.new_from_zimbra_attributes(@attributes)
         
     | 
| 
      
 183 
     | 
    
         
            +
                    end
         
     | 
| 
      
 184 
     | 
    
         
            +
                    
         
     | 
| 
      
 185 
     | 
    
         
            +
                    it "should match the expected attributes" do
         
     | 
| 
      
 186 
     | 
    
         
            +
                      @recur_rule.to_hash.should == expected_attributes
         
     | 
| 
      
 187 
     | 
    
         
            +
                    end
         
     | 
| 
      
 188 
     | 
    
         
            +
                  end
         
     | 
| 
      
 189 
     | 
    
         
            +
                end
         
     | 
| 
      
 190 
     | 
    
         
            +
              end
         
     | 
| 
      
 191 
     | 
    
         
            +
              
         
     | 
| 
      
 192 
     | 
    
         
            +
              describe ".parse_zimbra_attributes" do
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
                @sample_attribute_files = {
         
     | 
| 
      
 195 
     | 
    
         
            +
                  'second_wednesday_of_every_month.xml' => {
         
     | 
| 
      
 196 
     | 
    
         
            +
                    :frequency => "MON",
         
     | 
| 
      
 197 
     | 
    
         
            +
                    :interval => 1,
         
     | 
| 
      
 198 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 199 
     | 
    
         
            +
                      { :day => 'WE', :week_number => 2 }
         
     | 
| 
      
 200 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 201 
     | 
    
         
            +
                  },
         
     | 
| 
      
 202 
     | 
    
         
            +
                  'day_27_of_every_2_months.xml' => {
         
     | 
| 
      
 203 
     | 
    
         
            +
                    frequency: "MON",
         
     | 
| 
      
 204 
     | 
    
         
            +
                    interval: 2,
         
     | 
| 
      
 205 
     | 
    
         
            +
                    by_month_day: [27]
         
     | 
| 
      
 206 
     | 
    
         
            +
                  },
         
     | 
| 
      
 207 
     | 
    
         
            +
                  'every_2_days.xml' => {
         
     | 
| 
      
 208 
     | 
    
         
            +
                    frequency: 'DAI',
         
     | 
| 
      
 209 
     | 
    
         
            +
                    interval: 2
         
     | 
| 
      
 210 
     | 
    
         
            +
                  },
         
     | 
| 
      
 211 
     | 
    
         
            +
                  'every_3_weeks_on_tuesday_and_friday.xml' => {
         
     | 
| 
      
 212 
     | 
    
         
            +
                    :frequency=>"WEE", 
         
     | 
| 
      
 213 
     | 
    
         
            +
                    :interval=>3, 
         
     | 
| 
      
 214 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 215 
     | 
    
         
            +
                      {:day=>"TU"},
         
     | 
| 
      
 216 
     | 
    
         
            +
                      {:day=>"FR"}
         
     | 
| 
      
 217 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 218 
     | 
    
         
            +
                  },
         
     | 
| 
      
 219 
     | 
    
         
            +
                  'every_day_50_instances.xml' => {
         
     | 
| 
      
 220 
     | 
    
         
            +
                    :frequency => "DAI", 
         
     | 
| 
      
 221 
     | 
    
         
            +
                    :interval => 1,
         
     | 
| 
      
 222 
     | 
    
         
            +
                    :count => 50
         
     | 
| 
      
 223 
     | 
    
         
            +
                  },
         
     | 
| 
      
 224 
     | 
    
         
            +
                  'every_monday_wednesday_friday.xml' => {
         
     | 
| 
      
 225 
     | 
    
         
            +
                    :frequency => "WEE", 
         
     | 
| 
      
 226 
     | 
    
         
            +
                    :interval => 1, 
         
     | 
| 
      
 227 
     | 
    
         
            +
                    :by_day => [
         
     | 
| 
      
 228 
     | 
    
         
            +
                      {:day=>"MO"},
         
     | 
| 
      
 229 
     | 
    
         
            +
                      {:day=>"WE"},
         
     | 
| 
      
 230 
     | 
    
         
            +
                      {:day=>"FR"}
         
     | 
| 
      
 231 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 232 
     | 
    
         
            +
                  },
         
     | 
| 
      
 233 
     | 
    
         
            +
                  'every_tuesday.xml' => {
         
     | 
| 
      
 234 
     | 
    
         
            +
                    :frequency=>"WEE", 
         
     | 
| 
      
 235 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 236 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 237 
     | 
    
         
            +
                      {:day=>"TU"}
         
     | 
| 
      
 238 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 239 
     | 
    
         
            +
                  },
         
     | 
| 
      
 240 
     | 
    
         
            +
                  'every_weekday_with_end_date.xml' => {
         
     | 
| 
      
 241 
     | 
    
         
            +
                    :frequency=>"DAI", 
         
     | 
| 
      
 242 
     | 
    
         
            +
                    :until_date=>"20131220T045959Z", 
         
     | 
| 
      
 243 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 244 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 245 
     | 
    
         
            +
                      {:day=>"MO"}, 
         
     | 
| 
      
 246 
     | 
    
         
            +
                      {:day=>"TU"}, 
         
     | 
| 
      
 247 
     | 
    
         
            +
                      {:day=>"WE"}, 
         
     | 
| 
      
 248 
     | 
    
         
            +
                      {:day=>"TH"}, 
         
     | 
| 
      
 249 
     | 
    
         
            +
                      {:day=>"FR"}
         
     | 
| 
      
 250 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 251 
     | 
    
         
            +
                  },
         
     | 
| 
      
 252 
     | 
    
         
            +
                  'every_year_on_february_2.xml' => {
         
     | 
| 
      
 253 
     | 
    
         
            +
                    :frequency=>"YEA", 
         
     | 
| 
      
 254 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 255 
     | 
    
         
            +
                    :by_month_day=>[2],
         
     | 
| 
      
 256 
     | 
    
         
            +
                    :by_month => [2]
         
     | 
| 
      
 257 
     | 
    
         
            +
                  },
         
     | 
| 
      
 258 
     | 
    
         
            +
                  'first_day_of_every_month.xml' => {
         
     | 
| 
      
 259 
     | 
    
         
            +
                    :frequency=>"MON", 
         
     | 
| 
      
 260 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 261 
     | 
    
         
            +
                    :by_day=>[
         
     | 
| 
      
 262 
     | 
    
         
            +
                      {:day=>"SU"}, {:day=>"MO"}, {:day=>"TU"}, {:day=>"WE"}, {:day=>"TH"}, {:day=>"FR"}, {:day=>"SA"}
         
     | 
| 
      
 263 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 264 
     | 
    
         
            +
                    :by_set_position => [1]
         
     | 
| 
      
 265 
     | 
    
         
            +
                  },
         
     | 
| 
      
 266 
     | 
    
         
            +
                  'first_monday_of_every_february.xml' => {
         
     | 
| 
      
 267 
     | 
    
         
            +
                    :frequency=>"YEA", 
         
     | 
| 
      
 268 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 269 
     | 
    
         
            +
                    :by_set_position=>[1], 
         
     | 
| 
      
 270 
     | 
    
         
            +
                    :by_day=>[{:day=>"MO"}], 
         
     | 
| 
      
 271 
     | 
    
         
            +
                    :by_month=>[2]
         
     | 
| 
      
 272 
     | 
    
         
            +
                  },
         
     | 
| 
      
 273 
     | 
    
         
            +
                  'first_weekend_day_of_every_month.xml' => {
         
     | 
| 
      
 274 
     | 
    
         
            +
                    :frequency=>"MON", 
         
     | 
| 
      
 275 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 276 
     | 
    
         
            +
                    :by_set_position=>[1], 
         
     | 
| 
      
 277 
     | 
    
         
            +
                    :by_day=>[{:day=>"SU"}, {:day=>"SA"}]
         
     | 
| 
      
 278 
     | 
    
         
            +
                  },
         
     | 
| 
      
 279 
     | 
    
         
            +
                  'last_day_of_every_month.xml' => {
         
     | 
| 
      
 280 
     | 
    
         
            +
                    :frequency=>"MON", 
         
     | 
| 
      
 281 
     | 
    
         
            +
                    :interval=>1, 
         
     | 
| 
      
 282 
     | 
    
         
            +
                    :by_set_position=>[-1], 
         
     | 
| 
      
 283 
     | 
    
         
            +
                    :by_day=>[{:day=>"SU"}, {:day=>"MO"}, {:day=>"TU"}, {:day=>"WE"}, {:day=>"TH"}, {:day=>"FR"}, {:day=>"SA"}]
         
     | 
| 
      
 284 
     | 
    
         
            +
                  },
         
     | 
| 
      
 285 
     | 
    
         
            +
                  'second_day_of_every_2_months.xml' => {
         
     | 
| 
      
 286 
     | 
    
         
            +
                    :frequency=>"MON", 
         
     | 
| 
      
 287 
     | 
    
         
            +
                    :interval=>2, 
         
     | 
| 
      
 288 
     | 
    
         
            +
                    :by_set_position=>[2], 
         
     | 
| 
      
 289 
     | 
    
         
            +
                    :by_day=>[{:day=>"SU"}, {:day=>"MO"}, {:day=>"TU"}, {:day=>"WE"}, {:day=>"TH"}, {:day=>"FR"}, {:day=>"SA"}]
         
     | 
| 
      
 290 
     | 
    
         
            +
                  }
         
     | 
| 
      
 291 
     | 
    
         
            +
                  #'weekly_with_an_exception.xml' => {}
         
     | 
| 
      
 292 
     | 
    
         
            +
                }
         
     | 
| 
      
 293 
     | 
    
         
            +
                
         
     | 
| 
      
 294 
     | 
    
         
            +
                @sample_attribute_files.each do |file_name, expected_attributes|
         
     | 
| 
      
 295 
     | 
    
         
            +
                  context file_name do
         
     | 
| 
      
 296 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 297 
     | 
    
         
            +
                      @attributes = Zimbra::Hash.from_xml(File.read(File.join(@xml_api_responses_path, file_name)))
         
     | 
| 
      
 298 
     | 
    
         
            +
                      @attributes = @attributes[:appt][:inv][:comp][:recur]
         
     | 
| 
      
 299 
     | 
    
         
            +
                    end
         
     | 
| 
      
 300 
     | 
    
         
            +
                    
         
     | 
| 
      
 301 
     | 
    
         
            +
                    it "should match the expected attributes" do
         
     | 
| 
      
 302 
     | 
    
         
            +
                      Zimbra::Appointment::RecurRule.parse_zimbra_attributes(@attributes).should == expected_attributes
         
     | 
| 
      
 303 
     | 
    
         
            +
                    end
         
     | 
| 
      
 304 
     | 
    
         
            +
                  end
         
     | 
| 
      
 305 
     | 
    
         
            +
                end
         
     | 
| 
      
 306 
     | 
    
         
            +
              end
         
     | 
| 
      
 307 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,175 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__),'../spec_helper')
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe Zimbra::Appointment do
         
     | 
| 
      
 5 
     | 
    
         
            +
              describe ".parse_zimbra_attributes" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                before do
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'recur_rules')
         
     | 
| 
      
 8 
     | 
    
         
            +
                  xml = File.read(File.join(@xml_api_responses_path, 'second_wednesday_of_every_month.xml'))
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @appointment_hash = Zimbra::Hash.from_xml(xml)
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                it "should return all the attributes" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  Zimbra::Appointment.parse_zimbra_attributes(@appointment_hash).should == {:id=>518, :uid=>"1c71d474-5c1f-4048-84e3-9725c0825a44", :revision=>27656, :calendar_id=>10, :size=>0, :replies=>nil, :invites_attributes=>{:attributes=>{:id=>517, :seq=>4, :compNum=>0, :type=>"appt"}, :tz=>{:attributes=>{:id=>"America/New_York", :stdoff=>-300, :stdname=>"EST", :dayoff=>-240, :dayname=>"EDT"}, :standard=>{:attributes=>{:wkday=>1, :min=>0, :sec=>0, :mon=>11, :hour=>2, :week=>1}}, :daylight=>{:attributes=>{:wkday=>1, :min=>0, :sec=>0, :mon=>3, :hour=>2, :week=>2}}}, :comp=>{:attributes=>{:uid=>"1c71d474-5c1f-4048-84e3-9725c0825a44", :d=>1387571704000, :status=>"CONF", :noBlob=>1, :ciFolder=>10, :isOrg=>1, :class=>"PUB", :loc=>"", :compNum=>0, :apptId=>518, :url=>"", :fb=>"B", :calItemId=>518, :x_uid=>"1c71d474-5c1f-4048-84e3-9725c0825a44", :name=>"Test2222", :seq=>4, :rsvp=>0, :fba=>"B", :method=>"PUBLISH", :transp=>"O"}, :alarm=>{:attributes=>{:action=>"DISPLAY"}, :trigger=>{:rel=>{:attributes=>{:neg=>1, :m=>5, :related=>"START"}}}, :desc=>{}}, :or=>{:attributes=>{:d=>"Mail03", :a=>"mail03@greenviewdata.com", :url=>"mail03@greenviewdata.com"}}, :recur=>{:add=>{:rule=>{:attributes=>{:freq=>"MON"}, :interval=>{:attributes=>{:ival=>1}}, :byday=>{:wkday=>{:attributes=>{:ordwk=>2, :day=>"WE"}}}}}}, :s=>{:attributes=>{:u=>1355340600000, :d=>"20121212T143000", :tz=>"America/New_York"}}, :e=>{:attributes=>{:u=>1355344200000, :d=>"20121212T153000", :tz=>"America/New_York"}}}}, :date=>1387571704000, :loaded_from_search=>nil}
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              describe "#recurrence_rule" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                before do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'recur_rules')
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'second_wednesday_of_every_month.xml'))
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
                it "should set the recurrence rule" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @appointment.invites.first.recurrence_rule.to_hash.should == {:frequency=>:monthly, :interval=>1, :by_day=>[{:day=>:wednesday, :week_number=>2}]}
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
              
         
     | 
| 
      
 28 
     | 
    
         
            +
              describe "#create_xml" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                before do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'multiple_invites')
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'recurring_with_exceptions.xml'))
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              
         
     | 
| 
      
 34 
     | 
    
         
            +
                it "should return the xml document to create this appointment" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  document = Handsoap::XmlMason::Document.new do |doc|
         
     | 
| 
      
 36 
     | 
    
         
            +
                    doc.add "CreateAppointmentRequest" do |create_appointment_request|
         
     | 
| 
      
 37 
     | 
    
         
            +
                      @appointment.create_xml(create_appointment_request)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  #File.open(File.join(@fixture_path, 'xml_api_requests', 'appointments', 'create.xml'), 'w') do |io|
         
     | 
| 
      
 41 
     | 
    
         
            +
                  #  io.write document.to_s
         
     | 
| 
      
 42 
     | 
    
         
            +
                  #end
         
     | 
| 
      
 43 
     | 
    
         
            +
                  document.to_s.should == File.read(File.join(@fixture_path, 'xml_api_requests', 'appointments', 'create.xml'))
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
      
 47 
     | 
    
         
            +
              context "from recurring_with_exceptions.xml" do
         
     | 
| 
      
 48 
     | 
    
         
            +
                before do
         
     | 
| 
      
 49 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'multiple_invites')
         
     | 
| 
      
 50 
     | 
    
         
            +
                  @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'recurring_with_exceptions.xml'))
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
                
         
     | 
| 
      
 53 
     | 
    
         
            +
                describe "#invites" do
         
     | 
| 
      
 54 
     | 
    
         
            +
                  it "should initialize 5 invites" do
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @appointment.invites.count.should == 5
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
              
         
     | 
| 
      
 60 
     | 
    
         
            +
              context "from one_attendee_and_one_reply.xml" do
         
     | 
| 
      
 61 
     | 
    
         
            +
                before do
         
     | 
| 
      
 62 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'attendees')
         
     | 
| 
      
 63 
     | 
    
         
            +
                  @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'one_attendee_and_one_reply.xml'))
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                describe "#replies" do
         
     | 
| 
      
 67 
     | 
    
         
            +
                  it "should load one reply" do
         
     | 
| 
      
 68 
     | 
    
         
            +
                    @appointment.replies.map(&:to_hash).should == [
         
     | 
| 
      
 69 
     | 
    
         
            +
                      {
         
     | 
| 
      
 70 
     | 
    
         
            +
                        :sequence_number=>1, 
         
     | 
| 
      
 71 
     | 
    
         
            +
                        :date=>Time.parse("2014-01-21 09:33:56 -0500"), 
         
     | 
| 
      
 72 
     | 
    
         
            +
                        :email_address=>"mail03@greenviewdata.com", 
         
     | 
| 
      
 73 
     | 
    
         
            +
                        :participation_status=>:tentative, 
         
     | 
| 
      
 74 
     | 
    
         
            +
                        :sent_by=>nil, 
         
     | 
| 
      
 75 
     | 
    
         
            +
                        :recurrence_range_type=>nil, 
         
     | 
| 
      
 76 
     | 
    
         
            +
                        :recurrence_id=>nil, 
         
     | 
| 
      
 77 
     | 
    
         
            +
                        :timezone=>nil, 
         
     | 
| 
      
 78 
     | 
    
         
            +
                        :recurrence_id_utc=>nil
         
     | 
| 
      
 79 
     | 
    
         
            +
                      }
         
     | 
| 
      
 80 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
                
         
     | 
| 
      
 84 
     | 
    
         
            +
                describe "#attendees" do
         
     | 
| 
      
 85 
     | 
    
         
            +
                  it "should load one attendee" do
         
     | 
| 
      
 86 
     | 
    
         
            +
                    @appointment.invites.first.attendees.map(&:to_hash).should == [
         
     | 
| 
      
 87 
     | 
    
         
            +
                      {:email_address=>"mail03@greenviewdata.com", :friendly_name=>"Mail03", :rsvp=>1, :role=>"REQ", :participation_status=>:tentative}
         
     | 
| 
      
 88 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
                end
         
     | 
| 
      
 91 
     | 
    
         
            +
              end
         
     | 
| 
      
 92 
     | 
    
         
            +
              
         
     | 
| 
      
 93 
     | 
    
         
            +
              context "from three_attendees_response_1.xml appointment" do
         
     | 
| 
      
 94 
     | 
    
         
            +
                before do
         
     | 
| 
      
 95 
     | 
    
         
            +
                  @xml_api_responses_path = File.join(@fixture_path, 'xml_api_responses', 'attendees')
         
     | 
| 
      
 96 
     | 
    
         
            +
                  @appointment = new_appointment_from_xml(File.join(@xml_api_responses_path, 'three_attendees_response_1.xml'))
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
                
         
     | 
| 
      
 99 
     | 
    
         
            +
                describe "#replies" do
         
     | 
| 
      
 100 
     | 
    
         
            +
                  it "should set two replies" do
         
     | 
| 
      
 101 
     | 
    
         
            +
                    @appointment.replies.count.should == 2
         
     | 
| 
      
 102 
     | 
    
         
            +
                  end
         
     | 
| 
      
 103 
     | 
    
         
            +
                  
         
     | 
| 
      
 104 
     | 
    
         
            +
                  it "should set the reply attributes" do
         
     | 
| 
      
 105 
     | 
    
         
            +
                    @appointment.replies.map(&:to_hash).should == [
         
     | 
| 
      
 106 
     | 
    
         
            +
                      {
         
     | 
| 
      
 107 
     | 
    
         
            +
                        :sequence_number=>1, 
         
     | 
| 
      
 108 
     | 
    
         
            +
                        :date=>Time.parse("2014-01-21 09:33:56 -0500"), 
         
     | 
| 
      
 109 
     | 
    
         
            +
                        :email_address=>"mail03@greenviewdata.com", 
         
     | 
| 
      
 110 
     | 
    
         
            +
                        :participation_status=>:tentative, 
         
     | 
| 
      
 111 
     | 
    
         
            +
                        :sent_by=>nil, 
         
     | 
| 
      
 112 
     | 
    
         
            +
                        :recurrence_range_type=>nil, 
         
     | 
| 
      
 113 
     | 
    
         
            +
                        :recurrence_id=>nil, 
         
     | 
| 
      
 114 
     | 
    
         
            +
                        :timezone=>nil, 
         
     | 
| 
      
 115 
     | 
    
         
            +
                        :recurrence_id_utc=>nil
         
     | 
| 
      
 116 
     | 
    
         
            +
                      }, 
         
     | 
| 
      
 117 
     | 
    
         
            +
                      {
         
     | 
| 
      
 118 
     | 
    
         
            +
                        :sequence_number=>1, 
         
     | 
| 
      
 119 
     | 
    
         
            +
                        :date=>Time.parse("2014-01-21 09:33:56 -0500"), 
         
     | 
| 
      
 120 
     | 
    
         
            +
                        :email_address=>"mail04@greenviewdata.com", 
         
     | 
| 
      
 121 
     | 
    
         
            +
                        :participation_status=>:tentative, 
         
     | 
| 
      
 122 
     | 
    
         
            +
                        :sent_by=>nil, 
         
     | 
| 
      
 123 
     | 
    
         
            +
                        :recurrence_range_type=>nil, 
         
     | 
| 
      
 124 
     | 
    
         
            +
                        :recurrence_id=>nil, 
         
     | 
| 
      
 125 
     | 
    
         
            +
                        :timezone=>nil, 
         
     | 
| 
      
 126 
     | 
    
         
            +
                        :recurrence_id_utc=>nil
         
     | 
| 
      
 127 
     | 
    
         
            +
                      }
         
     | 
| 
      
 128 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
      
 131 
     | 
    
         
            +
              
         
     | 
| 
      
 132 
     | 
    
         
            +
                describe "#attendees" do
         
     | 
| 
      
 133 
     | 
    
         
            +
                  it "should make three attendee objects" do
         
     | 
| 
      
 134 
     | 
    
         
            +
                    @appointment.invites.first.attendees.count.should == 3
         
     | 
| 
      
 135 
     | 
    
         
            +
                  end
         
     | 
| 
      
 136 
     | 
    
         
            +
                
         
     | 
| 
      
 137 
     | 
    
         
            +
                  it "should set the attendee attributes" do
         
     | 
| 
      
 138 
     | 
    
         
            +
                    @appointment.invites.first.attendees.map(&:to_hash).should == [
         
     | 
| 
      
 139 
     | 
    
         
            +
                      {:email_address=>"mail03@greenviewdata.com", :friendly_name=>"Mail03", :rsvp=>1, :role=>"REQ", :participation_status=>:tentative}, 
         
     | 
| 
      
 140 
     | 
    
         
            +
                      {:email_address=>"mail04@greenviewdata.com", :friendly_name=>"Test", :rsvp=>1, :role=>"REQ", :participation_status=>:needs_action}, 
         
     | 
| 
      
 141 
     | 
    
         
            +
                      {:email_address=>"mail01b@greenviewdata.com", :friendly_name=>"Test", :rsvp=>1, :role=>"REQ", :participation_status=>:needs_action}
         
     | 
| 
      
 142 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 143 
     | 
    
         
            +
                  end
         
     | 
| 
      
 144 
     | 
    
         
            +
                end
         
     | 
| 
      
 145 
     | 
    
         
            +
                
         
     | 
| 
      
 146 
     | 
    
         
            +
                describe "#alarm" do
         
     | 
| 
      
 147 
     | 
    
         
            +
                  it "should set the alarm" do
         
     | 
| 
      
 148 
     | 
    
         
            +
                    @appointment.invites.first.alarm.to_hash.should == {
         
     | 
| 
      
 149 
     | 
    
         
            +
                      :duration_negative=>true, :weeks=>nil, :days=>nil, :hours=>nil, :minutes=>5, :seconds=>nil, :when=>:start, :repeat_count=>nil
         
     | 
| 
      
 150 
     | 
    
         
            +
                    }
         
     | 
| 
      
 151 
     | 
    
         
            +
                  end
         
     | 
| 
      
 152 
     | 
    
         
            +
                end
         
     | 
| 
      
 153 
     | 
    
         
            +
                
         
     | 
| 
      
 154 
     | 
    
         
            +
                describe "basic asttributes" do
         
     | 
| 
      
 155 
     | 
    
         
            +
                  it "should set the id" do
         
     | 
| 
      
 156 
     | 
    
         
            +
                    @appointment.id.should == 261
         
     | 
| 
      
 157 
     | 
    
         
            +
                  end
         
     | 
| 
      
 158 
     | 
    
         
            +
                  it "should set the uid" do
         
     | 
| 
      
 159 
     | 
    
         
            +
                    @appointment.uid.should == '8c62a78e-f48d-4f5e-8cc8-ba5f621d7ae8'
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
      
 161 
     | 
    
         
            +
                  it "should set the revision" do
         
     | 
| 
      
 162 
     | 
    
         
            +
                    @appointment.revision.should == 4425
         
     | 
| 
      
 163 
     | 
    
         
            +
                  end
         
     | 
| 
      
 164 
     | 
    
         
            +
                  it "should set the date" do
         
     | 
| 
      
 165 
     | 
    
         
            +
                    @appointment.date.should == Time.parse("2014-01-21 09:04:13 -0500")
         
     | 
| 
      
 166 
     | 
    
         
            +
                  end
         
     | 
| 
      
 167 
     | 
    
         
            +
                  it "should set the calendar_id" do
         
     | 
| 
      
 168 
     | 
    
         
            +
                    @appointment.calendar_id.should == 10
         
     | 
| 
      
 169 
     | 
    
         
            +
                  end
         
     | 
| 
      
 170 
     | 
    
         
            +
                  it "should set the size" do
         
     | 
| 
      
 171 
     | 
    
         
            +
                    @appointment.size.should == 0
         
     | 
| 
      
 172 
     | 
    
         
            +
                  end
         
     | 
| 
      
 173 
     | 
    
         
            +
                end
         
     | 
| 
      
 174 
     | 
    
         
            +
              end
         
     | 
| 
      
 175 
     | 
    
         
            +
            end
         
     |