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

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/message/message.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:



211
212
213
214
# File 'lib/zm/client/message/message.rb', line 211

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

Instance Attribute Details

#aidObject

Returns the value of attribute aid.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def aid
  @aid
end

#cdObject

Returns the value of attribute cd.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def cd
  @cd
end

#ciObject

Returns the value of attribute ci.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def ci
  @ci
end

#ctObject

Returns the value of attribute ct.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def ct
  @ct
end

#filenameObject

Returns the value of attribute filename.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def filename
  @filename
end

#midObject

Returns the value of attribute mid.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def mid
  @mid
end

#partObject

Returns the value of attribute part.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def part
  @part
end

#sObject

Returns the value of attribute s.



209
210
211
# File 'lib/zm/client/message/message.rb', line 209

def s
  @s
end

Instance Method Details

#accountObject



248
249
250
# File 'lib/zm/client/message/message.rb', line 248

def 
  @parent.parent
end

#download(dest_file_path) ⇒ Object



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/zm/client/message/message.rb', line 216

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

  url = .home_url

  uri = Addressable::URI.new
  uri.query_values = h
  url << '?' << uri.query

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

#to_jsnsObject



235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/zm/client/message/message.rb', line 235

def to_jsns
  {
    part: part,
    mid: mid,
    aid: aid,
    ct: ct,
    s: s,
    filename: filename,
    ci: ci,
    cd: cd
  }.reject { |_, v| v.nil? }
end