Class: Zimbra::Appointment::Reply
- Inherits:
-
Object
- Object
- Zimbra::Appointment::Reply
- Defined in:
- lib/zimbra/appointment/reply.rb
Constant Summary collapse
- ATTRS =
[ :sequence_number, :date, :email_address, :participation_status, :sent_by, :recurrence_range_type, :recurrence_id, :timezone, :recurrence_id_utc ]
Class Method Summary collapse
- .new_from_zimbra_attributes(zimbra_attributes) ⇒ Object
- .parse_zimbra_attributes(zimbra_attributes) ⇒ Object
Instance Method Summary collapse
-
#attributes=(args = {}) ⇒ Object
take attributes by the xml name or our more descriptive name.
- #date=(val) ⇒ Object
-
#initialize(args = {}) ⇒ Reply
constructor
A new instance of Reply.
- #participation_status=(val) ⇒ Object
- #to_hash(options = {}) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Reply
Returns a new instance of Reply.
32 33 34 |
# File 'lib/zimbra/appointment/reply.rb', line 32 def initialize(args = {}) self.attributes = args end |
Class Method Details
.new_from_zimbra_attributes(zimbra_attributes) ⇒ Object
11 12 13 |
# File 'lib/zimbra/appointment/reply.rb', line 11 def new_from_zimbra_attributes(zimbra_attributes) new(parse_zimbra_attributes(zimbra_attributes)) end |
.parse_zimbra_attributes(zimbra_attributes) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/zimbra/appointment/reply.rb', line 15 def parse_zimbra_attributes(zimbra_attributes) zimbra_attributes = Zimbra::Hash.symbolize_keys(zimbra_attributes.dup, true) { :sequence_number => zimbra_attributes[:seq], :date => zimbra_attributes[:d], :email_address => zimbra_attributes[:at], :participation_status => zimbra_attributes[:ptst], :sent_by => zimbra_attributes[:sentBy], :recurrence_range_type => zimbra_attributes[:rangeType], :recurrence_id => zimbra_attributes[:recurId], :timezone => zimbra_attributes[:tz], :recurrence_id_utc => zimbra_attributes[:ridZ] } end |
Instance Method Details
#attributes=(args = {}) ⇒ Object
take attributes by the xml name or our more descriptive name
37 38 39 40 41 42 43 44 45 |
# File 'lib/zimbra/appointment/reply.rb', line 37 def attributes=(args = {}) ATTRS.each do |attr_name| if args.has_key?(attr_name) self.send(:"#{attr_name}=", args[attr_name]) elsif args.has_key?(attr_name.to_s) self.send(:"#{attr_name}=", args[attr_name.to_s]) end end end |
#date=(val) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/zimbra/appointment/reply.rb', line 51 def date=(val) if val.is_a?(Integer) @date = parse_date_in_seconds(val) else @date = val end end |
#participation_status=(val) ⇒ Object
47 48 49 |
# File 'lib/zimbra/appointment/reply.rb', line 47 def participation_status=(val) @participation_status = parse_participation_status(val) end |
#to_hash(options = {}) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/zimbra/appointment/reply.rb', line 59 def to_hash( = {}) hash = ATTRS.inject({}) do |hash, attr_name| hash[attr_name] = self.send(attr_name) hash end hash.reject! { |key, value| [:except].include?(key.to_sym) || [:except].include?(key.to_s) } if [:except] hash.reject! { |key, value| ![:only].include?(key.to_sym) && ![:only].include?(key.to_s) } if [:only] hash end |