whatsapp_sdk 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +14 -0
  4. data/CHANGELOG.md +2 -0
  5. data/Gemfile +5 -0
  6. data/Gemfile.lock +44 -0
  7. data/README.md +102 -28
  8. data/Rakefile +1 -0
  9. data/bin/tapioca +30 -0
  10. data/example.rb +31 -36
  11. data/lib/version.rb +2 -1
  12. data/lib/whatsapp_sdk/api/client.rb +14 -3
  13. data/lib/whatsapp_sdk/api/medias.rb +12 -3
  14. data/lib/whatsapp_sdk/api/messages.rb +72 -14
  15. data/lib/whatsapp_sdk/api/phone_numbers.rb +3 -0
  16. data/lib/whatsapp_sdk/api/request.rb +2 -2
  17. data/lib/whatsapp_sdk/api/response.rb +17 -1
  18. data/lib/whatsapp_sdk/api/responses/data_response.rb +10 -3
  19. data/lib/whatsapp_sdk/api/responses/error_response.rb +8 -1
  20. data/lib/whatsapp_sdk/api/responses/media_data_response.rb +26 -7
  21. data/lib/whatsapp_sdk/api/responses/message_data_response.rb +20 -3
  22. data/lib/whatsapp_sdk/api/responses/message_error_response.rb +26 -7
  23. data/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb +18 -5
  24. data/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb +9 -1
  25. data/lib/whatsapp_sdk/api/responses/read_message_data_response.rb +10 -3
  26. data/lib/whatsapp_sdk/api/responses/success_response.rb +5 -1
  27. data/lib/whatsapp_sdk/configuration.rb +7 -3
  28. data/lib/whatsapp_sdk/error.rb +1 -0
  29. data/lib/whatsapp_sdk/resource/address.rb +30 -6
  30. data/lib/whatsapp_sdk/resource/address_type.rb +15 -0
  31. data/lib/whatsapp_sdk/resource/button_parameter.rb +19 -23
  32. data/lib/whatsapp_sdk/resource/component.rb +45 -13
  33. data/lib/whatsapp_sdk/resource/contact.rb +30 -1
  34. data/lib/whatsapp_sdk/resource/contact_response.rb +9 -1
  35. data/lib/whatsapp_sdk/resource/currency.rb +9 -1
  36. data/lib/whatsapp_sdk/resource/date_time.rb +7 -1
  37. data/lib/whatsapp_sdk/resource/email.rb +9 -5
  38. data/lib/whatsapp_sdk/resource/media.rb +44 -15
  39. data/lib/whatsapp_sdk/resource/message.rb +5 -0
  40. data/lib/whatsapp_sdk/resource/name.rb +28 -1
  41. data/lib/whatsapp_sdk/resource/org.rb +13 -1
  42. data/lib/whatsapp_sdk/resource/parameter_object.rb +82 -39
  43. data/lib/whatsapp_sdk/resource/phone_number.rb +12 -5
  44. data/lib/whatsapp_sdk/resource/url.rb +9 -5
  45. data/lib/whatsapp_sdk.rb +7 -0
  46. data/sorbet/config +6 -0
  47. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  48. data/sorbet/rbi/annotations/mocha.rbi +34 -0
  49. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  50. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +270 -0
  51. data/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi +182 -0
  52. data/sorbet/rbi/gems/faraday@2.3.0.rbi +2494 -0
  53. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  54. data/sorbet/rbi/gems/minitest@5.16.1.rbi +1459 -0
  55. data/sorbet/rbi/gems/mocha@1.14.0.rbi +60 -0
  56. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +239 -0
  57. data/sorbet/rbi/gems/netrc@0.11.0.rbi +150 -0
  58. data/sorbet/rbi/gems/oj@3.13.14.rbi +589 -0
  59. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  60. data/sorbet/rbi/todo.rbi +8 -0
  61. data/sorbet/shims/request.rbi +10 -0
  62. data/sorbet/tapioca/config.yml +13 -0
  63. data/sorbet/tapioca/require.rb +5 -0
  64. data/whatsapp_sdk.gemspec +4 -1
  65. metadata +50 -2
@@ -0,0 +1,60 @@
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)
@@ -0,0 +1,239 @@
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
@@ -0,0 +1,150 @@
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)