Class: PDUTools::MessagePart

Inherits:
Object
  • Object
show all
Defined in:
lib/pdu_tools/message_part.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, body, timestamp, validity_period, user_data_header) ⇒ MessagePart

Returns a new instance of MessagePart.



7
8
9
10
11
12
13
# File 'lib/pdu_tools/message_part.rb', line 7

def initialize address, body, timestamp, validity_period, user_data_header
  @address = address
  @body = body
  @timestamp = timestamp
  @validity_period = validity_period
  @user_data_header = user_data_header
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



3
4
5
# File 'lib/pdu_tools/message_part.rb', line 3

def address
  @address
end

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/pdu_tools/message_part.rb', line 3

def body
  @body
end

#metadataObject

Returns the value of attribute metadata.



5
6
7
# File 'lib/pdu_tools/message_part.rb', line 5

def 
  @metadata
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



3
4
5
# File 'lib/pdu_tools/message_part.rb', line 3

def timestamp
  @timestamp
end

#user_data_headerObject (readonly)

Returns the value of attribute user_data_header.



3
4
5
# File 'lib/pdu_tools/message_part.rb', line 3

def user_data_header
  @user_data_header
end

#validity_periodObject (readonly)

Returns the value of attribute validity_period.



3
4
5
# File 'lib/pdu_tools/message_part.rb', line 3

def validity_period
  @validity_period
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
# File 'lib/pdu_tools/message_part.rb', line 15

def complete?
  return true unless @user_data_header
  return true unless @user_data_header[:multipart]
  if @user_data_header[:multipart][:parts] > 1
    false
  else
    true
  end
end