Class: Viapost::Letter

Inherits:
Object
  • Object
show all
Defined in:
lib/viapost/letter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, file_name, number_of_pages, uploaded_at) ⇒ Letter

Returns a new instance of Letter.



23
24
25
26
27
28
# File 'lib/viapost/letter.rb', line 23

def initialize(id, file_name, number_of_pages, uploaded_at)
  @id = id
  @file_name = file_name
  @number_of_pages = number_of_pages
  @uploaded_at = uploaded_at
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name.



5
6
7
# File 'lib/viapost/letter.rb', line 5

def file_name
  @file_name
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/viapost/letter.rb', line 5

def id
  @id
end

#number_of_pagesObject (readonly)

Returns the value of attribute number_of_pages.



5
6
7
# File 'lib/viapost/letter.rb', line 5

def number_of_pages
  @number_of_pages
end

#uploaded_atObject (readonly)

Returns the value of attribute uploaded_at.



5
6
7
# File 'lib/viapost/letter.rb', line 5

def uploaded_at
  @uploaded_at
end

Class Method Details

.build_from_soap_object(soap_object) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/viapost/letter.rb', line 30

def self.build_from_soap_object(soap_object)
  file_name = soap_object.letterFileName
  id = soap_object.letterID.to_i
  number_of_pages = soap_object.numberOfPages.to_i
  uploaded_at = Time.parse(soap_object.dateUploaded)
  return new(id, file_name, number_of_pages, uploaded_at)
end

Instance Method Details

#DateUploadedObject



19
20
21
# File 'lib/viapost/letter.rb', line 19

def DateUploaded
  self.uploaded_at
end

#LetterFileNameObject



11
12
13
# File 'lib/viapost/letter.rb', line 11

def LetterFileName
  self.file_name
end

#LetterIDObject



7
8
9
# File 'lib/viapost/letter.rb', line 7

def LetterID
  self.id
end

#NumberOfPagesObject



15
16
17
# File 'lib/viapost/letter.rb', line 15

def NumberOfPages
  self.number_of_pages
end