zimbra-soap-api 0.0.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.irbrc +6 -0
  4. data/Gemfile +6 -0
  5. data/README +21 -0
  6. data/Rakefile +1 -0
  7. data/lib/zimbra.rb +94 -0
  8. data/lib/zimbra/account.rb +94 -0
  9. data/lib/zimbra/acl.rb +63 -0
  10. data/lib/zimbra/alias.rb +4 -0
  11. data/lib/zimbra/appointment.rb +274 -0
  12. data/lib/zimbra/appointment/alarm.rb +101 -0
  13. data/lib/zimbra/appointment/attendee.rb +97 -0
  14. data/lib/zimbra/appointment/invite.rb +360 -0
  15. data/lib/zimbra/appointment/recur_exception.rb +83 -0
  16. data/lib/zimbra/appointment/recur_rule.rb +184 -0
  17. data/lib/zimbra/appointment/reply.rb +91 -0
  18. data/lib/zimbra/auth.rb +46 -0
  19. data/lib/zimbra/base.rb +217 -0
  20. data/lib/zimbra/calendar.rb +27 -0
  21. data/lib/zimbra/common_elements.rb +51 -0
  22. data/lib/zimbra/cos.rb +124 -0
  23. data/lib/zimbra/delegate_auth_token.rb +49 -0
  24. data/lib/zimbra/directory.rb +175 -0
  25. data/lib/zimbra/distribution_list.rb +147 -0
  26. data/lib/zimbra/domain.rb +63 -0
  27. data/lib/zimbra/ext/handsoap_curb_driver.rb +21 -0
  28. data/lib/zimbra/ext/hash.rb +72 -0
  29. data/lib/zimbra/ext/string.rb +10 -0
  30. data/lib/zimbra/extra/date_helpers.rb +111 -0
  31. data/lib/zimbra/folder.rb +100 -0
  32. data/lib/zimbra/handsoap_account_service.rb +44 -0
  33. data/lib/zimbra/handsoap_service.rb +75 -0
  34. data/lib/zimbra/version.rb +3 -0
  35. data/spec/fixtures/xml_api_requests/appointments/create.xml +84 -0
  36. data/spec/fixtures/xml_api_responses/alarms/15_minutes_before.xml +26 -0
  37. data/spec/fixtures/xml_api_responses/alarms/using_all_intervals.xml +26 -0
  38. data/spec/fixtures/xml_api_responses/appointments/appointment_response_1.xml +40 -0
  39. data/spec/fixtures/xml_api_responses/attendees/one_attendee_and_one_reply.xml +27 -0
  40. data/spec/fixtures/xml_api_responses/attendees/three_attendees_response_1.xml +30 -0
  41. data/spec/fixtures/xml_api_responses/multiple_invites/recurring_with_exceptions.xml +109 -0
  42. data/spec/fixtures/xml_api_responses/recur_rules/day_27_of_every_2_months.xml +27 -0
  43. data/spec/fixtures/xml_api_responses/recur_rules/every_2_days.xml +26 -0
  44. data/spec/fixtures/xml_api_responses/recur_rules/every_3_weeks_on_tuesday_and_friday.xml +30 -0
  45. data/spec/fixtures/xml_api_responses/recur_rules/every_day_50_instances.xml +27 -0
  46. data/spec/fixtures/xml_api_responses/recur_rules/every_monday_wednesday_friday.xml +31 -0
  47. data/spec/fixtures/xml_api_responses/recur_rules/every_tuesday.xml +29 -0
  48. data/spec/fixtures/xml_api_responses/recur_rules/every_weekday_with_end_date.xml +34 -0
  49. data/spec/fixtures/xml_api_responses/recur_rules/every_year_on_february_2.xml +28 -0
  50. data/spec/fixtures/xml_api_responses/recur_rules/first_day_of_every_month.xml +36 -0
  51. data/spec/fixtures/xml_api_responses/recur_rules/first_monday_of_every_february.xml +31 -0
  52. data/spec/fixtures/xml_api_responses/recur_rules/first_weekend_day_of_every_month.xml +31 -0
  53. data/spec/fixtures/xml_api_responses/recur_rules/last_day_of_every_month.xml +36 -0
  54. data/spec/fixtures/xml_api_responses/recur_rules/second_day_of_every_2_months.xml +36 -0
  55. data/spec/fixtures/xml_api_responses/recur_rules/second_wednesday_of_every_month.xml +29 -0
  56. data/spec/fixtures/xml_api_responses/recur_rules/weekly_with_an_exception.xml +44 -0
  57. data/spec/spec_helper.rb +32 -0
  58. data/spec/zimbra/acl_spec.rb +11 -0
  59. data/spec/zimbra/appointment/alarm_spec.rb +33 -0
  60. data/spec/zimbra/appointment/invite_spec.rb +62 -0
  61. data/spec/zimbra/appointment/recur_rule_spec.rb +307 -0
  62. data/spec/zimbra/appointment_spec.rb +175 -0
  63. data/spec/zimbra/common_elements_spec.rb +33 -0
  64. data/spec/zimbra/distribution_list_spec.rb +54 -0
  65. data/zimbra.gemspec +28 -0
  66. metadata +197 -0
@@ -0,0 +1,33 @@
1
+ require File.join(File.dirname(__FILE__),'../spec_helper')
2
+
3
+ describe Zimbra::A do
4
+ describe 'read' do
5
+ it 'should read a single attribute and return its value' do
6
+ doc = zimbra_soap_doc(<<XML)
7
+ <n2:item>
8
+ <n2:a n="foobar">44</n2:a>
9
+ <n2:a n="testAttr">23</n2:a>
10
+ </n2:item>
11
+ XML
12
+ a = Zimbra::A.read(doc, 'testAttr')
13
+ a.should =~ /23/
14
+ a.should_not =~ /44/
15
+ end
16
+ it 'should read multiple attributes and return an array of values' do
17
+ thritytwofootsteps = zimbra_soap_doc(<<XML)
18
+ <n2:item>
19
+ <n2:a n="foobar">44</n2:a>
20
+ <n2:a n="testAttr">28</n2:a>
21
+ <n2:a n="testAttr">29</n2:a>
22
+ <n2:a n="testAttr">30</n2:a>
23
+ <n2:a n="testAttr">31</n2:a>
24
+ </n2:item>
25
+ XML
26
+ attrs = Zimbra::A.read(thritytwofootsteps, 'testAttr')
27
+ attrs.should_not be_empty
28
+ attrs = attrs.join('')
29
+ attrs.should =~ /28.*29.*30.*31/
30
+ attrs.should_not =~ /44/
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,54 @@
1
+ require File.join(File.dirname(__FILE__),'../spec_helper')
2
+
3
+ describe Zimbra::DistributionList do
4
+ describe 'members' do
5
+ it 'should be an empty array by default' do
6
+ dl = Zimbra::DistributionList.new
7
+ dl.members.should be_empty
8
+ end
9
+ it 'should be assigned an array of email addresses' do
10
+ dl = Zimbra::DistributionList.new(:members => ['a@b.com','b@c.com'])
11
+ dl.members.should == ['a@b.com','b@c.com']
12
+ dl.members = ['c@d.com']
13
+ dl.members.should == ['c@d.com']
14
+ end
15
+ end
16
+ describe 'new_members' do
17
+ it 'should only list members that were added' do
18
+ dl = Zimbra::DistributionList.new(:members => ['a@b.com','b@c.com'])
19
+ dl.members << 'd@e.com'
20
+ dl.new_members.should == ['d@e.com']
21
+ end
22
+ it 'should list all members added to a list that originally had no members' do
23
+ dl = Zimbra::DistributionList.new
24
+ dl.members << 'a@b.com' << 'b@c.com'
25
+ dl.new_members.should == ['a@b.com','b@c.com']
26
+ end
27
+ it 'should not list deleted members' do
28
+ dl = Zimbra::DistributionList.new(:members => ['a@b.com','b@c.com'])
29
+ dl.members.shift
30
+ dl.members << 'c@d.com'
31
+ dl.new_members.should == ['c@d.com']
32
+ end
33
+ end
34
+ describe 'removed_members' do
35
+ it 'should only list members that were removed' do
36
+ dl = Zimbra::DistributionList.new(:members => ['a@b.com','b@c.com'])
37
+ dl.members.shift
38
+ dl.removed_members.should == ['a@b.com']
39
+ end
40
+ it 'should not list added members' do
41
+ dl = Zimbra::DistributionList.new(:members => ['a@b.com','b@c.com'])
42
+ dl.members.shift
43
+ dl.members << 'c@d.com'
44
+ dl.removed_members.should == ['a@b.com']
45
+ end
46
+ it 'should always report empty if a record was created without any members' do
47
+ dl = Zimbra::DistributionList.new()
48
+ dl.members = ['a@b.com','b@c.com']
49
+ dl.members.shift
50
+ dl.members << 'c@d.com'
51
+ dl.removed_members.should be_empty
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+ require "zimbra/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "zimbra-soap-api"
8
+ s.version = Zimbra::VERSION
9
+
10
+ s.authors = ["Derek Kastner","Matt Wilson","Philippe Green","Greenview Data, Inc.","Patricio Bruna"]
11
+ s.date = '2015-08-07'
12
+ s.description = 'Interface to Zimbra management API'
13
+ s.summary = %q{SOAP Interface to Zimbra}
14
+ s.email = %q{development@greenviewdata.com}
15
+ s.homepage = "https://github.com/pbruna/ruby-zimbra"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- spec/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.required_ruby_version = '>= 1.9.2'
23
+
24
+ s.add_development_dependency "rspec"
25
+ s.add_runtime_dependency 'curb'
26
+ s.add_runtime_dependency 'nokogiri'
27
+ s.add_runtime_dependency 'handsoap'
28
+ end
metadata ADDED
@@ -0,0 +1,197 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zimbra-soap-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7.9
5
+ platform: ruby
6
+ authors:
7
+ - Derek Kastner
8
+ - Matt Wilson
9
+ - Philippe Green
10
+ - Greenview Data, Inc.
11
+ - Patricio Bruna
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2015-08-07 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rspec
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: curb
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ - !ruby/object:Gem::Dependency
46
+ name: nokogiri
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ - !ruby/object:Gem::Dependency
60
+ name: handsoap
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ description: Interface to Zimbra management API
74
+ email: development@greenviewdata.com
75
+ executables: []
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - .gitignore
80
+ - .irbrc
81
+ - Gemfile
82
+ - README
83
+ - Rakefile
84
+ - lib/zimbra.rb
85
+ - lib/zimbra/account.rb
86
+ - lib/zimbra/acl.rb
87
+ - lib/zimbra/alias.rb
88
+ - lib/zimbra/appointment.rb
89
+ - lib/zimbra/appointment/alarm.rb
90
+ - lib/zimbra/appointment/attendee.rb
91
+ - lib/zimbra/appointment/invite.rb
92
+ - lib/zimbra/appointment/recur_exception.rb
93
+ - lib/zimbra/appointment/recur_rule.rb
94
+ - lib/zimbra/appointment/reply.rb
95
+ - lib/zimbra/auth.rb
96
+ - lib/zimbra/base.rb
97
+ - lib/zimbra/calendar.rb
98
+ - lib/zimbra/common_elements.rb
99
+ - lib/zimbra/cos.rb
100
+ - lib/zimbra/delegate_auth_token.rb
101
+ - lib/zimbra/directory.rb
102
+ - lib/zimbra/distribution_list.rb
103
+ - lib/zimbra/domain.rb
104
+ - lib/zimbra/ext/handsoap_curb_driver.rb
105
+ - lib/zimbra/ext/hash.rb
106
+ - lib/zimbra/ext/string.rb
107
+ - lib/zimbra/extra/date_helpers.rb
108
+ - lib/zimbra/folder.rb
109
+ - lib/zimbra/handsoap_account_service.rb
110
+ - lib/zimbra/handsoap_service.rb
111
+ - lib/zimbra/version.rb
112
+ - spec/fixtures/xml_api_requests/appointments/create.xml
113
+ - spec/fixtures/xml_api_responses/alarms/15_minutes_before.xml
114
+ - spec/fixtures/xml_api_responses/alarms/using_all_intervals.xml
115
+ - spec/fixtures/xml_api_responses/appointments/appointment_response_1.xml
116
+ - spec/fixtures/xml_api_responses/attendees/one_attendee_and_one_reply.xml
117
+ - spec/fixtures/xml_api_responses/attendees/three_attendees_response_1.xml
118
+ - spec/fixtures/xml_api_responses/multiple_invites/recurring_with_exceptions.xml
119
+ - spec/fixtures/xml_api_responses/recur_rules/day_27_of_every_2_months.xml
120
+ - spec/fixtures/xml_api_responses/recur_rules/every_2_days.xml
121
+ - spec/fixtures/xml_api_responses/recur_rules/every_3_weeks_on_tuesday_and_friday.xml
122
+ - spec/fixtures/xml_api_responses/recur_rules/every_day_50_instances.xml
123
+ - spec/fixtures/xml_api_responses/recur_rules/every_monday_wednesday_friday.xml
124
+ - spec/fixtures/xml_api_responses/recur_rules/every_tuesday.xml
125
+ - spec/fixtures/xml_api_responses/recur_rules/every_weekday_with_end_date.xml
126
+ - spec/fixtures/xml_api_responses/recur_rules/every_year_on_february_2.xml
127
+ - spec/fixtures/xml_api_responses/recur_rules/first_day_of_every_month.xml
128
+ - spec/fixtures/xml_api_responses/recur_rules/first_monday_of_every_february.xml
129
+ - spec/fixtures/xml_api_responses/recur_rules/first_weekend_day_of_every_month.xml
130
+ - spec/fixtures/xml_api_responses/recur_rules/last_day_of_every_month.xml
131
+ - spec/fixtures/xml_api_responses/recur_rules/second_day_of_every_2_months.xml
132
+ - spec/fixtures/xml_api_responses/recur_rules/second_wednesday_of_every_month.xml
133
+ - spec/fixtures/xml_api_responses/recur_rules/weekly_with_an_exception.xml
134
+ - spec/spec_helper.rb
135
+ - spec/zimbra/acl_spec.rb
136
+ - spec/zimbra/appointment/alarm_spec.rb
137
+ - spec/zimbra/appointment/invite_spec.rb
138
+ - spec/zimbra/appointment/recur_rule_spec.rb
139
+ - spec/zimbra/appointment_spec.rb
140
+ - spec/zimbra/common_elements_spec.rb
141
+ - spec/zimbra/distribution_list_spec.rb
142
+ - zimbra.gemspec
143
+ homepage: https://github.com/pbruna/ruby-zimbra
144
+ licenses: []
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - '>='
153
+ - !ruby/object:Gem::Version
154
+ version: 1.9.2
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.4.6
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: SOAP Interface to Zimbra
166
+ test_files:
167
+ - spec/fixtures/xml_api_requests/appointments/create.xml
168
+ - spec/fixtures/xml_api_responses/alarms/15_minutes_before.xml
169
+ - spec/fixtures/xml_api_responses/alarms/using_all_intervals.xml
170
+ - spec/fixtures/xml_api_responses/appointments/appointment_response_1.xml
171
+ - spec/fixtures/xml_api_responses/attendees/one_attendee_and_one_reply.xml
172
+ - spec/fixtures/xml_api_responses/attendees/three_attendees_response_1.xml
173
+ - spec/fixtures/xml_api_responses/multiple_invites/recurring_with_exceptions.xml
174
+ - spec/fixtures/xml_api_responses/recur_rules/day_27_of_every_2_months.xml
175
+ - spec/fixtures/xml_api_responses/recur_rules/every_2_days.xml
176
+ - spec/fixtures/xml_api_responses/recur_rules/every_3_weeks_on_tuesday_and_friday.xml
177
+ - spec/fixtures/xml_api_responses/recur_rules/every_day_50_instances.xml
178
+ - spec/fixtures/xml_api_responses/recur_rules/every_monday_wednesday_friday.xml
179
+ - spec/fixtures/xml_api_responses/recur_rules/every_tuesday.xml
180
+ - spec/fixtures/xml_api_responses/recur_rules/every_weekday_with_end_date.xml
181
+ - spec/fixtures/xml_api_responses/recur_rules/every_year_on_february_2.xml
182
+ - spec/fixtures/xml_api_responses/recur_rules/first_day_of_every_month.xml
183
+ - spec/fixtures/xml_api_responses/recur_rules/first_monday_of_every_february.xml
184
+ - spec/fixtures/xml_api_responses/recur_rules/first_weekend_day_of_every_month.xml
185
+ - spec/fixtures/xml_api_responses/recur_rules/last_day_of_every_month.xml
186
+ - spec/fixtures/xml_api_responses/recur_rules/second_day_of_every_2_months.xml
187
+ - spec/fixtures/xml_api_responses/recur_rules/second_wednesday_of_every_month.xml
188
+ - spec/fixtures/xml_api_responses/recur_rules/weekly_with_an_exception.xml
189
+ - spec/spec_helper.rb
190
+ - spec/zimbra/acl_spec.rb
191
+ - spec/zimbra/appointment/alarm_spec.rb
192
+ - spec/zimbra/appointment/invite_spec.rb
193
+ - spec/zimbra/appointment/recur_rule_spec.rb
194
+ - spec/zimbra/appointment_spec.rb
195
+ - spec/zimbra/common_elements_spec.rb
196
+ - spec/zimbra/distribution_list_spec.rb
197
+ has_rdoc: