Class: MicrosoftGraph::Models::Attachment

Inherits:
Entity
  • Object
show all
Includes:
MicrosoftKiotaAbstractions::Parsable
Defined in:
lib/models/attachment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#additional_data, #additional_data=, #id, #id=, #odata_type, #odata_type=

Constructor Details

#initializeObject

Instantiates a new attachment and sets the default values.



29
30
31
# File 'lib/models/attachment.rb', line 29

def initialize()
    super
end

Class Method Details

.create_from_discriminator_value(parse_node) ⇒ Object

Creates a new instance of the appropriate class based on discriminator value

Parameters:

  • parse_node

    The parse node to use to read the discriminator value and create the object

Returns:

  • a attachment

Raises:

  • (StandardError)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/models/attachment.rb', line 52

def self.create_from_discriminator_value(parse_node)
    raise StandardError, 'parse_node cannot be null' if parse_node.nil?
    mapping_value_node = parse_node.get_child_node("@odata.type")
    unless mapping_value_node.nil? then
        mapping_value = mapping_value_node.get_string_value
        case mapping_value
            when "#microsoft.graph.fileAttachment"
                return FileAttachment.new
            when "#microsoft.graph.itemAttachment"
                return ItemAttachment.new
            when "#microsoft.graph.referenceAttachment"
                return ReferenceAttachment.new
        end
    end
    return Attachment.new
end

Instance Method Details

#content_typeObject

Gets the contentType property value. The MIME type.

Returns:

  • a string



36
37
38
# File 'lib/models/attachment.rb', line 36

def content_type
    return @content_type
end

#content_type=(value) ⇒ Object

Sets the contentType property value. The MIME type.

Parameters:

  • value

    Value to set for the contentType property.

Returns:

  • a void



44
45
46
# File 'lib/models/attachment.rb', line 44

def content_type=(value)
    @content_type = value
end

#get_field_deserializersObject

The deserialization information for the current model

Returns:

  • a i_dictionary



72
73
74
75
76
77
78
79
80
# File 'lib/models/attachment.rb', line 72

def get_field_deserializers()
    return super.merge({
        "contentType" => lambda {|n| @content_type = n.get_string_value() },
        "isInline" => lambda {|n| @is_inline = n.get_boolean_value() },
        "lastModifiedDateTime" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },
        "name" => lambda {|n| @name = n.get_string_value() },
        "size" => lambda {|n| @size = n.get_number_value() },
    })
end

#is_inlineObject

Gets the isInline property value. true if the attachment is an inline attachment; otherwise, false.

Returns:

  • a boolean



85
86
87
# File 'lib/models/attachment.rb', line 85

def is_inline
    return @is_inline
end

#is_inline=(value) ⇒ Object

Sets the isInline property value. true if the attachment is an inline attachment; otherwise, false.

Parameters:

  • value

    Value to set for the isInline property.

Returns:

  • a void



93
94
95
# File 'lib/models/attachment.rb', line 93

def is_inline=(value)
    @is_inline = value
end

#last_modified_date_timeObject

Gets the lastModifiedDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z

Returns:

  • a date_time



100
101
102
# File 'lib/models/attachment.rb', line 100

def last_modified_date_time
    return @last_modified_date_time
end

#last_modified_date_time=(value) ⇒ Object

Sets the lastModifiedDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z

Parameters:

  • value

    Value to set for the lastModifiedDateTime property.

Returns:

  • a void



108
109
110
# File 'lib/models/attachment.rb', line 108

def last_modified_date_time=(value)
    @last_modified_date_time = value
end

#nameObject

Gets the name property value. The attachment’s file name.

Returns:

  • a string



115
116
117
# File 'lib/models/attachment.rb', line 115

def name
    return @name
end

#name=(value) ⇒ Object

Sets the name property value. The attachment’s file name.

Parameters:

  • value

    Value to set for the name property.

Returns:

  • a void



123
124
125
# File 'lib/models/attachment.rb', line 123

def name=(value)
    @name = value
end

#serialize(writer) ⇒ Object

Serializes information the current object

Parameters:

  • writer

    Serialization writer to use to serialize this model

Returns:

  • a void

Raises:

  • (StandardError)


131
132
133
134
135
136
137
138
139
# File 'lib/models/attachment.rb', line 131

def serialize(writer)
    raise StandardError, 'writer cannot be null' if writer.nil?
    super
    writer.write_string_value("contentType", @content_type)
    writer.write_boolean_value("isInline", @is_inline)
    writer.write_date_time_value("lastModifiedDateTime", @last_modified_date_time)
    writer.write_string_value("name", @name)
    writer.write_number_value("size", @size)
end

#sizeObject

Gets the size property value. The length of the attachment in bytes.

Returns:

  • a integer



144
145
146
# File 'lib/models/attachment.rb', line 144

def size
    return @size
end

#size=(value) ⇒ Object

Sets the size property value. The length of the attachment in bytes.

Parameters:

  • value

    Value to set for the size property.

Returns:

  • a void



152
153
154
# File 'lib/models/attachment.rb', line 152

def size=(value)
    @size = value
end