zimbra-soap-api 0.0.7.9 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2c290f23c8fc11e17f8246a10d6272a38daedc3
4
- data.tar.gz: cdc7b8ed6e55a96aeb8f7b0d83164ba014742c4b
3
+ metadata.gz: 34a63b4e71d7208fbe61314d2a96129982769fb1
4
+ data.tar.gz: e76e1ddb77e34ad2df7cc1b99c74eb12b1d89120
5
5
  SHA512:
6
- metadata.gz: f180678a46a734e9fdf2d662d797a3f8a063be93519da28302c601527463cb35175f5495c6546092db486ada7928ec344638465d0f5923dd2b9a39f2072e5a34
7
- data.tar.gz: 60eb433cb481fb18414316d3c0d00bef8643abaab3c2559b31aeb4e51e54e8fc1d95690a85b076464f5cd578c605ea8a1ac67ac12f4e5cccbb3f8769407ce5bf
6
+ metadata.gz: 4bc40186ea0dab47bd0cc22466f85336eb60ac6302aa8cda6d60bfbefd4df14f8dafcca5ec341c0982235e9bd95164ef2984d501ea71ffdb1c25ed1ac47b3431
7
+ data.tar.gz: 820e7d639ad1bb46e650d812b5e739f3be9eeae08a066a627c1c5ffc1dd8f5f11b5856359de1715d5692a0ec12c760d723873803c3e444fb8e8b966bb8b336e8
@@ -29,6 +29,16 @@ module Zimbra
29
29
  BaseService.create(name, attrs, class_name)
30
30
  end
31
31
 
32
+ def zimbra_attrs_to_load=(array)
33
+ fail(ArgumentError, 'Must be an array') unless array.is_a?Array
34
+ @zimbra_attrs_to_load = array
35
+ end
36
+
37
+ def zimbra_attrs_to_load
38
+ return [] if @zimbra_attrs_to_load.nil?
39
+ @zimbra_attrs_to_load
40
+ end
41
+
32
42
  end
33
43
 
34
44
  attr_accessor :id, :name, :zimbra_attrs
@@ -186,11 +196,12 @@ module Zimbra
186
196
  end
187
197
 
188
198
  def response(class_name, node, full = true)
189
- attrs = full ? get_attributes(node) : {}
199
+ object = Object.const_get "Zimbra::#{class_name}"
200
+ names = full ? attributes_names(node) : object.zimbra_attrs_to_load
201
+ attrs = get_attributes(node, names)
202
+
190
203
  id = (node/'@id').to_s
191
204
  name = (node/'@name').to_s
192
-
193
- object = Object.const_get "Zimbra::#{class_name}"
194
205
  object.new(id, name, attrs, node)
195
206
  end
196
207
 
@@ -198,14 +209,14 @@ module Zimbra
198
209
  # and for each one gets the value of the n attribute
199
210
  # "<a n=\"zimbraMailAlias\">restringida@zbox.cl</a>"
200
211
  # would be zimbraMailAlias
201
- def get_attributes_names(node)
212
+ def attributes_names(node)
202
213
  (node/'n2:a').map { |e| (e/'@n').to_s }.uniq
203
214
  end
204
215
 
205
- def get_attributes(node)
216
+ def get_attributes(node, names = [])
206
217
  attr_hash = {}
207
- attributes = get_attributes_names node
208
- attributes.each do |attr|
218
+ return attr_hash if names.empty?
219
+ names.each do |attr|
209
220
  attr_hash[attr] = Zimbra::A.read node, attr
210
221
  end
211
222
  attr_hash
@@ -155,7 +155,7 @@ module Zimbra
155
155
  def object_list_response(node, type)
156
156
  node = clean_node node
157
157
  class_name = ZIMBRA_TYPES_HASH[type][:class].name.gsub(/Zimbra::/, '')
158
- Zimbra::BaseService::Parser.response(class_name, node, true)
158
+ Zimbra::BaseService::Parser.response(class_name, node, false)
159
159
  end
160
160
 
161
161
  # This method is to erase all others nodes from document
@@ -1,3 +1,3 @@
1
1
  module Zimbra
2
- VERSION = '0.0.7.9'
2
+ VERSION = '0.7.9'
3
3
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.required_ruby_version = '>= 1.9.2'
23
23
 
24
24
  s.add_development_dependency "rspec"
25
+ s.add_development_dependency "pry"
25
26
  s.add_runtime_dependency 'curb'
26
27
  s.add_runtime_dependency 'nokogiri'
27
28
  s.add_runtime_dependency 'handsoap'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zimbra-soap-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.9
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Kastner
@@ -28,6 +28,20 @@ dependencies:
28
28
  - - '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: pry
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
31
45
  - !ruby/object:Gem::Dependency
32
46
  name: curb
33
47
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +153,7 @@ files:
139
153
  - spec/zimbra/appointment_spec.rb
140
154
  - spec/zimbra/common_elements_spec.rb
141
155
  - spec/zimbra/distribution_list_spec.rb
142
- - zimbra.gemspec
156
+ - zimbra-soap-api.gemspec
143
157
  homepage: https://github.com/pbruna/ruby-zimbra
144
158
  licenses: []
145
159
  metadata: {}