whatsapp_sdk 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +8 -6
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +0 -3
  5. data/CHANGELOG.md +9 -7
  6. data/Gemfile +0 -4
  7. data/Gemfile.lock +1 -20
  8. data/README.md +35 -55
  9. data/SECURITY.md +21 -0
  10. data/example.rb +23 -15
  11. data/lib/whatsapp_sdk/api/api_configuration.rb +2 -5
  12. data/lib/whatsapp_sdk/api/business_profile.rb +0 -12
  13. data/lib/whatsapp_sdk/api/client.rb +7 -43
  14. data/lib/whatsapp_sdk/api/medias.rb +8 -15
  15. data/lib/whatsapp_sdk/api/messages.rb +4 -81
  16. data/lib/whatsapp_sdk/api/phone_numbers.rb +0 -14
  17. data/lib/whatsapp_sdk/api/request.rb +0 -2
  18. data/lib/whatsapp_sdk/api/response.rb +1 -20
  19. data/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb +11 -34
  20. data/lib/whatsapp_sdk/api/responses/data_response.rb +0 -9
  21. data/lib/whatsapp_sdk/api/responses/error_response.rb +1 -8
  22. data/lib/whatsapp_sdk/api/responses/generic_error_response.rb +8 -26
  23. data/lib/whatsapp_sdk/api/responses/media_data_response.rb +8 -26
  24. data/lib/whatsapp_sdk/api/responses/message_data_response.rb +4 -20
  25. data/lib/whatsapp_sdk/api/responses/message_error_response.rb +0 -1
  26. data/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb +3 -13
  27. data/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb +19 -37
  28. data/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb +2 -9
  29. data/lib/whatsapp_sdk/api/responses/read_message_data_response.rb +1 -6
  30. data/lib/whatsapp_sdk/api/responses/success_response.rb +1 -5
  31. data/lib/whatsapp_sdk/api/responses/template_data_response.rb +2 -7
  32. data/lib/whatsapp_sdk/api/responses/templates_data_response.rb +2 -9
  33. data/lib/whatsapp_sdk/api/templates.rb +3 -27
  34. data/lib/whatsapp_sdk/configuration.rb +2 -24
  35. data/lib/whatsapp_sdk/error.rb +0 -1
  36. data/lib/whatsapp_sdk/resource/address.rb +1 -30
  37. data/lib/whatsapp_sdk/resource/address_type.rb +3 -8
  38. data/lib/whatsapp_sdk/resource/business_profile.rb +0 -3
  39. data/lib/whatsapp_sdk/resource/button_parameter.rb +4 -20
  40. data/lib/whatsapp_sdk/resource/component.rb +12 -43
  41. data/lib/whatsapp_sdk/resource/contact.rb +1 -30
  42. data/lib/whatsapp_sdk/resource/contact_response.rb +1 -9
  43. data/lib/whatsapp_sdk/resource/currency.rb +0 -8
  44. data/lib/whatsapp_sdk/resource/date_time.rb +0 -6
  45. data/lib/whatsapp_sdk/resource/email.rb +1 -10
  46. data/lib/whatsapp_sdk/resource/errors.rb +1 -17
  47. data/lib/whatsapp_sdk/resource/interactive.rb +6 -27
  48. data/lib/whatsapp_sdk/resource/interactive_action.rb +10 -24
  49. data/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb +5 -19
  50. data/lib/whatsapp_sdk/resource/interactive_action_section.rb +1 -11
  51. data/lib/whatsapp_sdk/resource/interactive_action_section_row.rb +0 -11
  52. data/lib/whatsapp_sdk/resource/interactive_body.rb +0 -10
  53. data/lib/whatsapp_sdk/resource/interactive_footer.rb +0 -10
  54. data/lib/whatsapp_sdk/resource/interactive_header.rb +25 -53
  55. data/lib/whatsapp_sdk/resource/location.rb +44 -0
  56. data/lib/whatsapp_sdk/resource/media.rb +10 -46
  57. data/lib/whatsapp_sdk/resource/media_types.rb +0 -3
  58. data/lib/whatsapp_sdk/resource/message.rb +0 -5
  59. data/lib/whatsapp_sdk/resource/name.rb +1 -28
  60. data/lib/whatsapp_sdk/resource/org.rb +1 -13
  61. data/lib/whatsapp_sdk/resource/parameter_object.rb +71 -74
  62. data/lib/whatsapp_sdk/resource/phone_number.rb +1 -13
  63. data/lib/whatsapp_sdk/resource/template.rb +23 -36
  64. data/lib/whatsapp_sdk/resource/url.rb +1 -10
  65. data/lib/whatsapp_sdk/version.rb +1 -2
  66. data/lib/whatsapp_sdk.rb +0 -4
  67. data/whatsapp_sdk.gemspec +0 -3
  68. metadata +5 -49
  69. data/sorbet/config +0 -6
  70. data/sorbet/rbi/annotations/faraday.rbi +0 -17
  71. data/sorbet/rbi/annotations/mocha.rbi +0 -34
  72. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  73. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +0 -270
  74. data/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi +0 -182
  75. data/sorbet/rbi/gems/faraday@2.3.0.rbi +0 -2494
  76. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
  77. data/sorbet/rbi/gems/minitest@5.16.1.rbi +0 -1459
  78. data/sorbet/rbi/gems/mocha@1.14.0.rbi +0 -60
  79. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +0 -239
  80. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -150
  81. data/sorbet/rbi/gems/oj@3.13.14.rbi +0 -589
  82. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +0 -867
  83. data/sorbet/rbi/todo.rbi +0 -8
  84. data/sorbet/shims/request.rbi +0 -10
  85. data/sorbet/tapioca/config.yml +0 -13
  86. data/sorbet/tapioca/require.rb +0 -4
@@ -1,60 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `mocha` gem.
5
- # Please instead update this file by running `bin/tapioca gem mocha`.
6
-
7
- # source://mocha-1.14.0/lib/mocha/version.rb:1
8
- module Mocha; end
9
-
10
- # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:2
11
- class Mocha::BacktraceFilter
12
- # @return [BacktraceFilter] a new instance of BacktraceFilter
13
- #
14
- # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:5
15
- def initialize(lib_directory = T.unsafe(nil)); end
16
-
17
- # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:9
18
- def filtered(backtrace); end
19
- end
20
-
21
- # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:3
22
- Mocha::BacktraceFilter::LIB_DIRECTORY = T.let(T.unsafe(nil), String)
23
-
24
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:4
25
- class Mocha::Deprecation
26
- class << self
27
- # Returns the value of attribute messages.
28
- #
29
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
30
- def messages; end
31
-
32
- # Sets the attribute messages
33
- #
34
- # @param value the value to set the attribute messages to.
35
- #
36
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
37
- def messages=(_arg0); end
38
-
39
- # Returns the value of attribute mode.
40
- #
41
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
42
- def mode; end
43
-
44
- # Sets the attribute mode
45
- #
46
- # @param value the value to set the attribute mode to.
47
- #
48
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
49
- def mode=(_arg0); end
50
-
51
- # source://mocha-1.14.0/lib/mocha/deprecation.rb:8
52
- def warning(*messages); end
53
- end
54
- end
55
-
56
- # source://mocha-1.14.0/lib/mocha/ruby_version.rb:3
57
- Mocha::RUBY_V2_PLUS = T.let(T.unsafe(nil), TrueClass)
58
-
59
- # source://mocha-1.14.0/lib/mocha/version.rb:2
60
- Mocha::VERSION = T.let(T.unsafe(nil), String)
@@ -1,239 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `multipart-post` gem.
5
- # Please instead update this file by running `bin/tapioca gem multipart-post`.
6
-
7
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:77
8
- CompositeIO = Multipart::Post::CompositeReadIO
9
-
10
- # source://multipart-post-2.2.3/lib/multipart/post/version.rb:23
11
- module Multipart; end
12
-
13
- # source://multipart-post-2.2.3/lib/multipart/post/version.rb:24
14
- module Multipart::Post; end
15
-
16
- # Concatenate together multiple IO objects into a single, composite IO object
17
- # for purposes of reading as a single stream.
18
- #
19
- # @example
20
- # crio = CompositeReadIO.new(StringIO.new('one'),
21
- # StringIO.new('two'),
22
- # StringIO.new('three'))
23
- # puts crio.read # => "onetwothree"
24
- #
25
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:33
26
- class Multipart::Post::CompositeReadIO
27
- # Create a new composite-read IO from the arguments, all of which should
28
- # respond to #read in a manner consistent with IO.
29
- #
30
- # @return [CompositeReadIO] a new instance of CompositeReadIO
31
- #
32
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:36
33
- def initialize(*ios); end
34
-
35
- # Read from IOs in order until `length` bytes have been received.
36
- #
37
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:42
38
- def read(length = T.unsafe(nil), outbuf = T.unsafe(nil)); end
39
-
40
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:59
41
- def rewind; end
42
-
43
- private
44
-
45
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:70
46
- def advance_io; end
47
-
48
- # source://multipart-post-2.2.3/lib/multipart/post/composite_read_io.rb:66
49
- def current_io; end
50
- end
51
-
52
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:30
53
- module Multipart::Post::Multipartable
54
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:45
55
- def initialize(path, params, headers = T.unsafe(nil), boundary = T.unsafe(nil)); end
56
-
57
- # Returns the value of attribute boundary.
58
- #
59
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:68
60
- def boundary; end
61
-
62
- private
63
-
64
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:73
65
- def symbolize_keys(hash); end
66
-
67
- class << self
68
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:31
69
- def secure_boundary; end
70
- end
71
- end
72
-
73
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:27
74
- module Multipart::Post::Parts; end
75
-
76
- # Represents the epilogue or closing boundary.
77
- #
78
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:139
79
- class Multipart::Post::Parts::EpiloguePart
80
- include ::Multipart::Post::Parts::Part
81
-
82
- # @return [EpiloguePart] a new instance of EpiloguePart
83
- #
84
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:142
85
- def initialize(boundary); end
86
- end
87
-
88
- # Represents a part to be filled from file IO.
89
- #
90
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:84
91
- class Multipart::Post::Parts::FilePart
92
- include ::Multipart::Post::Parts::Part
93
-
94
- # @param boundary [String]
95
- # @param name [#to_s]
96
- # @param io [IO]
97
- # @param headers [Hash]
98
- # @return [FilePart] a new instance of FilePart
99
- #
100
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:93
101
- def initialize(boundary, name, io, headers = T.unsafe(nil)); end
102
-
103
- # @param boundary [String]
104
- # @param name [#to_s]
105
- # @param filename [String]
106
- # @param type [String]
107
- # @param content_len [Integer]
108
- # @param opts [Hash]
109
- #
110
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:108
111
- def build_head(boundary, name, filename, type, content_len, opts = T.unsafe(nil)); end
112
-
113
- # Returns the value of attribute length.
114
- #
115
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:87
116
- def length; end
117
- end
118
-
119
- # Represents a parametric part to be filled with given value.
120
- #
121
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:52
122
- class Multipart::Post::Parts::ParamPart
123
- include ::Multipart::Post::Parts::Part
124
-
125
- # @param boundary [String]
126
- # @param name [#to_s]
127
- # @param value [String]
128
- # @param headers [Hash] Content-Type and Content-ID are used, if present.
129
- # @return [ParamPart] a new instance of ParamPart
130
- #
131
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:59
132
- def initialize(boundary, name, value, headers = T.unsafe(nil)); end
133
-
134
- # @param boundary [String]
135
- # @param name [#to_s]
136
- # @param value [String]
137
- # @param headers [Hash] Content-Type is used, if present.
138
- #
139
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:72
140
- def build_part(boundary, name, value, headers = T.unsafe(nil)); end
141
-
142
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:64
143
- def length; end
144
- end
145
-
146
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:28
147
- module Multipart::Post::Parts::Part
148
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:42
149
- def length; end
150
-
151
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:46
152
- def to_io; end
153
-
154
- class << self
155
- # @return [Boolean]
156
- #
157
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:38
158
- def file?(value); end
159
-
160
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:29
161
- def new(boundary, name, value, headers = T.unsafe(nil)); end
162
- end
163
- end
164
-
165
- # Convenience methods for dealing with files and IO that are to be uploaded.
166
- #
167
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:26
168
- class Multipart::Post::UploadIO
169
- # Create an upload IO suitable for including in the params hash of a
170
- # Net::HTTP::Post::Multipart.
171
- #
172
- # Can take two forms. The first accepts a filename and content type, and
173
- # opens the file for reading (to be closed by finalizer).
174
- #
175
- # The second accepts an already-open IO, but also requires a third argument,
176
- # the filename from which it was opened (particularly useful/recommended if
177
- # uploading directly from a form in a framework, which often save the file to
178
- # an arbitrarily named RackMultipart file in /tmp).
179
- #
180
- # @example
181
- # UploadIO.new("file.txt", "text/plain")
182
- # UploadIO.new(file_io, "text/plain", "file.txt")
183
- # @return [UploadIO] a new instance of UploadIO
184
- #
185
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:43
186
- def initialize(filename_or_io, content_type, filename = T.unsafe(nil), opts = T.unsafe(nil)); end
187
-
188
- # Returns the value of attribute content_type.
189
- #
190
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27
191
- def content_type; end
192
-
193
- # Returns the value of attribute io.
194
- #
195
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27
196
- def io; end
197
-
198
- # Returns the value of attribute local_path.
199
- #
200
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27
201
- def local_path; end
202
-
203
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:69
204
- def method_missing(*args); end
205
-
206
- # Returns the value of attribute opts.
207
- #
208
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27
209
- def opts; end
210
-
211
- # Returns the value of attribute original_filename.
212
- #
213
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:27
214
- def original_filename; end
215
-
216
- # @return [Boolean]
217
- #
218
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:73
219
- def respond_to?(meth, include_all = T.unsafe(nil)); end
220
-
221
- class << self
222
- # @raise [ArgumentError]
223
- #
224
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:63
225
- def convert!(io, content_type, original_filename, local_path); end
226
- end
227
- end
228
-
229
- # source://multipart-post-2.2.3/lib/multipart/post/version.rb:25
230
- Multipart::Post::VERSION = T.let(T.unsafe(nil), String)
231
-
232
- # source://multipart-post-2.2.3/lib/multipart/post/multipartable.rb:85
233
- Multipartable = Multipart::Post::Multipartable
234
-
235
- # source://multipart-post-2.2.3/lib/multipart/post/parts.rb:151
236
- Parts = Multipart::Post::Parts
237
-
238
- # source://multipart-post-2.2.3/lib/multipart/post/upload_io.rb:80
239
- UploadIO = Multipart::Post::UploadIO
@@ -1,150 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `netrc` gem.
5
- # Please instead update this file by running `bin/tapioca gem netrc`.
6
-
7
- # source://netrc-0.11.0/lib/netrc.rb:3
8
- class Netrc
9
- # @return [Netrc] a new instance of Netrc
10
- #
11
- # source://netrc-0.11.0/lib/netrc.rb:166
12
- def initialize(path, data); end
13
-
14
- # source://netrc-0.11.0/lib/netrc.rb:180
15
- def [](k); end
16
-
17
- # source://netrc-0.11.0/lib/netrc.rb:188
18
- def []=(k, info); end
19
-
20
- # source://netrc-0.11.0/lib/netrc.rb:200
21
- def delete(key); end
22
-
23
- # source://netrc-0.11.0/lib/netrc.rb:211
24
- def each(&block); end
25
-
26
- # source://netrc-0.11.0/lib/netrc.rb:196
27
- def length; end
28
-
29
- # source://netrc-0.11.0/lib/netrc.rb:215
30
- def new_item(m, l, p); end
31
-
32
- # Returns the value of attribute new_item_prefix.
33
- #
34
- # source://netrc-0.11.0/lib/netrc.rb:178
35
- def new_item_prefix; end
36
-
37
- # Sets the attribute new_item_prefix
38
- #
39
- # @param value the value to set the attribute new_item_prefix to.
40
- #
41
- # source://netrc-0.11.0/lib/netrc.rb:178
42
- def new_item_prefix=(_arg0); end
43
-
44
- # source://netrc-0.11.0/lib/netrc.rb:219
45
- def save; end
46
-
47
- # source://netrc-0.11.0/lib/netrc.rb:233
48
- def unparse; end
49
-
50
- class << self
51
- # source://netrc-0.11.0/lib/netrc.rb:42
52
- def check_permissions(path); end
53
-
54
- # source://netrc-0.11.0/lib/netrc.rb:33
55
- def config; end
56
-
57
- # @yield [self.config]
58
- #
59
- # source://netrc-0.11.0/lib/netrc.rb:37
60
- def configure; end
61
-
62
- # source://netrc-0.11.0/lib/netrc.rb:10
63
- def default_path; end
64
-
65
- # source://netrc-0.11.0/lib/netrc.rb:14
66
- def home_path; end
67
-
68
- # source://netrc-0.11.0/lib/netrc.rb:85
69
- def lex(lines); end
70
-
71
- # source://netrc-0.11.0/lib/netrc.rb:29
72
- def netrc_filename; end
73
-
74
- # Returns two values, a header and a list of items.
75
- # Each item is a tuple, containing some or all of:
76
- # - machine keyword (including trailing whitespace+comments)
77
- # - machine name
78
- # - login keyword (including surrounding whitespace+comments)
79
- # - login
80
- # - password keyword (including surrounding whitespace+comments)
81
- # - password
82
- # - trailing chars
83
- # This lets us change individual fields, then write out the file
84
- # with all its original formatting.
85
- #
86
- # source://netrc-0.11.0/lib/netrc.rb:129
87
- def parse(ts); end
88
-
89
- # Reads path and parses it as a .netrc file. If path doesn't
90
- # exist, returns an empty object. Decrypt paths ending in .gpg.
91
- #
92
- # source://netrc-0.11.0/lib/netrc.rb:51
93
- def read(path = T.unsafe(nil)); end
94
-
95
- # @return [Boolean]
96
- #
97
- # source://netrc-0.11.0/lib/netrc.rb:112
98
- def skip?(s); end
99
- end
100
- end
101
-
102
- # source://netrc-0.11.0/lib/netrc.rb:244
103
- class Netrc::Entry < ::Struct
104
- # Returns the value of attribute login
105
- #
106
- # @return [Object] the current value of login
107
- def login; end
108
-
109
- # Sets the attribute login
110
- #
111
- # @param value [Object] the value to set the attribute login to.
112
- # @return [Object] the newly set value
113
- def login=(_); end
114
-
115
- # Returns the value of attribute password
116
- #
117
- # @return [Object] the current value of password
118
- def password; end
119
-
120
- # Sets the attribute password
121
- #
122
- # @param value [Object] the value to set the attribute password to.
123
- # @return [Object] the newly set value
124
- def password=(_); end
125
-
126
- def to_ary; end
127
-
128
- class << self
129
- def [](*_arg0); end
130
- def inspect; end
131
- def keyword_init?; end
132
- def members; end
133
- def new(*_arg0); end
134
- end
135
- end
136
-
137
- # source://netrc-0.11.0/lib/netrc.rb:250
138
- class Netrc::Error < ::StandardError; end
139
-
140
- # source://netrc-0.11.0/lib/netrc.rb:68
141
- class Netrc::TokenArray < ::Array
142
- # source://netrc-0.11.0/lib/netrc.rb:76
143
- def readto; end
144
-
145
- # source://netrc-0.11.0/lib/netrc.rb:69
146
- def take; end
147
- end
148
-
149
- # source://netrc-0.11.0/lib/netrc.rb:4
150
- Netrc::VERSION = T.let(T.unsafe(nil), String)