Class: ApolloDeploySignalSdkRails::AttachmentRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo_deploy_signal_sdk_rails/types.rb

Overview

Schema type: AttachmentRequest

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename:, content:, content_type:, disposition: nil, content_id: nil) ⇒ AttachmentRequest

Returns a new instance of AttachmentRequest.

Parameters:

  • filename (String)

    , content [String], content_type [String], disposition [String], content_id [String, nil]



18
19
20
21
22
23
24
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 18

def initialize(filename: , content: , content_type: , disposition: nil, content_id: nil)
  @filename = filename
  @content = content
  @content_type = content_type
  @disposition = disposition
  @content_id = content_id
end

Instance Attribute Details

#contentString

Returns:

  • (String)


9
10
11
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 9

def content
  @content
end

#content_idString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 15

def content_id
  @content_id
end

#content_typeString

Returns:

  • (String)


11
12
13
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 11

def content_type
  @content_type
end

#dispositionString

Returns:

  • (String)


13
14
15
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 13

def disposition
  @disposition
end

#filenameString

Returns:

  • (String)


7
8
9
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 7

def filename
  @filename
end

Class Method Details

.from_json(attributes) ⇒ AttachmentRequest

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 40

def self.from_json(attributes)
  return nil unless attributes.is_a?(Hash)

  new(
    filename: attributes.key?("filename") ? attributes["filename"] : attributes[:filename],
    content: attributes.key?("content") ? attributes["content"] : attributes[:content],
    content_type: attributes.key?("contentType") ? attributes["contentType"] : attributes[:content_type],
    disposition: attributes.key?("disposition") ? attributes["disposition"] : attributes[:disposition],
    content_id: attributes.key?("contentId") ? attributes["contentId"] : attributes[:content_id],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



27
28
29
30
31
32
33
34
35
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 27

def to_h
  {
    filename: @filename,
    content: @content,
    content_type: @content_type,
    disposition: @disposition,
    content_id: @content_id,
  }.compact
end