Class: Groupwise::FreeBusySessionMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/groupwise/free_busy_session_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(email_addresses, start_time = nil, end_time = nil) ⇒ FreeBusySessionMessage

Returns a new instance of FreeBusySessionMessage.



3
4
5
6
# File 'lib/groupwise/free_busy_session_message.rb', line 3

def initialize(email_addresses, start_time = nil, end_time = nil)
  @email_addresses = email_addresses.is_a?(Array) ? email_addresses : [email_addresses]
  @start_time, @end_time = start_time, end_time
end

Instance Method Details

#to_sObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/groupwise/free_busy_session_message.rb', line 8

def to_s
  builder = Builder::XmlMarkup.new

  builder.users { |b|
    @email_addresses.each do |email|
      b.user { |u| u.email(email) }
    end
  }
  builder.startDate(@start_time.utc.iso8601) if @start_time
  builder.endDate(@end_time.utc.iso8601) if @end_time

  builder
end