didww-v3 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +313 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +57 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +19 -0
  11. data/bin/setup +8 -0
  12. data/didww-v3.gemspec +46 -0
  13. data/lib/didww.rb +3 -0
  14. data/lib/didww/client.rb +120 -0
  15. data/lib/didww/complex_objects/base.rb +89 -0
  16. data/lib/didww/complex_objects/cdr_export_filter.rb +23 -0
  17. data/lib/didww/complex_objects/configurations.rb +11 -0
  18. data/lib/didww/complex_objects/configurations/base.rb +11 -0
  19. data/lib/didww/complex_objects/configurations/const.rb +149 -0
  20. data/lib/didww/complex_objects/configurations/h323_configuration.rb +35 -0
  21. data/lib/didww/complex_objects/configurations/iax2_configuration.rb +45 -0
  22. data/lib/didww/complex_objects/configurations/pstn_configuration.rb +16 -0
  23. data/lib/didww/complex_objects/configurations/sip_configuration.rb +203 -0
  24. data/lib/didww/complex_objects/did_order_item.rb +14 -0
  25. data/lib/didww/middleware.rb +18 -0
  26. data/lib/didww/resources/balance.rb +20 -0
  27. data/lib/didww/resources/base.rb +29 -0
  28. data/lib/didww/resources/cdr_export.rb +47 -0
  29. data/lib/didww/resources/city.rb +9 -0
  30. data/lib/didww/resources/country.rb +17 -0
  31. data/lib/didww/resources/did.rb +49 -0
  32. data/lib/didww/resources/did_group.rb +66 -0
  33. data/lib/didww/resources/did_group_type.rb +9 -0
  34. data/lib/didww/resources/order.rb +67 -0
  35. data/lib/didww/resources/region.rb +9 -0
  36. data/lib/didww/resources/stock_keeping_unit.rb +19 -0
  37. data/lib/didww/resources/trunk.rb +70 -0
  38. data/lib/didww/resources/trunk/const.rb +61 -0
  39. data/lib/didww/resources/trunk_group.rb +23 -0
  40. data/lib/didww/version.rb +3 -0
  41. metadata +307 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b50d18315fb77b5b7b7972645a2f75eaf305fc6e
4
+ data.tar.gz: ccb2fecdb8bb0ec6b21e9d041639a453a01dfb33
5
+ SHA512:
6
+ metadata.gz: f36cf7c880103909cf816a5a6f7e34df60acbf32dbf9d8b08e5082c96b5c2b2022b8d457e1306facc18837545bc6f4f66e41331f8e72ef2a2a1b49e0d54d329f
7
+ data.tar.gz: ced5fc521ea77758b6767914886d94fccfbaf14c9264c4fe60534e69ea5d71b6d4a8bdd6cdaba86805b89981d7a90d78ee4559209a6280d002671275d5cd3320
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,313 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ DisplayCopNames: true
4
+ DisabledByDefault: true
5
+
6
+ Exclude:
7
+ - db/migrate/**/*
8
+
9
+ Include:
10
+ - "**/*.rake"
11
+ - "**/Gemfile"
12
+ - "**/Rakefile"
13
+
14
+ ##################### Layout ##################################
15
+ Layout/TrailingBlankLines:
16
+ Enabled: true
17
+
18
+ Layout/TrailingWhitespace:
19
+ Enabled: true
20
+
21
+ Layout/SpaceAfterComma:
22
+ Enabled: true
23
+
24
+ Layout/SpaceBeforeBlockBraces:
25
+ Enabled: true
26
+
27
+ Layout/SpaceInsideBlockBraces:
28
+ Enabled: true
29
+
30
+ Layout/SpaceInsideHashLiteralBraces:
31
+ Enabled: true
32
+
33
+ Layout/EmptyLineBetweenDefs:
34
+ Enabled: true
35
+
36
+ Layout/EmptyLines:
37
+ Enabled: true
38
+
39
+ Layout/EmptyLinesAroundAccessModifier:
40
+ Enabled: true
41
+
42
+ Layout/EmptyLinesAroundModuleBody:
43
+ Enabled: true
44
+
45
+ ##################### Style ##################################
46
+ Style/HashSyntax:
47
+ Enabled: true
48
+
49
+ Style/StringLiterals:
50
+ Enabled: true
51
+
52
+ Style/StringLiteralsInInterpolation:
53
+ Enabled: true
54
+
55
+ ##################### Performance ############################
56
+
57
+ # Use `casecmp` rather than `downcase ==`.
58
+ Performance/Casecmp:
59
+ Enabled: true
60
+
61
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of
62
+ # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
63
+ Performance/DoubleStartEndWith:
64
+ Enabled: true
65
+
66
+ # Use `end_with?` instead of a regex match anchored to the end of a string.
67
+ Performance/EndWith:
68
+ Enabled: true
69
+
70
+ # Use `strip` instead of `lstrip.rstrip`.
71
+ Performance/LstripRstrip:
72
+ Enabled: true
73
+
74
+ # Use `Range#cover?` instead of `Range#include?`.
75
+ Performance/RangeInclude:
76
+ Enabled: true
77
+
78
+ # Use `yield` instead of `block.call`.
79
+ Performance/RedundantBlockCall:
80
+ Enabled: true
81
+
82
+ # Use `=~` instead of `String#match` or `Regexp#match` in a context where the
83
+ # returned `MatchData` is not needed.
84
+ Performance/RedundantMatch:
85
+ Enabled: true
86
+
87
+ # Use `Hash#[]=`, rather than `Hash#merge!` with a single key-value pair.
88
+ Performance/RedundantMerge:
89
+ # Max number of key-value pairs to consider an offense
90
+ MaxKeyValuePairs: 2
91
+ Enabled: true
92
+
93
+ # Use `sort` instead of `sort_by { |x| x }`.
94
+ Performance/RedundantSortBy:
95
+ Enabled: true
96
+
97
+ # Use `start_with?` instead of a regex match anchored to the beginning of a
98
+ # string.
99
+ Performance/StartWith:
100
+ Enabled: true
101
+
102
+ # Use `tr` instead of `gsub` when you are replacing the same number of
103
+ # characters. Use `delete` instead of `gsub` when you are deleting
104
+ # characters.
105
+ Performance/StringReplacement:
106
+ Enabled: true
107
+
108
+ # Checks for `.times.map` calls.
109
+ Performance/TimesMap:
110
+ Enabled: true
111
+
112
+ ############################ Security ###############################################
113
+
114
+ # This cop checks for the use of JSON class methods which have potential
115
+ # security issues.
116
+ Security/JSONLoad:
117
+ Enabled: true
118
+
119
+ # This cop checks for the use of *Kernel#eval*.
120
+ Security/Eval:
121
+ Enabled: true
122
+
123
+ ############################ Lint #############################################
124
+
125
+ # Checks for ambiguous operators in the first argument of a method invocation
126
+ # without parentheses.
127
+ Lint/AmbiguousOperator:
128
+ Enabled: true
129
+
130
+ # This cop checks for ambiguous regexp literals in the first argument of
131
+ # a method invocation without parentheses.
132
+ Lint/AmbiguousRegexpLiteral:
133
+ Enabled: true
134
+
135
+ # This cop checks for assignments in the conditions of
136
+ # if/while/until.
137
+ Lint/AssignmentInCondition:
138
+ Enabled: true
139
+
140
+ # Align block ends correctly.
141
+ Lint/BlockAlignment:
142
+ Enabled: true
143
+
144
+ # Default values in optional keyword arguments and optional ordinal arguments
145
+ # should not refer back to the name of the argument.
146
+ Lint/CircularArgumentReference:
147
+ Enabled: true
148
+
149
+ # Checks for condition placed in a confusing position relative to the keyword.
150
+ Lint/ConditionPosition:
151
+ Enabled: true
152
+
153
+ # Check for debugger calls.
154
+ Lint/Debugger:
155
+ Enabled: true
156
+
157
+ # Align ends corresponding to defs correctly.
158
+ Lint/DefEndAlignment:
159
+ Enabled: true
160
+
161
+ # Check for deprecated class method calls.
162
+ Lint/DeprecatedClassMethods:
163
+ Enabled: true
164
+
165
+ # Check for immutable argument given to each_with_object.
166
+ Lint/EachWithObjectArgument:
167
+ Enabled: true
168
+
169
+ # Check for odd code arrangement in an else block.
170
+ Lint/ElseLayout:
171
+ Enabled: false
172
+
173
+ # Checks for empty ensure block.
174
+ Lint/EmptyEnsure:
175
+ Enabled: true
176
+
177
+ # Checks for the presence of `when` branches without a body.
178
+ Lint/EmptyWhen:
179
+ Enabled: true
180
+
181
+ # Align ends correctly.
182
+ Lint/EndAlignment:
183
+ Enabled: true
184
+
185
+ # END blocks should not be placed inside method definitions.
186
+ Lint/EndInMethod:
187
+ Enabled: true
188
+
189
+ # Do not use return in an ensure block.
190
+ Lint/EnsureReturn:
191
+ Enabled: true
192
+
193
+ # Catches floating-point literals too large or small for Ruby to represent.
194
+ Lint/FloatOutOfRange:
195
+ Enabled: true
196
+
197
+ # The number of parameters to format/sprint must match the fields.
198
+ Lint/FormatParameterMismatch:
199
+ Enabled: true
200
+
201
+ # This cop checks for *rescue* blocks with no body.
202
+ Lint/HandleExceptions:
203
+ Enabled: true
204
+
205
+ # Checks for adjacent string literals on the same line, which could better be
206
+ # represented as a single string literal.
207
+ Lint/ImplicitStringConcatenation:
208
+ Enabled: false
209
+
210
+ # Checks for attempts to use `private` or `protected` to set the visibility
211
+ # of a class method, which does not work.
212
+ Lint/IneffectiveAccessModifier:
213
+ Enabled: false
214
+
215
+ # Checks for literals used in interpolation.
216
+ Lint/LiteralInInterpolation:
217
+ Enabled: false
218
+
219
+ # This cop checks for uses of *begin...end while/until something*.
220
+ Lint/Loop:
221
+ Enabled: false
222
+
223
+ # Do not use nested method definitions.
224
+ Lint/NestedMethodDefinition:
225
+ Enabled: false
226
+
227
+ # Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
228
+ Lint/NextWithoutAccumulator:
229
+ Enabled: false
230
+
231
+ # Checks for method calls with a space before the opening parenthesis.
232
+ Lint/ParenthesesAsGroupedExpression:
233
+ Enabled: false
234
+
235
+ # Checks for `rand(1)` calls. Such calls always return `0` and most likely
236
+ # a mistake.
237
+ Lint/RandOne:
238
+ Enabled: false
239
+
240
+ # Use parentheses in the method call to avoid confusion about precedence.
241
+ Lint/RequireParentheses:
242
+ Enabled: false
243
+
244
+ # Avoid rescuing the Exception class.
245
+ Lint/RescueException:
246
+ Enabled: false
247
+
248
+ # Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
249
+ Lint/ShadowedException:
250
+ Enabled: false
251
+
252
+ # This cop looks for use of the same name as outer local variables
253
+ # for block arguments or block local variables.
254
+ Lint/ShadowingOuterLocalVariable:
255
+ Enabled: false
256
+
257
+ # Checks for Object#to_s usage in string interpolation.
258
+ Lint/StringConversionInInterpolation:
259
+ Enabled: false
260
+
261
+ # Do not use prefix `_` for a variable that is used.
262
+ Lint/UnderscorePrefixedVariableName:
263
+ Enabled: false
264
+
265
+ # This cop checks for using Fixnum or Bignum constant
266
+ Lint/UnifiedInteger:
267
+ Enabled: false
268
+
269
+ # Checks for rubocop:disable comments that can be removed.
270
+ # Note: this cop is not disabled when disabling all cops.
271
+ # It must be explicitly disabled.
272
+ Lint/UnneededDisable:
273
+ Enabled: false
274
+
275
+ # This cop checks for unneeded usages of splat expansion
276
+ Lint/UnneededSplatExpansion:
277
+ Enabled: false
278
+
279
+ # Unreachable code.
280
+ Lint/UnreachableCode:
281
+ Enabled: true
282
+
283
+ # This cop checks for unused block arguments.
284
+ Lint/UnusedBlockArgument:
285
+ Enabled: false
286
+
287
+ # This cop checks for unused method arguments.
288
+ Lint/UnusedMethodArgument:
289
+ Enabled: false
290
+
291
+ # Checks for useless access modifiers.
292
+ Lint/UselessAccessModifier:
293
+ Enabled: false
294
+
295
+ # Checks for useless assignment to a local variable.
296
+ Lint/UselessAssignment:
297
+ Enabled: false
298
+
299
+ # Checks for comparison of something with itself.
300
+ Lint/UselessComparison:
301
+ Enabled: false
302
+
303
+ # Checks for useless `else` in `begin..end` without `rescue`.
304
+ Lint/UselessElseWithoutRescue:
305
+ Enabled: false
306
+
307
+ # Checks for useless setter call to a local variable.
308
+ Lint/UselessSetterCall:
309
+ Enabled: false
310
+
311
+ # Possible use of operator/literal/variable in void context.
312
+ Lint/Void:
313
+ Enabled: false
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.2
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in didww-v3.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Alex Korobeinikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ Ruby client for DIDWW API v3.
2
+
3
+ About DIDWW API v3
4
+ -----
5
+
6
+ The DIDWW API provides a simple yet powerful interface that allows you to fully integrate your own applications with DIDWW services. An extensive set of actions may be performed using this API, such as ordering and configuring phone numbers, setting capacity, creating SIP trunks and retrieving CDRs and other operational data. As such, this interface is the ideal tool for building alternative dashboards, developing mobile applications and automating front and back-end applications.
7
+
8
+ The DIDWW API v3 is a fully compliant implementation of the [JSON API specification](http://jsonapi.org/format/).
9
+
10
+ Read more https://doc.didww.com/api
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'didww-v3'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install didww-v3
27
+
28
+ ## Usage
29
+
30
+ ```ruby
31
+ require 'didww'
32
+
33
+ client = DIDWW::Client.configure do |config|
34
+ config.api_key = '34ffe988432b980f4ba19432539b704f'
35
+ config.api_mode = :sandbox
36
+ end
37
+
38
+ client.balance
39
+ ```
40
+
41
+ For details on obtaining your API key please visit https://doc.didww.com/api#introduction-api-keys
42
+
43
+ See integration example at https://github.com/didww/didww-v3-rails-sample
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/didww/didww-v3-ruby.
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -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
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'didww'
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 'http_logger'
11
+ require 'pry'
12
+
13
+ HttpLogger.logger = Logger.new($stdout)
14
+ HttpLogger.log_headers = true
15
+
16
+ Pry.start
17
+
18
+ # require "irb"
19
+ # IRB.start(__FILE__)