Class: WhatsAppCloudApi::UploadMediaRequest
- Defined in:
- lib/whats_app_cloud_api/models/upload_media_request.rb
Overview
UploadMediaRequest Model.
Instance Attribute Summary collapse
-
#file ⇒ String
Path to the file stored in your local directory.
-
#messaging_product ⇒ String
Messaging service used for the request.
-
#type ⇒ String
Type of media file being uploaded.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(messaging_product = nil, file = nil, type = nil) ⇒ UploadMediaRequest
constructor
A new instance of UploadMediaRequest.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
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
#file ⇒ String
Path to the file stored in your local directory. For example: “@/local/path/file.jpg”.
19 20 21 |
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 19 def file @file end |
#messaging_product ⇒ String
Messaging service used for the request. In this case, use whatsapp.
14 15 16 |
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 14 def messaging_product @messaging_product end |
#type ⇒ String
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`
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 |
.names ⇒ Object
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
#nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 52 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
47 48 49 |
# File 'lib/whats_app_cloud_api/models/upload_media_request.rb', line 47 def optionals [] end |