cpaas-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.md +1 -0
  8. data/README.md +25 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/cpaas-sdk.gemspec +32 -0
  13. data/docs/Cpaas.html +446 -0
  14. data/docs/Cpaas/Conversation.html +1742 -0
  15. data/docs/Cpaas/Notification.html +301 -0
  16. data/docs/Cpaas/TwoFactor.html +908 -0
  17. data/docs/_index.html +146 -0
  18. data/docs/_index.md +21 -0
  19. data/docs/class_list.html +51 -0
  20. data/docs/css/common.css +1 -0
  21. data/docs/css/full_list.css +58 -0
  22. data/docs/css/style.css +496 -0
  23. data/docs/file.README.html +102 -0
  24. data/docs/file._index.html +94 -0
  25. data/docs/file_list.html +56 -0
  26. data/docs/frames.html +17 -0
  27. data/docs/index.html +94 -0
  28. data/docs/js/app.js +303 -0
  29. data/docs/js/full_list.js +216 -0
  30. data/docs/js/jquery.js +4 -0
  31. data/docs/method_list.html +251 -0
  32. data/docs/mv_index.html +102 -0
  33. data/docs/top-level-namespace.html +663 -0
  34. data/examples/2fa/.env.example +6 -0
  35. data/examples/2fa/.gitignore +159 -0
  36. data/examples/2fa/.ruby-gemset +1 -0
  37. data/examples/2fa/.ruby-version +1 -0
  38. data/examples/2fa/Gemfile +8 -0
  39. data/examples/2fa/README.md +34 -0
  40. data/examples/2fa/app.rb +134 -0
  41. data/examples/2fa/config.ru +10 -0
  42. data/examples/2fa/helper.rb +37 -0
  43. data/examples/2fa/public/stylesheets/forms.css +28 -0
  44. data/examples/2fa/public/stylesheets/global.css +7 -0
  45. data/examples/2fa/public/stylesheets/layout.css +45 -0
  46. data/examples/2fa/public/stylesheets/main.css +3 -0
  47. data/examples/2fa/views/alert.erb +5 -0
  48. data/examples/2fa/views/dashboard.erb +4 -0
  49. data/examples/2fa/views/index.erb +17 -0
  50. data/examples/2fa/views/login.erb +13 -0
  51. data/examples/2fa/views/verify.erb +8 -0
  52. data/examples/sms/.env.example +4 -0
  53. data/examples/sms/.gitignore +159 -0
  54. data/examples/sms/.ruby-gemset +1 -0
  55. data/examples/sms/.ruby-version +1 -0
  56. data/examples/sms/Gemfile +8 -0
  57. data/examples/sms/README.md +80 -0
  58. data/examples/sms/app.rb +87 -0
  59. data/examples/sms/config.ru +10 -0
  60. data/examples/sms/helper.rb +33 -0
  61. data/examples/sms/public/scripts/notification.js +46 -0
  62. data/examples/sms/public/stylesheets/forms.css +28 -0
  63. data/examples/sms/public/stylesheets/global.css +7 -0
  64. data/examples/sms/public/stylesheets/layout.css +74 -0
  65. data/examples/sms/public/stylesheets/main.css +3 -0
  66. data/examples/sms/views/alert.erb +5 -0
  67. data/examples/sms/views/index.erb +48 -0
  68. data/lib/cpaas-sdk.rb +30 -0
  69. data/lib/cpaas-sdk/api.rb +139 -0
  70. data/lib/cpaas-sdk/config.rb +9 -0
  71. data/lib/cpaas-sdk/resources.rb +4 -0
  72. data/lib/cpaas-sdk/resources/conversation.rb +268 -0
  73. data/lib/cpaas-sdk/resources/notification.rb +62 -0
  74. data/lib/cpaas-sdk/resources/notification_channel.rb +39 -0
  75. data/lib/cpaas-sdk/resources/twofactor.rb +136 -0
  76. data/lib/cpaas-sdk/util.rb +93 -0
  77. data/lib/cpaas-sdk/version.rb +3 -0
  78. data/tutorials/2FA.md +109 -0
  79. data/tutorials/2fa-flow.png +0 -0
  80. data/tutorials/GetStarted.md +86 -0
  81. data/tutorials/SMSMessaging.md +132 -0
  82. data/tutorials/index.html +86 -0
  83. data/tutorials/quickstarts.yml +15 -0
  84. metadata +238 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8be04a70b357316c000cfc6437488b4d71d34bcf528bef33136c7dcc36cc0858
4
+ data.tar.gz: f3fd34a38d1828259e6017edb66d4976c30983da9cc37b4fc59e814de77efeef
5
+ SHA512:
6
+ metadata.gz: d9f9d3c7ac7369828012a8bfa7a40ab5a0288674c124d229b67ce39f4e2ee9e9f87ba6611d720730e31c3cf9157e384fe346d513780d6d3b4a93570f021dcec8
7
+ data.tar.gz: a0a41e797bda278bba07beef141cbfe7afd64950ba1e23836e9a86b4152488b5709d9df22fcda1c0ba9584e1899599531efd49d87108ffc4d6d0a35f184c397b
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+ Gemfile.lock
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.0
7
+ before_install: gem install bundler -v 2.0.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ + This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+ + The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) recommendations.
7
+
8
+
9
+ ## 1.0.0
10
+
11
+ Initial release.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cpaas-ruby.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ Copyright © 2018-2019 Sonus Networks, Inc. (d.b.a. Ribbon Communications Operating Company) ("Ribbon"). All rights reserved. This publication and the information contained herein is the property of the Ribbon and may not be copied, reproduced or distributed in any form or by any means without the prior written permission of Ribbon.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # cpaas-ruby
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'cpaas-ruby'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install cpaas-ruby
18
+
19
+ ## Reference
20
+
21
+ The information about tutorials and documents can be found in the links below
22
+
23
+ * `Documents`: [docs](https://kandy-io.github.io/kandy-cpaas-ruby-sdk/docs)
24
+
25
+ * `Tutorials`: [Get Started](https://Kandy-IO.github.io/kandy-cpaas-ruby-sdk/tutorials/?KANDY=Kandy&KANDYFQDN=https://oauth-cpaas.att.com#/GetStarted)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cpaas-sdk"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/cpaas-sdk.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'cpaas-sdk/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'cpaas-sdk'
7
+ spec.version = Cpaas::VERSION
8
+ spec.authors = ['Keepworks']
9
+ spec.email = ['kandy@keepworks.com']
10
+
11
+ spec.summary = %q{CPaaS Library}
12
+ spec.description = %q{SDK to build robust real-time communication applications.}
13
+ spec.homepage = 'https://github.com/Kandy-IO/kandy-cpaas-ruby-sdk'
14
+ spec.license = 'SEE LICENSE IN LICENSE.md'
15
+
16
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ end
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 2.0'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ spec.add_development_dependency 'webmock', '~> 3.6.2'
27
+ spec.add_development_dependency 'yard', '~> 0.9.20'
28
+ spec.add_development_dependency 'pry', '~> 0.12.2'
29
+
30
+ spec.add_dependency 'jwt', '~> 2.2.1'
31
+ spec.add_dependency 'httparty', '~> 0.17'
32
+ end
data/docs/Cpaas.html ADDED
@@ -0,0 +1,446 @@
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
+ Module: Cpaas
8
+
9
+ &mdash; Documentation by YARD 0.9.20
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Cpaas";
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 (C)</a> &raquo;
40
+
41
+
42
+ <span class="title">Cpaas</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>Module: Cpaas
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/cpaas.rb<span class="defines">,<br />
82
+ lib/cpaas/api.rb,<br /> lib/cpaas/config.rb,<br /> lib/cpaas/version.rb,<br /> lib/cpaas/resources/twofactor.rb,<br /> lib/cpaas/resources/conversation.rb,<br /> lib/cpaas/resources/notification.rb,<br /> lib/cpaas/resources/notification_channel.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+
93
+
94
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Cpaas/Conversation.html" title="Cpaas::Conversation (class)">Conversation</a></span>, <span class='object_link'><a href="Cpaas/Notification.html" title="Cpaas::Notification (class)">Notification</a></span>, <span class='object_link'><a href="Cpaas/Twofactor.html" title="Cpaas::Twofactor (class)">Twofactor</a></span>
95
+
96
+
97
+ </p>
98
+
99
+
100
+ <h2>
101
+ Constant Summary
102
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
103
+ </h2>
104
+
105
+ <dl class="constants">
106
+
107
+ <dt id="VERSION-constant" class="">VERSION =
108
+
109
+ </dt>
110
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
111
+
112
+ </dl>
113
+
114
+
115
+
116
+
117
+
118
+ <h2>Class Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
119
+ <ul class="summary">
120
+
121
+ <li class="public ">
122
+ <span class="summary_signature">
123
+
124
+ <a href="#api-class_method" title="api (class method)">.<strong>api</strong> &#x21d2; Object </a>
125
+
126
+
127
+
128
+ </span>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <span class="summary_desc"><div class='inline'>
142
+ <p>Returns the value of attribute api.</p>
143
+ </div></span>
144
+
145
+ </li>
146
+
147
+
148
+ <li class="public ">
149
+ <span class="summary_signature">
150
+
151
+ <a href="#config-class_method" title="config (class method)">.<strong>config</strong> &#x21d2; Object </a>
152
+
153
+
154
+
155
+ </span>
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+ <span class="summary_desc"><div class='inline'>
169
+ <p>Returns the value of attribute config.</p>
170
+ </div></span>
171
+
172
+ </li>
173
+
174
+
175
+ </ul>
176
+
177
+
178
+
179
+
180
+
181
+ <h2>
182
+ Class Method Summary
183
+ <small><a href="#" class="summary_toggle">collapse</a></small>
184
+ </h2>
185
+
186
+ <ul class="summary">
187
+
188
+ <li class="public ">
189
+ <span class="summary_signature">
190
+
191
+ <a href="#configure-class_method" title="configure (class method)">.<strong>configure</strong> {|self.config = Cpaas::Config.new| ... } &#x21d2; Object </a>
192
+
193
+
194
+
195
+ </span>
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <span class="summary_desc"><div class='inline'>
206
+ <p>Configure the SDK with client_id and client_secret.</p>
207
+ </div></span>
208
+
209
+ </li>
210
+
211
+
212
+ </ul>
213
+
214
+
215
+
216
+ <div id="class_attr_details" class="attr_details">
217
+ <h2>Class Attribute Details</h2>
218
+
219
+
220
+ <span id="api=-class_method"></span>
221
+ <div class="method_details first">
222
+ <h3 class="signature first" id="api-class_method">
223
+
224
+ .<strong>api</strong> &#x21d2; <tt>Object</tt>
225
+
226
+
227
+
228
+
229
+
230
+ </h3><div class="docstring">
231
+ <div class="discussion">
232
+
233
+ <p>Returns the value of attribute api</p>
234
+
235
+
236
+ </div>
237
+ </div>
238
+ <div class="tags">
239
+
240
+
241
+ </div><table class="source_code">
242
+ <tr>
243
+ <td>
244
+ <pre class="lines">
245
+
246
+
247
+ 8
248
+ 9
249
+ 10</pre>
250
+ </td>
251
+ <td>
252
+ <pre class="code"><span class="info file"># File 'lib/cpaas.rb', line 8</span>
253
+
254
+ <span class='kw'>def</span> <span class='id identifier rubyid_api'>api</span>
255
+ <span class='ivar'>@api</span>
256
+ <span class='kw'>end</span></pre>
257
+ </td>
258
+ </tr>
259
+ </table>
260
+ </div>
261
+
262
+
263
+ <span id="config=-class_method"></span>
264
+ <div class="method_details ">
265
+ <h3 class="signature " id="config-class_method">
266
+
267
+ .<strong>config</strong> &#x21d2; <tt>Object</tt>
268
+
269
+
270
+
271
+
272
+
273
+ </h3><div class="docstring">
274
+ <div class="discussion">
275
+
276
+ <p>Returns the value of attribute config</p>
277
+
278
+
279
+ </div>
280
+ </div>
281
+ <div class="tags">
282
+
283
+
284
+ </div><table class="source_code">
285
+ <tr>
286
+ <td>
287
+ <pre class="lines">
288
+
289
+
290
+ 8
291
+ 9
292
+ 10</pre>
293
+ </td>
294
+ <td>
295
+ <pre class="code"><span class="info file"># File 'lib/cpaas.rb', line 8</span>
296
+
297
+ <span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
298
+ <span class='ivar'>@config</span>
299
+ <span class='kw'>end</span></pre>
300
+ </td>
301
+ </tr>
302
+ </table>
303
+ </div>
304
+
305
+ </div>
306
+
307
+
308
+ <div id="class_method_details" class="method_details_list">
309
+ <h2>Class Method Details</h2>
310
+
311
+
312
+ <div class="method_details first">
313
+ <h3 class="signature first" id="configure-class_method">
314
+
315
+ .<strong>configure</strong> {|self.config = Cpaas::Config.new| ... } &#x21d2; <tt>Object</tt>
316
+
317
+
318
+
319
+
320
+
321
+ </h3><div class="docstring">
322
+ <div class="discussion">
323
+
324
+ <p>Configure the SDK with client_id and client_secret.</p>
325
+
326
+
327
+ </div>
328
+ </div>
329
+ <div class="tags">
330
+
331
+ <div class="examples">
332
+ <p class="tag_title">Examples:</p>
333
+
334
+
335
+ <pre class="example code"><code>Cpaas.configure do |config|
336
+ config.client_id: &#39;&lt;private project key&gt;&#39;,
337
+ config.client_secret: &#39;&lt;private project secret&gt;&#39;,
338
+ config.base_url: &#39;&lt;base url&gt;&#39;
339
+ end</code></pre>
340
+
341
+ </div>
342
+ <p class="tag_title">Parameters:</p>
343
+ <ul class="param">
344
+
345
+ <li>
346
+
347
+ <span class='name'>client_id</span>
348
+
349
+
350
+ <span class='type'>(<tt>String</tt>)</span>
351
+
352
+
353
+
354
+ &mdash;
355
+ <div class='inline'>
356
+ <p>Private project secret</p>
357
+ </div>
358
+
359
+ </li>
360
+
361
+ <li>
362
+
363
+ <span class='name'>client_secret</span>
364
+
365
+
366
+ <span class='type'>(<tt>String</tt>)</span>
367
+
368
+
369
+
370
+ &mdash;
371
+ <div class='inline'>
372
+ <p>Private project secret</p>
373
+ </div>
374
+
375
+ </li>
376
+
377
+ <li>
378
+
379
+ <span class='name'>base_url</span>
380
+
381
+
382
+ <span class='type'>(<tt>String</tt>)</span>
383
+
384
+
385
+
386
+ &mdash;
387
+ <div class='inline'>
388
+ <p>JSON URL of the server to be used.</p>
389
+ </div>
390
+
391
+ </li>
392
+
393
+ </ul>
394
+
395
+ <p class="tag_title">Yields:</p>
396
+ <ul class="yield">
397
+
398
+ <li>
399
+
400
+
401
+ <span class='type'>(<tt>self.<span class='object_link'><a href="#config-class_method" title="Cpaas.config (method)">config</a></span> = <span class='object_link'>Cpaas::Config</span>.new</tt>)</span>
402
+
403
+
404
+
405
+ </li>
406
+
407
+ </ul>
408
+
409
+ </div><table class="source_code">
410
+ <tr>
411
+ <td>
412
+ <pre class="lines">
413
+
414
+
415
+ 25
416
+ 26
417
+ 27
418
+ 28
419
+ 29</pre>
420
+ </td>
421
+ <td>
422
+ <pre class="code"><span class="info file"># File 'lib/cpaas.rb', line 25</span>
423
+
424
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span>
425
+ <span class='kw'>yield</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Cpaas (module)">Cpaas</a></span></span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
426
+
427
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_api'>api</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Cpaas (module)">Cpaas</a></span></span><span class='op'>::</span><span class='const'>Api</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
428
+ <span class='kw'>end</span></pre>
429
+ </td>
430
+ </tr>
431
+ </table>
432
+ </div>
433
+
434
+ </div>
435
+
436
+ </div>
437
+
438
+ <div id="footer">
439
+ Generated on Thu Oct 17 17:28:29 2019 by
440
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
441
+ 0.9.20 (ruby-2.5.0).
442
+ </div>
443
+
444
+ </div>
445
+ </body>
446
+ </html>