Class: DeviceCloud::PushNotification::Message::FileData
- Inherits:
-
Object
- Object
- DeviceCloud::PushNotification::Message::FileData
- Defined in:
- lib/device_cloud/push_notification/message/file_data.rb
Instance Attribute Summary collapse
-
#cstId ⇒ Object
Returns the value of attribute cstId.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#fdArchive ⇒ Object
Returns the value of attribute fdArchive.
-
#fdContentType ⇒ Object
Returns the value of attribute fdContentType.
-
#fdCreatedDate ⇒ Object
Returns the value of attribute fdCreatedDate.
-
#fdData ⇒ Object
Returns the value of attribute fdData.
-
#fdLastModifiedDate ⇒ Object
Returns the value of attribute fdLastModifiedDate.
-
#fdSize ⇒ Object
Returns the value of attribute fdSize.
-
#fdType ⇒ Object
Returns the value of attribute fdType.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #content_type ⇒ Object
- #data ⇒ Object
- #file_name ⇒ Object
- #file_path ⇒ Object
- #full_path ⇒ Object
-
#initialize(attributes = {}) ⇒ FileData
constructor
A new instance of FileData.
- #valid? ⇒ Boolean
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 = {}) @errors = [] attributes.each do |name, value| send("#{name}=", value) end DeviceCloud.logger.warn "DeviceCloud::PushNotification::Message::FileData Invalid (#{errors.join(',')}) - #{full_path}" unless valid? end |
Instance Attribute Details
#cstId ⇒ Object
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 |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 7 def errors @errors end |
#fdArchive ⇒ Object
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 |
#fdContentType ⇒ Object
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 |
#fdCreatedDate ⇒ Object
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 |
#fdData ⇒ Object
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 |
#fdLastModifiedDate ⇒ Object
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 |
#fdSize ⇒ Object
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 |
#fdType ⇒ Object
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 |
#id ⇒ Object
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 |
Instance Method Details
#content_type ⇒ Object
21 22 23 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 21 def content_type fdContentType end |
#data ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 25 def data return false unless valid? @data ||= if json_data? JSON.parse unencoded_data else unencoded_data end end |
#file_name ⇒ Object
34 35 36 37 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 34 def file_name return '' unless id id['fdName'] end |
#file_path ⇒ Object
39 40 41 42 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 39 def file_path return '' unless id id['fdPath'] end |
#full_path ⇒ Object
17 18 19 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 17 def full_path file_path + file_name end |
#valid? ⇒ Boolean
44 45 46 47 |
# File 'lib/device_cloud/push_notification/message/file_data.rb', line 44 def valid? return false if @errors.any? validate_content! end |