whatsapp_sdk 0.8.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/example.rb +25 -10
- data/lib/whatsapp_sdk/api/client.rb +7 -3
- data/lib/whatsapp_sdk/api/medias.rb +45 -8
- data/lib/whatsapp_sdk/api/messages.rb +2 -2
- data/lib/whatsapp_sdk/api/request.rb +2 -2
- data/lib/whatsapp_sdk/resource/interactive_action.rb +38 -30
- data/lib/whatsapp_sdk/resource/interactive_action_section.rb +2 -5
- data/lib/whatsapp_sdk/resource/interactive_action_section_row.rb +11 -12
- data/lib/whatsapp_sdk/resource/media_types.rb +30 -0
- data/lib/whatsapp_sdk/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d6eccb61d3c648fa1c8a2a7e56512c1887b1aad9eb99f2569927f810b1754f8
|
4
|
+
data.tar.gz: 5cada724227ef568c36ec56a2a206752e170946e8890acefe504b24f821e9ab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9b534bc13fb8fad31fc31245417cf508537c4edd851b1d9cc6e546f50fbede19dd8bccbbe636194f49c1a40bbe721307b2dd8c1f0c4ea21cdc8ec643423d2db
|
7
|
+
data.tar.gz: 5f99f8a13ce068bd9667a719c7cdebcc87de874fb8b0cc7b06f6b0e1c857d888241ea6188ac6c9c9155a4184059effaade3c6255969a59b4a72cfa17d3c7abfc
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# v 0.9.1
|
4
|
+
- Invalidate unsupported and invalid media types @ignacio-chiazzo [#89](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/89)
|
5
|
+
|
6
|
+
# v 0.9.0
|
7
|
+
- Use binary mode to download files @ignacio-chiazzo [#88](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/87)
|
8
|
+
- Added support for downloading media by specifying the type @ignacio-chiazzo [#87](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/87)
|
9
|
+
|
3
10
|
# v 0.8.0
|
4
11
|
- Added Send interactive message @alienware [#82](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/82)
|
5
12
|
- Support JRuby @ignacio-chiazzo [#83](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/83)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -183,7 +183,7 @@ media = medias_api.media(media_id: MEDIA_ID)
|
|
183
183
|
|
184
184
|
Download media
|
185
185
|
```ruby
|
186
|
-
medias_api.download(url: MEDIA_URL, file_path: 'tmp/downloaded_whatsapp.png')
|
186
|
+
medias_api.download(url: MEDIA_URL, file_path: 'tmp/downloaded_whatsapp.png', media_type: "image/png")
|
187
187
|
```
|
188
188
|
|
189
189
|
Delete a media
|
data/example.rb
CHANGED
@@ -22,11 +22,11 @@ require "pry-nav"
|
|
22
22
|
|
23
23
|
################# UPDATE CONSTANTS #################
|
24
24
|
|
25
|
-
ACCESS_TOKEN = "
|
26
|
-
SENDER_ID =
|
27
|
-
RECIPIENT_NUMBER =
|
28
|
-
BUSINESS_ID =
|
29
|
-
IMAGE_LINK = "
|
25
|
+
ACCESS_TOKEN = "<TODO replace>"
|
26
|
+
SENDER_ID = "<TODO replace>"
|
27
|
+
RECIPIENT_NUMBER = "<TODO replace>"
|
28
|
+
BUSINESS_ID = "<TODO replace>"
|
29
|
+
IMAGE_LINK = "<TODO replace>"
|
30
30
|
|
31
31
|
if ACCESS_TOKEN == "<TODO replace>"
|
32
32
|
puts "\n\n**** Please update the ACCESS_TOKEN constant in this file. ****\n\n"
|
@@ -52,7 +52,6 @@ medias_api = WhatsappSdk::Api::Medias.new
|
|
52
52
|
messages_api = WhatsappSdk::Api::Messages.new
|
53
53
|
phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new
|
54
54
|
business_profile_api = WhatsappSdk::Api::BusinessProfile.new
|
55
|
-
|
56
55
|
############################## Business API ##############################
|
57
56
|
business_profile = business_profile_api.details(SENDER_ID)
|
58
57
|
business_profile_api.update(phone_number_id: SENDER_ID, params: { about: "A very cool business" } )
|
@@ -63,23 +62,39 @@ registered_numbers = phone_numbers_api.registered_numbers(BUSINESS_ID)
|
|
63
62
|
|
64
63
|
############################## Media API ##############################
|
65
64
|
|
66
|
-
|
65
|
+
##### Image #####
|
66
|
+
# upload a Image
|
67
67
|
uploaded_media = medias_api.upload(sender_id: SENDER_ID, file_path: "tmp/whatsapp.png", type: "image/png")
|
68
68
|
media_id = uploaded_media.data&.id
|
69
69
|
puts "Uploaded media id: #{media_id}"
|
70
70
|
|
71
|
-
# get a media
|
71
|
+
# get a media Image
|
72
72
|
media = medias_api.media(media_id: media_id).data
|
73
73
|
puts "Media info: #{media.raw_data_response}"
|
74
74
|
|
75
|
-
# download media
|
76
|
-
download_image = medias_api.download(url: media
|
75
|
+
# download media Image
|
76
|
+
download_image = medias_api.download(url: media.url, file_path: 'tmp/downloaded_image.png', media_type: "image/png")
|
77
77
|
puts "Downloaded: #{download_image.data.success?}"
|
78
78
|
|
79
79
|
# delete a media
|
80
80
|
deleted_media = medias_api.delete(media_id: media&.id)
|
81
81
|
puts "Deleted: #{deleted_media.data.success?}"
|
82
82
|
|
83
|
+
#### Audio ####
|
84
|
+
# upload an audio
|
85
|
+
uploaded_media = medias_api.upload(sender_id: SENDER_ID, file_path: "tmp/downloaded_audio.ogg", type: "audio/ogg")
|
86
|
+
media_id = uploaded_media.data&.id
|
87
|
+
puts "Uploaded media id: #{media_id}"
|
88
|
+
|
89
|
+
# get a media audio
|
90
|
+
media = medias_api.media(media_id: media_id).data
|
91
|
+
puts "Media info: #{media.raw_data_response}"
|
92
|
+
|
93
|
+
# get a media audio
|
94
|
+
audio_link = media.url
|
95
|
+
download_image = medias_api.download(url: audio_link, file_path: 'tmp/downloaded_audio2.ogg', media_type: "audio/ogg")
|
96
|
+
puts "Downloaded: #{download_image.data.success?}"
|
97
|
+
|
83
98
|
############################## Messages API ##############################
|
84
99
|
|
85
100
|
######### SEND A TEXT MESSAGE
|
@@ -35,18 +35,22 @@ module WhatsappSdk
|
|
35
35
|
JSON.parse(response.body)
|
36
36
|
end
|
37
37
|
|
38
|
-
sig
|
39
|
-
|
38
|
+
sig do
|
39
|
+
params(url: String, content_type_header: String, file_path: T.nilable(String))
|
40
|
+
.returns(Net::HTTPResponse)
|
41
|
+
end
|
42
|
+
def download_file(url:, content_type_header:, file_path: nil)
|
40
43
|
uri = URI.parse(url)
|
41
44
|
request = Net::HTTP::Get.new(uri)
|
42
45
|
request["Authorization"] = "Bearer #{@access_token}"
|
46
|
+
request.content_type = content_type_header
|
43
47
|
req_options = { use_ssl: uri.scheme == "https" }
|
44
48
|
|
45
49
|
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
46
50
|
http.request(request)
|
47
51
|
end
|
48
52
|
|
49
|
-
File.write(
|
53
|
+
File.write(file_path, response.body, mode: 'wb') if response.code == "200" && file_path
|
50
54
|
|
51
55
|
response
|
52
56
|
end
|
@@ -6,8 +6,9 @@ require "faraday/multipart"
|
|
6
6
|
|
7
7
|
require_relative "request"
|
8
8
|
require_relative "response"
|
9
|
-
require_relative '
|
10
|
-
require_relative '
|
9
|
+
require_relative 'responses/media_data_response'
|
10
|
+
require_relative 'responses/success_response'
|
11
|
+
require_relative '../resource/media_types'
|
11
12
|
|
12
13
|
module WhatsappSdk
|
13
14
|
module Api
|
@@ -19,9 +20,26 @@ module WhatsappSdk
|
|
19
20
|
attr_reader :file_path
|
20
21
|
|
21
22
|
sig { params(file_path: String).void }
|
22
|
-
def initialize(file_path)
|
23
|
+
def initialize(file_path:)
|
23
24
|
@file_path = file_path
|
24
|
-
|
25
|
+
|
26
|
+
message = "Couldn't find file_path: #{file_path}"
|
27
|
+
super(message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class InvalidMediaTypeError < StandardError
|
32
|
+
extend T::Sig
|
33
|
+
|
34
|
+
sig { returns(String) }
|
35
|
+
attr_reader :media_type
|
36
|
+
|
37
|
+
sig { params(media_type: String).void }
|
38
|
+
def initialize(media_type:)
|
39
|
+
@media_type = media_type
|
40
|
+
message = "Invalid Media Type #{media_type}. See the supported types in the official documentation " \
|
41
|
+
"https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types."
|
42
|
+
super(message)
|
25
43
|
end
|
26
44
|
end
|
27
45
|
|
@@ -46,11 +64,16 @@ module WhatsappSdk
|
|
46
64
|
#
|
47
65
|
# @param url URL.
|
48
66
|
# @param file_path [String] The file_path to download the media e.g. "tmp/downloaded_image.png".
|
67
|
+
# @param media_type [String] The media type e.g. "audio/mp4". See the supported types in the official
|
68
|
+
# documentation https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types.
|
49
69
|
# @return [WhatsappSdk::Api::Response] Response object.
|
50
|
-
sig { params(url: String, file_path: String).returns(WhatsappSdk::Api::Response) }
|
51
|
-
def download(url:, file_path:)
|
52
|
-
|
70
|
+
sig { params(url: String, file_path: String, media_type: String).returns(WhatsappSdk::Api::Response) }
|
71
|
+
def download(url:, file_path:, media_type:)
|
72
|
+
raise InvalidMediaTypeError.new(media_type: media_type) unless valid_media_type?(media_type)
|
53
73
|
|
74
|
+
content_type_header = map_media_type_to_content_type_header(media_type)
|
75
|
+
|
76
|
+
response = download_file(url: url, file_path: file_path, content_type_header: content_type_header)
|
54
77
|
response = if response.code.to_i == 200
|
55
78
|
{ "success" => true }
|
56
79
|
else
|
@@ -73,7 +96,7 @@ module WhatsappSdk
|
|
73
96
|
# @return [WhatsappSdk::Api::Response] Response object.
|
74
97
|
sig { params(sender_id: Integer, file_path: String, type: String).returns(WhatsappSdk::Api::Response) }
|
75
98
|
def upload(sender_id:, file_path:, type:)
|
76
|
-
raise FileNotFoundError
|
99
|
+
raise FileNotFoundError.new(file_path: file_path) unless File.file?(file_path)
|
77
100
|
|
78
101
|
params = {
|
79
102
|
messaging_product: "whatsapp",
|
@@ -105,6 +128,20 @@ module WhatsappSdk
|
|
105
128
|
data_class_type: WhatsappSdk::Api::Responses::SuccessResponse
|
106
129
|
)
|
107
130
|
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def map_media_type_to_content_type_header(media_type)
|
135
|
+
# Media type maps 1:1 to the content-type header.
|
136
|
+
# The list of supported types are in MediaTypes::SUPPORTED_TYPES.
|
137
|
+
# It uses the media type defined by IANA https://www.iana.org/assignments/media-types
|
138
|
+
|
139
|
+
media_type
|
140
|
+
end
|
141
|
+
|
142
|
+
def valid_media_type?(media_type)
|
143
|
+
WhatsappSdk::Resource::MediaTypes::SUPPORTED_MEDIA_TYPES.include?(media_type)
|
144
|
+
end
|
108
145
|
end
|
109
146
|
end
|
110
147
|
end
|
@@ -412,8 +412,8 @@ module WhatsappSdk
|
|
412
412
|
)
|
413
413
|
end
|
414
414
|
|
415
|
-
alias
|
416
|
-
alias
|
415
|
+
alias send_interactive_reply_buttons send_interactive_message
|
416
|
+
alias send_interactive_list_messages send_interactive_message
|
417
417
|
|
418
418
|
# Mark a message as read.
|
419
419
|
#
|
@@ -10,8 +10,8 @@ module WhatsappSdk
|
|
10
10
|
@client = client
|
11
11
|
end
|
12
12
|
|
13
|
-
def download_file(url
|
14
|
-
@client.download_file(url,
|
13
|
+
def download_file(url:, content_type_header:, file_path: nil)
|
14
|
+
@client.download_file(url: url, content_type_header: content_type_header, file_path: file_path)
|
15
15
|
end
|
16
16
|
|
17
17
|
def send_request(endpoint: nil, full_url: nil, http_method: "post", params: {}, headers: {})
|
@@ -61,7 +61,7 @@ module WhatsappSdk
|
|
61
61
|
sig do
|
62
62
|
params(
|
63
63
|
type: Type, buttons: T::Array[InteractiveActionReplyButton],
|
64
|
-
button: String, sections: T::Array[InteractiveActionSection]
|
64
|
+
button: String, sections: T::Array[InteractiveActionSection]
|
65
65
|
).void
|
66
66
|
end
|
67
67
|
def initialize(type:, buttons: [], button: "", sections: [])
|
@@ -93,40 +93,48 @@ module WhatsappSdk
|
|
93
93
|
def validate_fields
|
94
94
|
case type.serialize
|
95
95
|
when "list_message"
|
96
|
-
|
97
|
-
sections_count = sections.length
|
98
|
-
unless button_length > 0
|
99
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionButton,
|
100
|
-
"Invalid button in action. Button label is required."
|
101
|
-
end
|
102
|
-
|
103
|
-
unless button_length <= LIST_BUTTON_TITLE_MAXIMUM
|
104
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionButton,
|
105
|
-
"Invalid length #{button_length} for button. Maximum length: " \
|
106
|
-
"#{LIST_BUTTON_TITLE_MAXIMUM} characters."
|
107
|
-
end
|
108
|
-
|
109
|
-
unless (LIST_SECTIONS_MINIMUM..LIST_SECTIONS_MAXIMUM).cover?(sections_count)
|
110
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSection,
|
111
|
-
"Invalid length #{sections_count} for sections in action. It should be between " \
|
112
|
-
"#{LIST_SECTIONS_MINIMUM} and #{LIST_SECTIONS_MAXIMUM}."
|
113
|
-
end
|
114
|
-
|
115
|
-
sections.each { |section| section.validate }
|
96
|
+
validate_list_message
|
116
97
|
when "reply_button"
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
98
|
+
validate_reply_button
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def validate_list_message
|
103
|
+
button_length = button.length
|
104
|
+
sections_count = sections.length
|
105
|
+
unless button_length.positive?
|
106
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionButton,
|
107
|
+
"Invalid button in action. Button label is required."
|
108
|
+
end
|
123
109
|
|
124
|
-
|
125
|
-
|
110
|
+
unless button_length <= LIST_BUTTON_TITLE_MAXIMUM
|
111
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionButton,
|
112
|
+
"Invalid length #{button_length} for button. Maximum length: " \
|
113
|
+
"#{LIST_BUTTON_TITLE_MAXIMUM} characters."
|
114
|
+
end
|
126
115
|
|
116
|
+
unless (LIST_SECTIONS_MINIMUM..LIST_SECTIONS_MAXIMUM).cover?(sections_count)
|
117
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSection,
|
118
|
+
"Invalid length #{sections_count} for sections in action. It should be between " \
|
119
|
+
"#{LIST_SECTIONS_MINIMUM} and #{LIST_SECTIONS_MAXIMUM}."
|
120
|
+
end
|
121
|
+
|
122
|
+
sections.each(&:validate)
|
123
|
+
end
|
124
|
+
|
125
|
+
def validate_reply_button
|
126
|
+
buttons_count = buttons.length
|
127
|
+
unless (REPLY_BUTTONS_MINIMUM..REPLY_BUTTONS_MAXIMUM).cover?(buttons_count)
|
127
128
|
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionReplyButton,
|
128
|
-
"
|
129
|
+
"Invalid length #{buttons_count} for buttons in action. It should be between " \
|
130
|
+
"#{REPLY_BUTTONS_MINIMUM} and #{REPLY_BUTTONS_MAXIMUM}."
|
129
131
|
end
|
132
|
+
|
133
|
+
button_ids = buttons.map(&:id)
|
134
|
+
return if button_ids.length.eql?(button_ids.uniq.length)
|
135
|
+
|
136
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionReplyButton,
|
137
|
+
"Duplicate ids #{button_ids} for buttons in action. They should be unique."
|
130
138
|
end
|
131
139
|
end
|
132
140
|
end
|
@@ -34,12 +34,10 @@ module WhatsappSdk
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def to_json
|
37
|
-
|
37
|
+
{
|
38
38
|
title: title,
|
39
|
-
rows: rows.map(&:to_json)
|
39
|
+
rows: rows.map(&:to_json)
|
40
40
|
}
|
41
|
-
|
42
|
-
json
|
43
41
|
end
|
44
42
|
|
45
43
|
sig { params(skip_rows: T.nilable(T::Boolean)).void }
|
@@ -72,4 +70,3 @@ module WhatsappSdk
|
|
72
70
|
end
|
73
71
|
end
|
74
72
|
end
|
75
|
-
|
@@ -29,7 +29,7 @@ module WhatsappSdk
|
|
29
29
|
ACTION_SECTION_DESCRIPTION_MAXIMUM = 72
|
30
30
|
ACTION_SECTION_ID_MAXIMUM = 256
|
31
31
|
|
32
|
-
sig { params(title: String, id: String, description: T
|
32
|
+
sig { params(title: String, id: String, description: T.nilable(String)).void }
|
33
33
|
def initialize(title:, id:, description: "")
|
34
34
|
@title = title
|
35
35
|
@id = id
|
@@ -42,7 +42,7 @@ module WhatsappSdk
|
|
42
42
|
id: id,
|
43
43
|
title: title
|
44
44
|
}
|
45
|
-
json[:description] = description if description.length
|
45
|
+
json[:description] = description if description.length.positive?
|
46
46
|
|
47
47
|
json
|
48
48
|
end
|
@@ -61,9 +61,9 @@ module WhatsappSdk
|
|
61
61
|
title_length = title.length
|
62
62
|
return if title_length <= ACTION_SECTION_TITLE_MAXIMUM
|
63
63
|
|
64
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow
|
65
|
-
|
66
|
-
|
64
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow,
|
65
|
+
"Invalid length #{title_length} for title in section row. "\
|
66
|
+
"Maximum length: #{ACTION_SECTION_TITLE_MAXIMUM} characters."
|
67
67
|
end
|
68
68
|
|
69
69
|
sig { void }
|
@@ -74,9 +74,9 @@ module WhatsappSdk
|
|
74
74
|
id_length = id.length
|
75
75
|
return if id_length <= ACTION_SECTION_ID_MAXIMUM
|
76
76
|
|
77
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow
|
78
|
-
|
79
|
-
|
77
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow,
|
78
|
+
"Invalid length #{id_length} for id in section row. Maximum length: "\
|
79
|
+
"#{ACTION_SECTION_ID_MAXIMUM} characters."
|
80
80
|
end
|
81
81
|
|
82
82
|
sig { void }
|
@@ -84,11 +84,10 @@ module WhatsappSdk
|
|
84
84
|
description_length = description.length
|
85
85
|
return if description_length <= ACTION_SECTION_DESCRIPTION_MAXIMUM
|
86
86
|
|
87
|
-
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow
|
88
|
-
|
89
|
-
|
87
|
+
raise WhatsappSdk::Resource::Error::InvalidInteractiveActionSectionRow,
|
88
|
+
"Invalid length #{description_length} for description in section " \
|
89
|
+
"row. Maximum length: #{ACTION_SECTION_DESCRIPTION_MAXIMUM} characters."
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module WhatsappSdk
|
5
|
+
module Resource
|
6
|
+
class MediaTypes
|
7
|
+
extend T::Sig
|
8
|
+
|
9
|
+
# The media types supported by Whatsapp. The list contains all the types defined in the Whatsapp API
|
10
|
+
# documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types
|
11
|
+
#
|
12
|
+
# The media type is used as a content-type header when downloading the file with MediasApi#download_file.
|
13
|
+
# The content-type header matches with the media type using Internet Assigned Numbers Authority (IANA).
|
14
|
+
# Media type list defined by IANA https://www.iana.org/assignments/media-types/media-types.xhtml
|
15
|
+
#
|
16
|
+
|
17
|
+
AUDIO_TYPES = %w[audio/aac audio/mp4 audio/mpeg audio/amr audio/ogg].freeze
|
18
|
+
DOCUMENT_TYPES = %w[
|
19
|
+
text/plain application/pdf application/vnd.ms-powerpoint application/msword application/vnd.ms-excel
|
20
|
+
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
21
|
+
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
22
|
+
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
23
|
+
].freeze
|
24
|
+
IMAGE_TYPES = %w[image/jpeg image/png].freeze
|
25
|
+
VIDEO_TYPES = %w[video/mp4 video/3gp].freeze
|
26
|
+
|
27
|
+
SUPPORTED_MEDIA_TYPES = [AUDIO_TYPES + DOCUMENT_TYPES + IMAGE_TYPES + VIDEO_TYPES].flatten.freeze
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/whatsapp_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsapp_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ignacio-chiazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/whatsapp_sdk/resource/interactive_footer.rb
|
192
192
|
- lib/whatsapp_sdk/resource/interactive_header.rb
|
193
193
|
- lib/whatsapp_sdk/resource/media.rb
|
194
|
+
- lib/whatsapp_sdk/resource/media_types.rb
|
194
195
|
- lib/whatsapp_sdk/resource/message.rb
|
195
196
|
- lib/whatsapp_sdk/resource/name.rb
|
196
197
|
- lib/whatsapp_sdk/resource/org.rb
|