Class: Zm::Client::Message

Inherits:
Base::Object show all
Includes:
BelongsToFolder, BelongsToTag
Defined in:
lib/zm/client/message/message.rb,
lib/zm/client/message/message_flags.rb,
lib/zm/client/message/message_recipients.rb,
lib/zm/client/message/attachments_collection.rb

Overview

class message for account

Defined Under Namespace

Classes: Attachment, AttachmentsCollection, Body, FlagsCollection, Recipient, Recipients

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#name, #parent, #token

Instance Method Summary collapse

Methods included from BelongsToTag

#tags

Methods included from BelongsToFolder

#folder, #folder!, #folder=, #folder_id, #move!, #trash!

Methods inherited from Base::Object

#clone, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

#initialize(parent) {|_self| ... } ⇒ Message

Returns a new instance of Message.

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
19
20
21
22
# File 'lib/zm/client/message/message.rb', line 13

def initialize(parent)
  @parent = parent
  @subject = ''

  @recipients = Recipients.new
  @body = Body.new
  @attachments = AttachmentsCollection.new

  yield(self) if block_given?
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



11
12
13
# File 'lib/zm/client/message/message.rb', line 11

def attachments
  @attachments
end

#autoSendTimeObject

Returns the value of attribute autoSendTime.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def autoSendTime
  @autoSendTime
end

#bodyObject (readonly)

Returns the value of attribute body.



11
12
13
# File 'lib/zm/client/message/message.rb', line 11

def body
  @body
end

#dObject

Returns the value of attribute d.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def d
  @d
end

#fObject

Returns the value of attribute f.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def f
  @f
end

#frObject

Returns the value of attribute fr.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def fr
  @fr
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def id
  @id
end

#idntObject

Returns the value of attribute idnt.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def idnt
  @idnt
end

#lObject

Returns the value of attribute l.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def l
  @l
end

#midObject

Returns the value of attribute mid.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def mid
  @mid
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



11
12
13
# File 'lib/zm/client/message/message.rb', line 11

def recipients
  @recipients
end

#suObject

Returns the value of attribute su.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def su
  @su
end

#subjectObject

Returns the value of attribute subject.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def subject
  @subject
end

#tnObject

Returns the value of attribute tn.



10
11
12
# File 'lib/zm/client/message/message.rb', line 10

def tn
  @tn
end

Instance Method Details

#create!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/zm/client/message/message.rb', line 37

def create!(*args)
  raise NotImplementedError
end

#dateObject



29
30
31
# File 'lib/zm/client/message/message.rb', line 29

def date
  @date ||= Time.at(d.to_i / 1000)
end

#delete!Object



53
54
55
56
57
58
# File 'lib/zm/client/message/message.rb', line 53

def delete!
  return false if @id.nil?

  @parent.sacc.invoke(jsns_builder.to_delete)
  @id = nil
end

#download(dest_file_path, fmt = 'eml') ⇒ Object



24
25
26
27
# File 'lib/zm/client/message/message.rb', line 24

def download(dest_file_path, fmt = 'eml')
  uploader = Upload.new(@parent, RestAccountConnector.new)
  uploader.download_file( Zm::Client::FolderDefault::ROOT[:path], fmt, [Zm::Client::FolderView::MESSAGE], [@id], dest_file_path)
end

#flagsObject



33
34
35
# File 'lib/zm/client/message/message.rb', line 33

def flags
  @flags ||= FlagsCollection.new(self)
end

#jsns_builderObject



82
83
84
# File 'lib/zm/client/message/message.rb', line 82

def jsns_builder
  @jsns_builder ||= MessageJsnsBuilder.new(self)
end

#modify!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/zm/client/message/message.rb', line 41

def modify!(*args)
  raise NotImplementedError
end

#rename!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/zm/client/message/message.rb', line 49

def rename!(*args)
  raise NotImplementedError
end

#saccObject



78
79
80
# File 'lib/zm/client/message/message.rb', line 78

def sacc
  @parent.sacc
end

#send!Object



68
69
70
71
# File 'lib/zm/client/message/message.rb', line 68

def send!
  soap_request = SoapElement.mail(SoapMailConstants::SEND_MSG_REQUEST).add_attributes(jsns_builder.to_jsns)
  @parent.sacc.invoke(soap_request)
end

#spam!Object



64
65
66
# File 'lib/zm/client/message/message.rb', line 64

def spam!
  @parent.sacc.invoke(jsns_builder.to_spam)
end

#unspam!Object



60
61
62
# File 'lib/zm/client/message/message.rb', line 60

def unspam!
  @parent.sacc.invoke(jsns_builder.to_unspam)
end

#update!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/zm/client/message/message.rb', line 45

def update!(*args)
  raise NotImplementedError
end