seven_api 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -6
  3. data/.idea/inspectionProfiles/Project_Default.xml +5 -5
  4. data/.idea/ruby-client.iml +51 -4
  5. data/Gemfile +2 -2
  6. data/LICENSE +21 -21
  7. data/README.md +3 -3
  8. data/Rakefile +5 -5
  9. data/doc/{Sms77 → SevenApi}/Client.html +229 -229
  10. data/doc/{Sms77 → SevenApi}/Contacts/Action.html +130 -130
  11. data/doc/{Sms77 → SevenApi}/Contacts.html +125 -125
  12. data/doc/{Sms77 → SevenApi}/Endpoint.html +186 -186
  13. data/doc/{Sms77 → SevenApi}/Hooks/Action.html +130 -130
  14. data/doc/{Sms77 → SevenApi}/Hooks/EventType.html +145 -145
  15. data/doc/{Sms77 → SevenApi}/Hooks/RequestMethod.html +130 -130
  16. data/doc/{Sms77 → SevenApi}/Hooks/Validator.html +597 -597
  17. data/doc/{Sms77 → SevenApi}/Hooks.html +125 -125
  18. data/doc/{Sms77 → SevenApi}/Journal/Type.html +135 -135
  19. data/doc/{Sms77 → SevenApi}/Journal/Validator.html +393 -393
  20. data/doc/{Sms77 → SevenApi}/Journal.html +125 -125
  21. data/doc/{Sms77 → SevenApi}/Lookup/Type.html +135 -135
  22. data/doc/{Sms77 → SevenApi}/Lookup.html +125 -125
  23. data/doc/{Sms77 → SevenApi}/Resource.html +869 -869
  24. data/doc/{Sms77 → SevenApi}/Resources/Analytics.html +262 -262
  25. data/doc/{Sms77 → SevenApi}/Resources/Balance.html +245 -245
  26. data/doc/{Sms77 → SevenApi}/Resources/Contacts.html +448 -448
  27. data/doc/{Sms77 → SevenApi}/Resources/Hooks.html +456 -456
  28. data/doc/{Sms77 → SevenApi}/Resources/Journal.html +260 -260
  29. data/doc/{Sms77 → SevenApi}/Resources/Lookup.html +539 -539
  30. data/doc/{Sms77 → SevenApi}/Resources/Pricing.html +262 -262
  31. data/doc/{Sms77 → SevenApi}/Resources/Sms.html +260 -260
  32. data/doc/{Sms77 → SevenApi}/Resources/Status.html +260 -260
  33. data/doc/{Sms77 → SevenApi}/Resources/Subaccounts.html +650 -650
  34. data/doc/{Sms77 → SevenApi}/Resources/ValidateForVoice.html +260 -260
  35. data/doc/{Sms77 → SevenApi}/Resources/Voice.html +260 -260
  36. data/doc/SevenApi/Resources.html +128 -0
  37. data/doc/{Sms77 → SevenApi}/Sms/Type.html +125 -125
  38. data/doc/{Sms77 → SevenApi}/Sms.html +125 -125
  39. data/doc/{Sms77 → SevenApi}/Subaccounts/Action.html +140 -140
  40. data/doc/SevenApi/Subaccounts/Validator.html +490 -0
  41. data/doc/{Sms77 → SevenApi}/Subaccounts.html +125 -125
  42. data/doc/{Sms77 → SevenApi}/Util.html +1032 -1032
  43. data/doc/{Sms77.html → SevenApi.html} +145 -145
  44. data/doc/_index.html +443 -443
  45. data/doc/class_list.html +51 -51
  46. data/doc/css/full_list.css +58 -58
  47. data/doc/css/style.css +497 -497
  48. data/doc/file.README.html +110 -111
  49. data/doc/file_list.html +56 -56
  50. data/doc/frames.html +17 -17
  51. data/doc/index.html +110 -111
  52. data/doc/js/app.js +314 -314
  53. data/doc/js/full_list.js +216 -216
  54. data/doc/js/jquery.js +3 -3
  55. data/doc/method_list.html +563 -563
  56. data/doc/top-level-namespace.html +109 -109
  57. data/document.sh +3 -0
  58. data/lib/seven_api/client.rb +32 -30
  59. data/lib/seven_api/contacts.rb +5 -10
  60. data/lib/seven_api/endpoint.rb +5 -0
  61. data/lib/seven_api/hooks.rb +69 -67
  62. data/lib/seven_api/journal.rb +39 -39
  63. data/lib/seven_api/lookup.rb +12 -11
  64. data/lib/seven_api/numbers.rb +9 -0
  65. data/lib/seven_api/paginated.rb +10 -0
  66. data/lib/seven_api/rcs.rb +9 -0
  67. data/lib/seven_api/resource.rb +8 -4
  68. data/lib/seven_api/resources/analytics.rb +54 -21
  69. data/lib/seven_api/resources/balance.rb +19 -19
  70. data/lib/seven_api/resources/contacts.rb +56 -38
  71. data/lib/seven_api/resources/groups.rb +57 -0
  72. data/lib/seven_api/resources/hooks.rb +40 -40
  73. data/lib/seven_api/resources/journal.rb +20 -20
  74. data/lib/seven_api/resources/lookup.rb +63 -47
  75. data/lib/seven_api/resources/numbers.rb +71 -0
  76. data/lib/seven_api/resources/pricing.rb +20 -20
  77. data/lib/seven_api/resources/rcs.rb +39 -0
  78. data/lib/seven_api/resources/sms.rb +29 -20
  79. data/lib/seven_api/resources/status.rb +20 -20
  80. data/lib/seven_api/resources/subaccounts.rb +65 -65
  81. data/lib/seven_api/resources/validate_for_voice.rb +20 -20
  82. data/lib/seven_api/resources/voice.rb +29 -20
  83. data/lib/seven_api/sms.rb +9 -9
  84. data/lib/seven_api/subaccounts.rb +55 -55
  85. data/lib/seven_api/util.rb +68 -68
  86. data/lib/seven_api/version.rb +5 -5
  87. data/lib/seven_api.rb +6 -6
  88. data/release.sh +4 -4
  89. data/seven_api.gemspec +5 -5
  90. data/spec/EnvKeyStore.rb +14 -14
  91. data/spec/matchers.rb +22 -22
  92. data/spec/seven_api/analytics_spec.rb +49 -0
  93. data/spec/seven_api/balance_spec.rb +18 -12
  94. data/spec/seven_api/client_spec.rb +15 -15
  95. data/spec/seven_api/contacts_spec.rb +100 -129
  96. data/spec/seven_api/groups_spec.rb +74 -0
  97. data/spec/seven_api/hooks_spec.rb +108 -108
  98. data/spec/seven_api/instance_spec.rb +22 -22
  99. data/spec/seven_api/journal_spec.rb +86 -86
  100. data/spec/seven_api/lookup_spec.rb +197 -179
  101. data/spec/seven_api/numbers_spec.rb +135 -0
  102. data/spec/seven_api/pricing_spec.rb +76 -76
  103. data/spec/seven_api/rcs_spec.rb +99 -0
  104. data/spec/seven_api/sms_spec.rb +103 -103
  105. data/spec/seven_api/subaccounts_spec.rb +121 -121
  106. data/spec/seven_api/validate_for_voice_spec.rb +19 -19
  107. data/spec/seven_api/voice_spec.rb +51 -51
  108. data/spec/seven_api_spec.rb +9 -9
  109. data/spec/spec_helper.rb +8 -17
  110. metadata +62 -50
  111. data/doc/Sms77/Resources.html +0 -128
  112. data/doc/Sms77/Subaccounts/Validator.html +0 -490
data/doc/js/full_list.js CHANGED
@@ -1,216 +1,216 @@
1
- (function() {
2
-
3
- var $clicked = $(null);
4
- var searchTimeout = null;
5
- var searchCache = [];
6
- var caseSensitiveMatch = false;
7
- var ignoreKeyCodeMin = 8;
8
- var ignoreKeyCodeMax = 46;
9
- var commandKey = 91;
10
-
11
- RegExp.escape = function(text) {
12
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13
- }
14
-
15
- function escapeShortcut() {
16
- $(document).keydown(function(evt) {
17
- if (evt.which == 27) {
18
- window.parent.postMessage('navEscape', '*');
19
- }
20
- });
21
- }
22
-
23
- function navResizer() {
24
- $(window).mousemove(function(e) {
25
- window.parent.postMessage({
26
- action: 'mousemove', event: {pageX: e.pageX, which: e.which}
27
- }, '*');
28
- }).mouseup(function(e) {
29
- window.parent.postMessage({action: 'mouseup'}, '*');
30
- });
31
- window.parent.postMessage("navReady", "*");
32
- }
33
-
34
- function clearSearchTimeout() {
35
- clearTimeout(searchTimeout);
36
- searchTimeout = null;
37
- }
38
-
39
- function enableLinks() {
40
- // load the target page in the parent window
41
- $('#full_list li').on('click', function(evt) {
42
- $('#full_list li').removeClass('clicked');
43
- $clicked = $(this);
44
- $clicked.addClass('clicked');
45
- evt.stopPropagation();
46
-
47
- if (evt.target.tagName === 'A') return true;
48
-
49
- var elem = $clicked.find('> .item .object_link a')[0];
50
- var e = evt.originalEvent;
51
- var newEvent = new MouseEvent(evt.originalEvent.type);
52
- newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
53
- elem.dispatchEvent(newEvent);
54
- evt.preventDefault();
55
- return false;
56
- });
57
- }
58
-
59
- function enableToggles() {
60
- // show/hide nested classes on toggle click
61
- $('#full_list a.toggle').on('click', function(evt) {
62
- evt.stopPropagation();
63
- evt.preventDefault();
64
- $(this).parent().parent().toggleClass('collapsed');
65
- highlight();
66
- });
67
- }
68
-
69
- function populateSearchCache() {
70
- $('#full_list li .item').each(function() {
71
- var $node = $(this);
72
- var $link = $node.find('.object_link a');
73
- if ($link.length > 0) {
74
- searchCache.push({
75
- node: $node,
76
- link: $link,
77
- name: $link.text(),
78
- fullName: $link.attr('title').split(' ')[0]
79
- });
80
- }
81
- });
82
- }
83
-
84
- function enableSearch() {
85
- $('#search input').keyup(function(event) {
86
- if (ignoredKeyPress(event)) return;
87
- if (this.value === "") {
88
- clearSearch();
89
- } else {
90
- performSearch(this.value);
91
- }
92
- });
93
-
94
- $('#full_list').after("<div id='noresults' style='display:none'></div>");
95
- }
96
-
97
- function ignoredKeyPress(event) {
98
- if (
99
- (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
100
- (event.keyCode == commandKey)
101
- ) {
102
- return true;
103
- } else {
104
- return false;
105
- }
106
- }
107
-
108
- function clearSearch() {
109
- clearSearchTimeout();
110
- $('#full_list .found').removeClass('found').each(function() {
111
- var $link = $(this).find('.object_link a');
112
- $link.text($link.text());
113
- });
114
- $('#full_list, #content').removeClass('insearch');
115
- $clicked.parents().removeClass('collapsed');
116
- highlight();
117
- }
118
-
119
- function performSearch(searchString) {
120
- clearSearchTimeout();
121
- $('#full_list, #content').addClass('insearch');
122
- $('#noresults').text('').hide();
123
- partialSearch(searchString, 0);
124
- }
125
-
126
- function partialSearch(searchString, offset) {
127
- var lastRowClass = '';
128
- var i = null;
129
- for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
130
- var item = searchCache[i];
131
- var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
132
- var matchString = buildMatchString(searchString);
133
- var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
134
- if (searchName.match(matchRegexp) == null) {
135
- item.node.removeClass('found');
136
- item.link.text(item.link.text());
137
- }
138
- else {
139
- item.node.addClass('found');
140
- item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
141
- lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
142
- item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
143
- }
144
- }
145
- if(i == searchCache.length) {
146
- searchDone();
147
- } else {
148
- searchTimeout = setTimeout(function() {
149
- partialSearch(searchString, i);
150
- }, 0);
151
- }
152
- }
153
-
154
- function searchDone() {
155
- searchTimeout = null;
156
- highlight();
157
- if ($('#full_list li:visible').size() === 0) {
158
- $('#noresults').text('No results were found.').hide().fadeIn();
159
- } else {
160
- $('#noresults').text('').hide();
161
- }
162
- $('#content').removeClass('insearch');
163
- }
164
-
165
- function buildMatchString(searchString, event) {
166
- caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
167
- var regexSearchString = RegExp.escape(searchString);
168
- if (caseSensitiveMatch) {
169
- regexSearchString += "|" +
170
- $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
171
- join('.+?');
172
- }
173
- return regexSearchString;
174
- }
175
-
176
- function highlight() {
177
- $('#full_list li:visible').each(function(n) {
178
- $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
179
- });
180
- }
181
-
182
- /**
183
- * Expands the tree to the target element and its immediate
184
- * children.
185
- */
186
- function expandTo(path) {
187
- var $target = $(document.getElementById('object_' + path));
188
- $target.addClass('clicked');
189
- $target.removeClass('collapsed');
190
- $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
191
- if($target[0]) {
192
- window.scrollTo(window.scrollX, $target.offset().top - 250);
193
- highlight();
194
- }
195
- }
196
-
197
- function windowEvents(event) {
198
- var msg = event.data;
199
- if (msg.action === "expand") {
200
- expandTo(msg.path);
201
- }
202
- return false;
203
- }
204
-
205
- window.addEventListener("message", windowEvents, false);
206
-
207
- $(document).ready(function() {
208
- escapeShortcut();
209
- navResizer();
210
- enableLinks();
211
- enableToggles();
212
- populateSearchCache();
213
- enableSearch();
214
- });
215
-
216
- })();
1
+ (function() {
2
+
3
+ var $clicked = $(null);
4
+ var searchTimeout = null;
5
+ var searchCache = [];
6
+ var caseSensitiveMatch = false;
7
+ var ignoreKeyCodeMin = 8;
8
+ var ignoreKeyCodeMax = 46;
9
+ var commandKey = 91;
10
+
11
+ RegExp.escape = function(text) {
12
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13
+ }
14
+
15
+ function escapeShortcut() {
16
+ $(document).keydown(function(evt) {
17
+ if (evt.which == 27) {
18
+ window.parent.postMessage('navEscape', '*');
19
+ }
20
+ });
21
+ }
22
+
23
+ function navResizer() {
24
+ $(window).mousemove(function(e) {
25
+ window.parent.postMessage({
26
+ action: 'mousemove', event: {pageX: e.pageX, which: e.which}
27
+ }, '*');
28
+ }).mouseup(function(e) {
29
+ window.parent.postMessage({action: 'mouseup'}, '*');
30
+ });
31
+ window.parent.postMessage("navReady", "*");
32
+ }
33
+
34
+ function clearSearchTimeout() {
35
+ clearTimeout(searchTimeout);
36
+ searchTimeout = null;
37
+ }
38
+
39
+ function enableLinks() {
40
+ // load the target page in the parent window
41
+ $('#full_list li').on('click', function(evt) {
42
+ $('#full_list li').removeClass('clicked');
43
+ $clicked = $(this);
44
+ $clicked.addClass('clicked');
45
+ evt.stopPropagation();
46
+
47
+ if (evt.target.tagName === 'A') return true;
48
+
49
+ var elem = $clicked.find('> .item .object_link a')[0];
50
+ var e = evt.originalEvent;
51
+ var newEvent = new MouseEvent(evt.originalEvent.type);
52
+ newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
53
+ elem.dispatchEvent(newEvent);
54
+ evt.preventDefault();
55
+ return false;
56
+ });
57
+ }
58
+
59
+ function enableToggles() {
60
+ // show/hide nested classes on toggle click
61
+ $('#full_list a.toggle').on('click', function(evt) {
62
+ evt.stopPropagation();
63
+ evt.preventDefault();
64
+ $(this).parent().parent().toggleClass('collapsed');
65
+ highlight();
66
+ });
67
+ }
68
+
69
+ function populateSearchCache() {
70
+ $('#full_list li .item').each(function() {
71
+ var $node = $(this);
72
+ var $link = $node.find('.object_link a');
73
+ if ($link.length > 0) {
74
+ searchCache.push({
75
+ node: $node,
76
+ link: $link,
77
+ name: $link.text(),
78
+ fullName: $link.attr('title').split(' ')[0]
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
+ function enableSearch() {
85
+ $('#search input').keyup(function(event) {
86
+ if (ignoredKeyPress(event)) return;
87
+ if (this.value === "") {
88
+ clearSearch();
89
+ } else {
90
+ performSearch(this.value);
91
+ }
92
+ });
93
+
94
+ $('#full_list').after("<div id='noresults' style='display:none'></div>");
95
+ }
96
+
97
+ function ignoredKeyPress(event) {
98
+ if (
99
+ (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
100
+ (event.keyCode == commandKey)
101
+ ) {
102
+ return true;
103
+ } else {
104
+ return false;
105
+ }
106
+ }
107
+
108
+ function clearSearch() {
109
+ clearSearchTimeout();
110
+ $('#full_list .found').removeClass('found').each(function() {
111
+ var $link = $(this).find('.object_link a');
112
+ $link.text($link.text());
113
+ });
114
+ $('#full_list, #content').removeClass('insearch');
115
+ $clicked.parents().removeClass('collapsed');
116
+ highlight();
117
+ }
118
+
119
+ function performSearch(searchString) {
120
+ clearSearchTimeout();
121
+ $('#full_list, #content').addClass('insearch');
122
+ $('#noresults').text('').hide();
123
+ partialSearch(searchString, 0);
124
+ }
125
+
126
+ function partialSearch(searchString, offset) {
127
+ var lastRowClass = '';
128
+ var i = null;
129
+ for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
130
+ var item = searchCache[i];
131
+ var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
132
+ var matchString = buildMatchString(searchString);
133
+ var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
134
+ if (searchName.match(matchRegexp) == null) {
135
+ item.node.removeClass('found');
136
+ item.link.text(item.link.text());
137
+ }
138
+ else {
139
+ item.node.addClass('found');
140
+ item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
141
+ lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
142
+ item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
143
+ }
144
+ }
145
+ if(i == searchCache.length) {
146
+ searchDone();
147
+ } else {
148
+ searchTimeout = setTimeout(function() {
149
+ partialSearch(searchString, i);
150
+ }, 0);
151
+ }
152
+ }
153
+
154
+ function searchDone() {
155
+ searchTimeout = null;
156
+ highlight();
157
+ if ($('#full_list li:visible').size() === 0) {
158
+ $('#noresults').text('No results were found.').hide().fadeIn();
159
+ } else {
160
+ $('#noresults').text('').hide();
161
+ }
162
+ $('#content').removeClass('insearch');
163
+ }
164
+
165
+ function buildMatchString(searchString, event) {
166
+ caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
167
+ var regexSearchString = RegExp.escape(searchString);
168
+ if (caseSensitiveMatch) {
169
+ regexSearchString += "|" +
170
+ $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
171
+ join('.+?');
172
+ }
173
+ return regexSearchString;
174
+ }
175
+
176
+ function highlight() {
177
+ $('#full_list li:visible').each(function(n) {
178
+ $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
179
+ });
180
+ }
181
+
182
+ /**
183
+ * Expands the tree to the target element and its immediate
184
+ * children.
185
+ */
186
+ function expandTo(path) {
187
+ var $target = $(document.getElementById('object_' + path));
188
+ $target.addClass('clicked');
189
+ $target.removeClass('collapsed');
190
+ $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
191
+ if($target[0]) {
192
+ window.scrollTo(window.scrollX, $target.offset().top - 250);
193
+ highlight();
194
+ }
195
+ }
196
+
197
+ function windowEvents(event) {
198
+ var msg = event.data;
199
+ if (msg.action === "expand") {
200
+ expandTo(msg.path);
201
+ }
202
+ return false;
203
+ }
204
+
205
+ window.addEventListener("message", windowEvents, false);
206
+
207
+ $(document).ready(function() {
208
+ escapeShortcut();
209
+ navResizer();
210
+ enableLinks();
211
+ enableToggles();
212
+ populateSearchCache();
213
+ enableSearch();
214
+ });
215
+
216
+ })();