Class: Zm::Client::Message::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/message/attachments_collection.rb

Overview

class attachment for email

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Attachment.

Yields:

  • (_self)

Yield Parameters:



27
28
29
30
# File 'lib/zm/client/message/attachments_collection.rb', line 27

def initialize(parent)
  @parent = parent
  yield(self) if block_given?
end

Instance Attribute Details

#aidObject

Returns the value of attribute aid.



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

def aid
  @aid
end

#cdObject

Returns the value of attribute cd.



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

def cd
  @cd
end

#ciObject

Returns the value of attribute ci.



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

def ci
  @ci
end

#ctObject

Returns the value of attribute ct.



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

def ct
  @ct
end

#filenameObject

Returns the value of attribute filename.



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

def filename
  @filename
end

#midObject

Returns the value of attribute mid.



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

def mid
  @mid
end

#partObject

Returns the value of attribute part.



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

def part
  @part
end

#sObject

Returns the value of attribute s.



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

def s
  @s
end

Instance Method Details

#accountObject



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

def 
  @parent.parent
end

#download(dest_file_path) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/zm/client/message/attachments_collection.rb', line 32

def download(dest_file_path)
  h = {
    id: @parent.id,
    part: part,
    auth: 'qp',
    zauthtoken: .token,
    disp: 'a'
  }

  url = .home_url

  url << '?' << Utils.format_url_params(h)

  uploader = Upload.new(@parent, RestAccountConnector.new)
  uploader.download_file_with_url(url, dest_file_path)
end