direct7 0.0.1 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,527 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Direct7::WHATSAPP
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Direct7::WHATSAPP";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (W)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Direct7.html" title="Direct7 (module)">Direct7</a></span></span>
41
+ &raquo;
42
+ <span class="title">WHATSAPP</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Direct7::WHATSAPP
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Direct7::WHATSAPP</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/direct7/whatsapp.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Instance Method Summary
112
+ <small><a href="#" class="summary_toggle">collapse</a></small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#get_status-instance_method" title="#get_status (instance method)">#<strong>get_status</strong>(request_id) &#x21d2; Object </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(client) &#x21d2; WHATSAPP </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+ <span class="note title constructor">constructor</span>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <span class="summary_desc"><div class='inline'>
159
+ <p>A new instance of WHATSAPP.</p>
160
+ </div></span>
161
+
162
+ </li>
163
+
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#send_whatsapp_freeform_message-instance_method" title="#send_whatsapp_freeform_message (instance method)">#<strong>send_whatsapp_freeform_message</strong>(originator, recipient, message_type, message_text = nil, first_name = nil, last_name = nil, display_name = nil, phone = nil, email = nil, url = nil, latitude = nil, longitude = nil, location_name = nil, location_address = nil, attachment_type = nil, attachment_url = nil, attachment_caption = nil) &#x21d2; Object </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="summary_desc"><div class='inline'></div></span>
183
+
184
+ </li>
185
+
186
+
187
+ <li class="public ">
188
+ <span class="summary_signature">
189
+
190
+ <a href="#send_whatsapp_templated_message-instance_method" title="#send_whatsapp_templated_message (instance method)">#<strong>send_whatsapp_templated_message</strong>(originator, recipient, template_id, body_parameter_values, media_type = nil, media_url = nil, latitude = nil, longitude = nil, location_name = nil, location_address = nil) &#x21d2; Object </a>
191
+
192
+
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="summary_desc"><div class='inline'></div></span>
205
+
206
+ </li>
207
+
208
+
209
+ </ul>
210
+
211
+
212
+ <div id="constructor_details" class="method_details_list">
213
+ <h2>Constructor Details</h2>
214
+
215
+ <div class="method_details first">
216
+ <h3 class="signature first" id="initialize-instance_method">
217
+
218
+ #<strong>initialize</strong>(client) &#x21d2; <tt><span class='object_link'><a href="" title="Direct7::WHATSAPP (class)">WHATSAPP</a></span></tt>
219
+
220
+
221
+
222
+
223
+
224
+ </h3><div class="docstring">
225
+ <div class="discussion">
226
+
227
+ <p>Returns a new instance of WHATSAPP.</p>
228
+
229
+
230
+ </div>
231
+ </div>
232
+ <div class="tags">
233
+
234
+
235
+ </div><table class="source_code">
236
+ <tr>
237
+ <td>
238
+ <pre class="lines">
239
+
240
+
241
+ 8
242
+ 9
243
+ 10
244
+ 11</pre>
245
+ </td>
246
+ <td>
247
+ <pre class="code"><span class="info file"># File 'lib/direct7/whatsapp.rb', line 8</span>
248
+
249
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span>
250
+ <span class='ivar'>@client</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span>
251
+ <span class='ivar'>@log</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>STDOUT</span><span class='rparen'>)</span> <span class='comment'># You can customize the log destination as needed
252
+ </span><span class='kw'>end</span></pre>
253
+ </td>
254
+ </tr>
255
+ </table>
256
+ </div>
257
+
258
+ </div>
259
+
260
+
261
+ <div id="instance_method_details" class="method_details_list">
262
+ <h2>Instance Method Details</h2>
263
+
264
+
265
+ <div class="method_details first">
266
+ <h3 class="signature first" id="get_status-instance_method">
267
+
268
+ #<strong>get_status</strong>(request_id) &#x21d2; <tt>Object</tt>
269
+
270
+
271
+
272
+
273
+
274
+ </h3><table class="source_code">
275
+ <tr>
276
+ <td>
277
+ <pre class="lines">
278
+
279
+
280
+ 96
281
+ 97
282
+ 98
283
+ 99
284
+ 100
285
+ 101
286
+ 102
287
+ 103</pre>
288
+ </td>
289
+ <td>
290
+ <pre class="code"><span class="info file"># File 'lib/direct7/whatsapp.rb', line 96</span>
291
+
292
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_status'>get_status</span><span class='lparen'>(</span><span class='id identifier rubyid_request_id'>request_id</span><span class='rparen'>)</span>
293
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span>
294
+ <span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span>
295
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/whatsapp/v1/report/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_request_id'>request_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
296
+ <span class='rparen'>)</span>
297
+ <span class='ivar'>@log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Message status retrieved successfully.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
298
+ <span class='id identifier rubyid_response'>response</span>
299
+ <span class='kw'>end</span></pre>
300
+ </td>
301
+ </tr>
302
+ </table>
303
+ </div>
304
+
305
+ <div class="method_details ">
306
+ <h3 class="signature " id="send_whatsapp_freeform_message-instance_method">
307
+
308
+ #<strong>send_whatsapp_freeform_message</strong>(originator, recipient, message_type, message_text = nil, first_name = nil, last_name = nil, display_name = nil, phone = nil, email = nil, url = nil, latitude = nil, longitude = nil, location_name = nil, location_address = nil, attachment_type = nil, attachment_url = nil, attachment_caption = nil) &#x21d2; <tt>Object</tt>
309
+
310
+
311
+
312
+
313
+
314
+ </h3><table class="source_code">
315
+ <tr>
316
+ <td>
317
+ <pre class="lines">
318
+
319
+
320
+ 13
321
+ 14
322
+ 15
323
+ 16
324
+ 17
325
+ 18
326
+ 19
327
+ 20
328
+ 21
329
+ 22
330
+ 23
331
+ 24
332
+ 25
333
+ 26
334
+ 27
335
+ 28
336
+ 29
337
+ 30
338
+ 31
339
+ 32
340
+ 33
341
+ 34
342
+ 35
343
+ 36
344
+ 37
345
+ 38
346
+ 39
347
+ 40
348
+ 41
349
+ 42
350
+ 43
351
+ 44
352
+ 45
353
+ 46
354
+ 47
355
+ 48
356
+ 49
357
+ 50
358
+ 51
359
+ 52
360
+ 53
361
+ 54
362
+ 55
363
+ 56
364
+ 57</pre>
365
+ </td>
366
+ <td>
367
+ <pre class="code"><span class="info file"># File 'lib/direct7/whatsapp.rb', line 13</span>
368
+
369
+ <span class='kw'>def</span> <span class='id identifier rubyid_send_whatsapp_freeform_message'>send_whatsapp_freeform_message</span><span class='lparen'>(</span><span class='id identifier rubyid_originator'>originator</span><span class='comma'>,</span> <span class='id identifier rubyid_recipient'>recipient</span><span class='comma'>,</span> <span class='id identifier rubyid_message_type'>message_type</span><span class='comma'>,</span> <span class='id identifier rubyid_message_text'>message_text</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_first_name'>first_name</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
370
+ <span class='id identifier rubyid_last_name'>last_name</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_display_name'>display_name</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_phone'>phone</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
371
+ <span class='id identifier rubyid_email'>email</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_url'>url</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_latitude'>latitude</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_longitude'>longitude</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
372
+ <span class='id identifier rubyid_location_name'>location_name</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_location_address'>location_address</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
373
+ <span class='id identifier rubyid_attachment_type'>attachment_type</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_attachment_url'>attachment_url</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
374
+ <span class='id identifier rubyid_attachment_caption'>attachment_caption</span><span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
375
+ <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='lbrace'>{</span>
376
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>originator</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_originator'>originator</span><span class='comma'>,</span>
377
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>recipients</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>recipient</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_recipient'>recipient</span><span class='rbrace'>}</span><span class='rbracket'>]</span><span class='comma'>,</span>
378
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
379
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>message_type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_message_type'>message_type</span>
380
+ <span class='rbrace'>}</span>
381
+ <span class='rbrace'>}</span>
382
+
383
+ <span class='kw'>case</span> <span class='id identifier rubyid_message_type'>message_type</span>
384
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>CONTACTS</span><span class='tstring_end'>&#39;</span></span>
385
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>contact</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span>
386
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>first_name</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_first_name'>first_name</span><span class='comma'>,</span>
387
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>last_name</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_last_name'>last_name</span><span class='comma'>,</span>
388
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>display_name</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_display_name'>display_name</span><span class='comma'>,</span>
389
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>phone</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_phone'>phone</span><span class='comma'>,</span>
390
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>email</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_email'>email</span><span class='comma'>,</span>
391
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>url</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_url'>url</span>
392
+ <span class='rbrace'>}</span>
393
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>LOCATION</span><span class='tstring_end'>&#39;</span></span>
394
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>location</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span>
395
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>latitude</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_latitude'>latitude</span><span class='comma'>,</span>
396
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>longitude</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_longitude'>longitude</span><span class='comma'>,</span>
397
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>name</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_location_name'>location_name</span><span class='comma'>,</span>
398
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>address</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_location_address'>location_address</span>
399
+ <span class='rbrace'>}</span>
400
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ATTACHMENT</span><span class='tstring_end'>&#39;</span></span>
401
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>attachment</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span>
402
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>attachment_type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_attachment_type'>attachment_type</span><span class='comma'>,</span>
403
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>attachment_url</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_attachment_url'>attachment_url</span><span class='comma'>,</span>
404
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>attachment_caption</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_attachment_caption'>attachment_caption</span>
405
+ <span class='rbrace'>}</span>
406
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TEXT</span><span class='tstring_end'>&#39;</span></span>
407
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>message_text</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_message_text'>message_text</span>
408
+ <span class='kw'>end</span>
409
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_message'>message</span>
410
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/whatsapp/v1/send</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>messages</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_message'>message</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
411
+ <span class='ivar'>@log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Message sent successfully.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
412
+ <span class='id identifier rubyid_response'>response</span>
413
+ <span class='kw'>end</span></pre>
414
+ </td>
415
+ </tr>
416
+ </table>
417
+ </div>
418
+
419
+ <div class="method_details ">
420
+ <h3 class="signature " id="send_whatsapp_templated_message-instance_method">
421
+
422
+ #<strong>send_whatsapp_templated_message</strong>(originator, recipient, template_id, body_parameter_values, media_type = nil, media_url = nil, latitude = nil, longitude = nil, location_name = nil, location_address = nil) &#x21d2; <tt>Object</tt>
423
+
424
+
425
+
426
+
427
+
428
+ </h3><table class="source_code">
429
+ <tr>
430
+ <td>
431
+ <pre class="lines">
432
+
433
+
434
+ 59
435
+ 60
436
+ 61
437
+ 62
438
+ 63
439
+ 64
440
+ 65
441
+ 66
442
+ 67
443
+ 68
444
+ 69
445
+ 70
446
+ 71
447
+ 72
448
+ 73
449
+ 74
450
+ 75
451
+ 76
452
+ 77
453
+ 78
454
+ 79
455
+ 80
456
+ 81
457
+ 82
458
+ 83
459
+ 84
460
+ 85
461
+ 86
462
+ 87
463
+ 88
464
+ 89
465
+ 90
466
+ 91
467
+ 92
468
+ 93
469
+ 94</pre>
470
+ </td>
471
+ <td>
472
+ <pre class="code"><span class="info file"># File 'lib/direct7/whatsapp.rb', line 59</span>
473
+
474
+ <span class='kw'>def</span> <span class='id identifier rubyid_send_whatsapp_templated_message'>send_whatsapp_templated_message</span><span class='lparen'>(</span><span class='id identifier rubyid_originator'>originator</span><span class='comma'>,</span> <span class='id identifier rubyid_recipient'>recipient</span><span class='comma'>,</span> <span class='id identifier rubyid_template_id'>template_id</span><span class='comma'>,</span>
475
+ <span class='id identifier rubyid_body_parameter_values'>body_parameter_values</span><span class='comma'>,</span> <span class='id identifier rubyid_media_type'>media_type</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_media_url'>media_url</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
476
+ <span class='id identifier rubyid_latitude'>latitude</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_longitude'>longitude</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_location_name'>location_name</span><span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span>
477
+ <span class='id identifier rubyid_location_address'>location_address</span><span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
478
+ <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='lbrace'>{</span>
479
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>originator</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_originator'>originator</span><span class='comma'>,</span>
480
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>recipients</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>recipient</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_recipient'>recipient</span><span class='rbrace'>}</span><span class='rbracket'>]</span><span class='comma'>,</span>
481
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
482
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>message_type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TEMPLATE</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
483
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>template</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
484
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>template_id</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_template_id'>template_id</span><span class='comma'>,</span>
485
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>body_parameter_values</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_body_parameter_values'>body_parameter_values</span>
486
+ <span class='rbrace'>}</span>
487
+ <span class='rbrace'>}</span>
488
+ <span class='rbrace'>}</span>
489
+
490
+ <span class='kw'>if</span> <span class='id identifier rubyid_media_type'>media_type</span>
491
+ <span class='kw'>if</span> <span class='id identifier rubyid_media_type'>media_type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>location</span><span class='tstring_end'>&#39;</span></span>
492
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>template</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>media</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span>
493
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>media_type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>location</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
494
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>location</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
495
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>latitude</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_latitude'>latitude</span><span class='comma'>,</span>
496
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>longitude</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_longitude'>longitude</span><span class='comma'>,</span>
497
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>name</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_location_name'>location_name</span><span class='comma'>,</span>
498
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>address</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_location_address'>location_address</span>
499
+ <span class='rbrace'>}</span>
500
+ <span class='rbrace'>}</span>
501
+ <span class='kw'>else</span>
502
+ <span class='id identifier rubyid_message'>message</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>content</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>template</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>media</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>media_type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_media_type'>media_type</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>media_url</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_media_url'>media_url</span> <span class='rbrace'>}</span>
503
+ <span class='kw'>end</span>
504
+ <span class='kw'>end</span>
505
+
506
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/whatsapp/v1/send</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>messages</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_message'>message</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
507
+ <span class='ivar'>@log</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Message sent successfully.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
508
+ <span class='id identifier rubyid_response'>response</span>
509
+ <span class='kw'>end</span></pre>
510
+ </td>
511
+ </tr>
512
+ </table>
513
+ </div>
514
+
515
+ </div>
516
+
517
+ </div>
518
+
519
+ <div id="footer">
520
+ Generated on Fri Nov 3 09:22:45 2023 by
521
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
522
+ 0.9.34 (ruby-2.7.4).
523
+ </div>
524
+
525
+ </div>
526
+ </body>
527
+ </html>