Class: WhatsAppCloudApi::UploadMediaRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/whats_app_cloud_api/models/upload_media_request.rb

Overview

UploadMediaRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(messaging_product = nil, file = nil, type = nil) ⇒ UploadMediaRequest

Returns a new instance of UploadMediaRequest.



56
57
58
59
60
61
62
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 56

def initialize(messaging_product = nil,
               file = nil,
               type = nil)
  @messaging_product = messaging_product unless messaging_product == SKIP
  @file = file unless file == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#fileString

Path to the file stored in your local directory. For example: “@/local/path/file.jpg”.

Returns:

  • (String)


19
20
21
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 19

def file
  @file
end

#messaging_productString

Messaging service used for the request. In this case, use whatsapp.

Returns:

  • (String)


14
15
16
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 14

def messaging_product
  @messaging_product
end

#typeString

Type of media file being uploaded. See Supported Media Types for more information.

Supported options for images are: `image/jpeg`, `image/png` 
Supported options for documents are: `text/plain`, `application/pdf`,

‘application/vnd.ms-powerpoint`, `application/msword`, `application/vnd.ms-excel`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document`, `application/vnd.openxmlformats-officedocument.presentationml.presentation `, `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` Supported options for audio are: `audio/aac`, `audio/mp4`, `audio/mpeg`, `audio/amr`, `audio/ogg`, `audio/opus` Supported options for video are: `video/mp4`, `video/3gp` Supported options for stickers are: `image/webp`

Returns:

  • (String)


35
36
37
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 35

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  messaging_product =
    hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
  file = hash.key?('file') ? hash['file'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  UploadMediaRequest.new(messaging_product,
                         file,
                         type)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['messaging_product'] = 'messaging_product'
  @_hash['file'] = 'file'
  @_hash['type'] = 'type'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



52
53
54
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 52

def nullables
  []
end

#optionalsObject

An array for optional fields



47
48
49
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 47

def optionals
  []
end