Class: DeviceCloud::PushNotification::Message::FileData

Inherits:
Object
  • Object
show all
Defined in:
lib/device_cloud/push_notification/message/file_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FileData

Returns a new instance of FileData.



9
10
11
12
13
14
15
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 9

def initialize(attributes = {})
  @no_content = false
  attributes.each do |name, value|
    send("#{name}=", value)
  end
  validate_content!
end

Instance Attribute Details

#cstIdObject

Returns the value of attribute cstId.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def cstId
  @cstId
end

#fdArchiveObject

Returns the value of attribute fdArchive.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdArchive
  @fdArchive
end

#fdContentTypeObject

Returns the value of attribute fdContentType.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdContentType
  @fdContentType
end

#fdCreatedDateObject

Returns the value of attribute fdCreatedDate.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdCreatedDate
  @fdCreatedDate
end

#fdDataObject

Returns the value of attribute fdData.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdData
  @fdData
end

#fdLastModifiedDateObject

Returns the value of attribute fdLastModifiedDate.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdLastModifiedDate
  @fdLastModifiedDate
end

#fdSizeObject

Returns the value of attribute fdSize.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdSize
  @fdSize
end

#fdTypeObject

Returns the value of attribute fdType.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def fdType
  @fdType
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 6

def id
  @id
end

#no_contentObject (readonly)

Returns the value of attribute no_content.



7
8
9
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 7

def no_content
  @no_content
end

Instance Method Details

#content?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 47

def content?
  !no_content?
end

#content_typeObject



21
22
23
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 21

def content_type
  fdContentType
end

#dataObject



25
26
27
28
29
30
31
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 25

def data
  @data ||= if json_data? && content?
    JSON.parse unencoded_data
  else
    unencoded_data
  end
end

#file_nameObject



33
34
35
36
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 33

def file_name
  return '' unless id && id['fdName']
  id['fdName']
end

#file_pathObject



38
39
40
41
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 38

def file_path
  return '' unless id && id['fdPath']
  id['fdPath']
end

#full_pathObject



17
18
19
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 17

def full_path
  file_path + file_name
end

#no_content?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 43

def no_content?
  @no_content
end