tenios 0.1.0
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.
- checksums.yaml +7 -0
- data/.circleci/config.yml +54 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +29 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +58 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/lib/tenios.rb +17 -0
- data/lib/tenios/blocks.rb +23 -0
- data/lib/tenios/blocks/announcement.rb +22 -0
- data/lib/tenios/blocks/bridge.rb +71 -0
- data/lib/tenios/blocks/collect_digits.rb +65 -0
- data/lib/tenios/blocks/collect_speech.rb +36 -0
- data/lib/tenios/blocks/hang_up.rb +86 -0
- data/lib/tenios/blocks/routing_plan.rb +22 -0
- data/lib/tenios/blocks/say.rb +33 -0
- data/lib/tenios/version.rb +5 -0
- data/tenios.gemspec +32 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c8e7bfe618abcacfe8b4c7c3158a42861608204d504717bbd729459e59cbdf8c
|
4
|
+
data.tar.gz: '0906b8bde90001a38566f725b5c2d369f7c073869d6506dc75384ffedc725ccb'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b46601f7e863032c45689ce83d52058fd76a62f89dbc85d208c40441a4028c579d7b2fa4da594c779c4fd52c1b9819594e1f8960ca8bb194c9d1f43c01ccc521
|
7
|
+
data.tar.gz: 409b88413a2759e6525ddd7e70f1f0cafa3348919c80cf8dd51405aa5f25b4876a48d97b6f85295bdf4e7b0770b6dbcff6777e8d1442016ec48d70244e3cc093
|
@@ -0,0 +1,54 @@
|
|
1
|
+
ruby: &ruby
|
2
|
+
image: carwow/ruby-ci:2.5.3
|
3
|
+
|
4
|
+
version: 2
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
bundle:
|
8
|
+
working_directory: ~/tenios-ruby
|
9
|
+
docker:
|
10
|
+
- *ruby
|
11
|
+
steps:
|
12
|
+
- checkout
|
13
|
+
- restore_cache:
|
14
|
+
keys:
|
15
|
+
- bundle-{{ checksum "Gemfile.lock" }}
|
16
|
+
- bundle-
|
17
|
+
- run: |
|
18
|
+
bundle config --local path vendor/bundle &&
|
19
|
+
bundle check || bundle install --jobs=4 --retry=3
|
20
|
+
- save_cache:
|
21
|
+
key: bundle-{{ checksum "Gemfile.lock" }}
|
22
|
+
paths: [~/tenios-ruby/vendor/bundle]
|
23
|
+
- persist_to_workspace:
|
24
|
+
root: '~'
|
25
|
+
paths: [tenios-ruby]
|
26
|
+
|
27
|
+
rubocop:
|
28
|
+
working_directory: ~/tenios-ruby
|
29
|
+
docker:
|
30
|
+
- *ruby
|
31
|
+
steps:
|
32
|
+
- attach_workspace:
|
33
|
+
at: '~'
|
34
|
+
- run: bundle exec rubocop
|
35
|
+
|
36
|
+
tests:
|
37
|
+
working_directory: ~/tenios-ruby
|
38
|
+
docker:
|
39
|
+
- *ruby
|
40
|
+
steps:
|
41
|
+
- attach_workspace:
|
42
|
+
at: '~'
|
43
|
+
- run: |
|
44
|
+
bundle exec rspec
|
45
|
+
|
46
|
+
workflows:
|
47
|
+
version: 2
|
48
|
+
build:
|
49
|
+
jobs:
|
50
|
+
- bundle
|
51
|
+
- rubocop:
|
52
|
+
requires: [bundle]
|
53
|
+
- tests:
|
54
|
+
requires: [bundle]
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-02-11 10:20:16 +0000 using RuboCop version 0.63.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 22
|
12
|
+
|
13
|
+
# Offense count: 3
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
|
+
Max: 10
|
16
|
+
|
17
|
+
# Offense count: 2
|
18
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 13
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Configuration parameters: CountKeywordArgs.
|
24
|
+
Metrics/ParameterLists:
|
25
|
+
Max: 10
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
Metrics/PerceivedComplexity:
|
29
|
+
Max: 10
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tenios (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
carwow_rubocop (2.1.1)
|
11
|
+
rubocop (~> 0.58)
|
12
|
+
rubocop-rspec (~> 1.28)
|
13
|
+
diff-lcs (1.3)
|
14
|
+
jaro_winkler (1.5.2)
|
15
|
+
parallel (1.13.0)
|
16
|
+
parser (2.6.0.0)
|
17
|
+
ast (~> 2.4.0)
|
18
|
+
powerpack (0.1.2)
|
19
|
+
rainbow (3.0.0)
|
20
|
+
rake (10.5.0)
|
21
|
+
rspec (3.8.0)
|
22
|
+
rspec-core (~> 3.8.0)
|
23
|
+
rspec-expectations (~> 3.8.0)
|
24
|
+
rspec-mocks (~> 3.8.0)
|
25
|
+
rspec-core (3.8.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-expectations (3.8.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.8.0)
|
30
|
+
rspec-mocks (3.8.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.8.0)
|
33
|
+
rspec-support (3.8.0)
|
34
|
+
rubocop (0.63.1)
|
35
|
+
jaro_winkler (~> 1.5.1)
|
36
|
+
parallel (~> 1.10)
|
37
|
+
parser (>= 2.5, != 2.5.1.1)
|
38
|
+
powerpack (~> 0.1)
|
39
|
+
rainbow (>= 2.2.2, < 4.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (~> 1.4.0)
|
42
|
+
rubocop-rspec (1.32.0)
|
43
|
+
rubocop (>= 0.60.0)
|
44
|
+
ruby-progressbar (1.10.0)
|
45
|
+
unicode-display_width (1.4.1)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
bundler (~> 2.0)
|
52
|
+
carwow_rubocop
|
53
|
+
rake
|
54
|
+
rspec
|
55
|
+
tenios!
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Christian Gregg
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Tenios
|
2
|
+
|
3
|
+
TODO: Delete this and the text above, and describe your gem
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'tenios'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install tenios
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
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.
|
28
|
+
|
29
|
+
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).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/carwow/tenios-ruby.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/tenios.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
%w[
|
4
|
+
tenios/version
|
5
|
+
tenios/blocks
|
6
|
+
tenios/blocks/announcement
|
7
|
+
tenios/blocks/bridge
|
8
|
+
tenios/blocks/collect_digits
|
9
|
+
tenios/blocks/collect_speech
|
10
|
+
tenios/blocks/hang_up
|
11
|
+
tenios/blocks/routing_plan
|
12
|
+
tenios/blocks/say
|
13
|
+
].each { |f| require f }
|
14
|
+
|
15
|
+
module Tenios
|
16
|
+
class Error < StandardError; end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
def initialize
|
6
|
+
@blocks = []
|
7
|
+
|
8
|
+
yield(self) if block_given?
|
9
|
+
end
|
10
|
+
|
11
|
+
def add(block)
|
12
|
+
@blocks << block
|
13
|
+
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def as_json(*)
|
18
|
+
{
|
19
|
+
blocks: @blocks.map(&:as_json)
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class Announcement
|
6
|
+
BLOCK_TYPE = 'ANNOUNCEMENT'
|
7
|
+
|
8
|
+
def initialize(announcement:, standard: false)
|
9
|
+
@announcement = announcement
|
10
|
+
@standard = !!standard
|
11
|
+
end
|
12
|
+
|
13
|
+
def as_json(*)
|
14
|
+
{
|
15
|
+
blockType: BLOCK_TYPE,
|
16
|
+
standardAnnouncement: @standard,
|
17
|
+
announcementName: @announcement
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class Bridge
|
6
|
+
BLOCK_TYPE = 'BRIDGE'
|
7
|
+
SEQUENTIAL = 'SEQUENTIAL'
|
8
|
+
PARALLEL = 'PARALLEL'
|
9
|
+
EXTERNAL_NUMBER = 'EXTERNALNUMBER'
|
10
|
+
SIP_USER = 'SIP_USER'
|
11
|
+
SIP_TRUNK = 'SIP_TRUNK'
|
12
|
+
|
13
|
+
BRIDGE_MODES = [
|
14
|
+
SEQUENTIAL,
|
15
|
+
PARALLEL
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
DESTINATION_TYPES = [
|
19
|
+
EXTERNAL_NUMBER,
|
20
|
+
SIP_USER,
|
21
|
+
SIP_TRUNK
|
22
|
+
].freeze
|
23
|
+
|
24
|
+
def initialize(mode:, timeout: nil)
|
25
|
+
@mode = mode
|
26
|
+
@timeout = timeout
|
27
|
+
@destinations = []
|
28
|
+
|
29
|
+
raise "mode must be one of #{BRIDGE_MODES}" unless BRIDGE_MODES.include?(@mode)
|
30
|
+
raise 'timeout is required' if parallel? && @timeout.nil?
|
31
|
+
raise 'timeout is not accepted in this mode' if sequential? && !@timeout.nil?
|
32
|
+
|
33
|
+
yield(self) if block_given?
|
34
|
+
end
|
35
|
+
|
36
|
+
def with_destination(destination_type, destination, timeout = nil)
|
37
|
+
raise 'timeout is required' if sequential? && timeout.nil?
|
38
|
+
raise 'timeout is not accepted' if parallel? && !timeout.nil?
|
39
|
+
raise "destination_type must be one of #{DESTINATION_TYPES}" unless DESTINATION_TYPES.include?(destination_type)
|
40
|
+
raise 'destination is required' if destination.strip.empty?
|
41
|
+
|
42
|
+
@destinations << {
|
43
|
+
destinationType: destination_type,
|
44
|
+
destination: destination.strip,
|
45
|
+
timeout: timeout
|
46
|
+
}.compact
|
47
|
+
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def as_json(*)
|
52
|
+
raise 'no destinations' if @destinations.empty?
|
53
|
+
|
54
|
+
{
|
55
|
+
blockType: BLOCK_TYPE,
|
56
|
+
blockTimeout: @timeout,
|
57
|
+
bridgeMode: @mode,
|
58
|
+
destinations: @destinations
|
59
|
+
}.compact
|
60
|
+
end
|
61
|
+
|
62
|
+
def sequential?
|
63
|
+
@mode == SEQUENTIAL
|
64
|
+
end
|
65
|
+
|
66
|
+
def parallel?
|
67
|
+
@mode == PARALLEL
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class CollectDigits
|
6
|
+
BLOCK_TYPE = 'COLLECT_DIGITS'
|
7
|
+
VARIABLE_REGEX = /^[a-z0-9_]+$/.freeze
|
8
|
+
TERMINATORS = %w[# *].freeze
|
9
|
+
|
10
|
+
def initialize(
|
11
|
+
announcement:,
|
12
|
+
standard_announcement:,
|
13
|
+
error_announcement:,
|
14
|
+
standard_error_announcement:,
|
15
|
+
variable:,
|
16
|
+
min_digits:,
|
17
|
+
max_digits:,
|
18
|
+
terminator:,
|
19
|
+
max_tries:,
|
20
|
+
timeout:
|
21
|
+
)
|
22
|
+
@announcement = announcement
|
23
|
+
@standard_announcement = !!standard_announcement
|
24
|
+
@error_announcement = error_announcement
|
25
|
+
@standard_error_announcement = !!standard_error_announcement
|
26
|
+
@variable = variable
|
27
|
+
@min_digits = min_digits
|
28
|
+
@max_digits = max_digits
|
29
|
+
@terminator = terminator
|
30
|
+
@max_tries = max_tries
|
31
|
+
@timeout = timeout
|
32
|
+
|
33
|
+
validate!
|
34
|
+
end
|
35
|
+
|
36
|
+
def as_json(*)
|
37
|
+
{
|
38
|
+
blockType: BLOCK_TYPE,
|
39
|
+
standardAnnouncement: @standard_announcement,
|
40
|
+
announcementName: @announcement,
|
41
|
+
standardErrorAnnouncement: @standard_error_announcement,
|
42
|
+
errorAnnouncementName: @error_announcement,
|
43
|
+
variableName: @variable,
|
44
|
+
minDigits: @min_digits,
|
45
|
+
maxDigits: @max_digits,
|
46
|
+
terminator: @terminator,
|
47
|
+
timeout: @timeout,
|
48
|
+
maxTries: @max_tries
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def validate!
|
53
|
+
raise 'min_digits must be between 1-32 (inclusive)' unless (1..32).cover?(@min_digits)
|
54
|
+
raise 'max_digits must be between 1-32 (inclusive)' unless (1..32).cover?(@max_digits)
|
55
|
+
raise 'min_digits must be less than or equal to max_digits' unless @min_digits <= @max_digits
|
56
|
+
raise "terminator must be one of #{TERMINATORS}" unless TERMINATORS.include?(@terminator)
|
57
|
+
raise "variable must match #{VARIABLE_REGEX.inspect}" unless @variable.match?(VARIABLE_REGEX)
|
58
|
+
raise 'max_tries must be between 1-10 (inclusive)' unless (1..10).cover?(@max_tries)
|
59
|
+
raise 'timeout must be between 0-300 (inclusive)' unless (1..300).cover?(@timeout)
|
60
|
+
raise 'announcement is required' if @announcement.nil?
|
61
|
+
raise 'error_announcement is required' if @error_announcement.nil?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class CollectSpeech
|
6
|
+
BLOCK_TYPE = 'COLLECT_SPEECH'
|
7
|
+
|
8
|
+
def initialize(
|
9
|
+
announcement:,
|
10
|
+
missing_input_announcement:,
|
11
|
+
language:,
|
12
|
+
variable:,
|
13
|
+
max_tries:
|
14
|
+
)
|
15
|
+
@announcement = announcement
|
16
|
+
@missing_input_announcement = missing_input_announcement
|
17
|
+
@language = language
|
18
|
+
@variable = variable
|
19
|
+
@max_tries = max_tries
|
20
|
+
end
|
21
|
+
|
22
|
+
def as_json
|
23
|
+
{
|
24
|
+
blockType: BLOCK_TYPE,
|
25
|
+
standardAnnouncement: false,
|
26
|
+
announcementName: @announcement,
|
27
|
+
standardMissingInputAnnouncement: false,
|
28
|
+
missingInputAnnouncementName: @missing_input_announcement,
|
29
|
+
language: @language,
|
30
|
+
variableName: @variable,
|
31
|
+
maxTries: @max_tries
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class HangUp
|
6
|
+
BLOCK_TYPE = 'HANGUP'
|
7
|
+
|
8
|
+
UNALLOCATED_NUMBER = 'UNALLOCATED_NUMBER'
|
9
|
+
NO_ROUTE_TRANSIT_NET = 'NO_ROUTE_TRANSIT_NET'
|
10
|
+
NO_ROUTE_DESTINATION = 'NO_ROUTE_DESTINATION'
|
11
|
+
USER_BUSY = 'USER_BUSY'
|
12
|
+
NO_USER_RESPONSE = 'NO_USER_RESPONSE'
|
13
|
+
NO_ANSWER = 'NO_ANSWER'
|
14
|
+
SUBSCRIBER_ABSENT = 'SUBSCRIBER_ABSENT'
|
15
|
+
CALL_REJECTED = 'CALL_REJECTED'
|
16
|
+
NUMBER_CHANGED = 'NUMBER_CHANGED'
|
17
|
+
REDIRECTION_TO_NEW_DESTINATION = 'REDIRECTION_TO_NEW_DESTINATION'
|
18
|
+
EXCHANGE_ROUTING_ERROR = 'EXCHANGE_ROUTING_ERROR'
|
19
|
+
DESTINATION_OUT_OF_ORDER = 'DESTINATION_OUT_OF_ORDER'
|
20
|
+
INVALID_NUMBER_FORMAT = 'INVALID_NUMBER_FORMAT'
|
21
|
+
FACILITY_REJECTED = 'FACILITY_REJECTED'
|
22
|
+
NORMAL_UNSPECIFIED = 'NORMAL_UNSPECIFIED'
|
23
|
+
NORMAL_CIRCUIT_CONGESTION = 'NORMAL_CIRCUIT_CONGESTION'
|
24
|
+
NETWORK_OUT_OF_ORDER = 'NETWORK_OUT_OF_ORDER'
|
25
|
+
NORMAL_TEMPORARY_FAILURE = 'NORMAL_TEMPORARY_FAILURE'
|
26
|
+
SWITCH_CONGESTION = 'SWITCH_CONGESTION'
|
27
|
+
REQUESTED_CHAN_UNAVAIL = 'REQUESTED_CHAN_UNAVAIL'
|
28
|
+
OUTGOING_CALL_BARRED = 'OUTGOING_CALL_BARRED'
|
29
|
+
INCOMING_CALL_BARRED = 'INCOMING_CALL_BARRED'
|
30
|
+
BEARERCAPABILITY_NOTAUTH = 'BEARERCAPABILITY_NOTAUTH'
|
31
|
+
BEARERCAPABILITY_NOTAVAIL = 'BEARERCAPABILITY_NOTAVAIL'
|
32
|
+
BEARERCAPABILITY_NOTIMPL = 'BEARERCAPABILITY_NOTIMPL'
|
33
|
+
FACILITY_NOT_IMPLEMENTED = 'FACILITY_NOT_IMPLEMENTED'
|
34
|
+
SERVICE_NOT_IMPLEMENTED = 'SERVICE_NOT_IMPLEMENTED'
|
35
|
+
INCOMPATIBLE_DESTINATION = 'INCOMPATIBLE_DESTINATION'
|
36
|
+
RECOVERY_ON_TIMER_EXPIRE = 'RECOVERY_ON_TIMER_EXPIRE'
|
37
|
+
ORIGINATOR_CANCEL = 'ORIGINATOR_CANCEL'
|
38
|
+
|
39
|
+
CAUSES = [
|
40
|
+
UNALLOCATED_NUMBER,
|
41
|
+
NO_ROUTE_TRANSIT_NET,
|
42
|
+
NO_ROUTE_DESTINATION,
|
43
|
+
USER_BUSY,
|
44
|
+
NO_USER_RESPONSE,
|
45
|
+
NO_ANSWER,
|
46
|
+
SUBSCRIBER_ABSENT,
|
47
|
+
CALL_REJECTED,
|
48
|
+
NUMBER_CHANGED,
|
49
|
+
REDIRECTION_TO_NEW_DESTINATION,
|
50
|
+
EXCHANGE_ROUTING_ERROR,
|
51
|
+
DESTINATION_OUT_OF_ORDER,
|
52
|
+
INVALID_NUMBER_FORMAT,
|
53
|
+
FACILITY_REJECTED,
|
54
|
+
NORMAL_UNSPECIFIED,
|
55
|
+
NORMAL_CIRCUIT_CONGESTION,
|
56
|
+
NETWORK_OUT_OF_ORDER,
|
57
|
+
NORMAL_TEMPORARY_FAILURE,
|
58
|
+
SWITCH_CONGESTION,
|
59
|
+
REQUESTED_CHAN_UNAVAIL,
|
60
|
+
OUTGOING_CALL_BARRED,
|
61
|
+
INCOMING_CALL_BARRED,
|
62
|
+
BEARERCAPABILITY_NOTAUTH,
|
63
|
+
BEARERCAPABILITY_NOTAVAIL,
|
64
|
+
BEARERCAPABILITY_NOTIMPL,
|
65
|
+
FACILITY_NOT_IMPLEMENTED,
|
66
|
+
SERVICE_NOT_IMPLEMENTED,
|
67
|
+
INCOMPATIBLE_DESTINATION,
|
68
|
+
RECOVERY_ON_TIMER_EXPIRE,
|
69
|
+
ORIGINATOR_CANCEL
|
70
|
+
].freeze
|
71
|
+
|
72
|
+
def initialize(cause:)
|
73
|
+
raise "cause must be one of #{CAUSES}" unless CAUSES.include?(cause)
|
74
|
+
|
75
|
+
@cause = cause
|
76
|
+
end
|
77
|
+
|
78
|
+
def as_json(*)
|
79
|
+
{
|
80
|
+
blockType: BLOCK_TYPE,
|
81
|
+
hangupCause: @cause
|
82
|
+
}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class RoutingPlan
|
6
|
+
BLOCK_TYPE = 'ROUTINGPLAN'
|
7
|
+
|
8
|
+
def initialize(routing_plan:)
|
9
|
+
raise 'routing_plan is required' if routing_plan.nil?
|
10
|
+
|
11
|
+
@routing_plan = routing_plan
|
12
|
+
end
|
13
|
+
|
14
|
+
def as_json(*)
|
15
|
+
{
|
16
|
+
blockType: BLOCK_TYPE,
|
17
|
+
routingplanName: @routing_plan
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tenios
|
4
|
+
class Blocks
|
5
|
+
class Say
|
6
|
+
BLOCK_TYPE = 'SAY'
|
7
|
+
|
8
|
+
def initialize(text:, voice:, ssml:)
|
9
|
+
@text = text
|
10
|
+
@voice = voice
|
11
|
+
@ssml = !!ssml
|
12
|
+
|
13
|
+
validate!
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_json
|
17
|
+
{
|
18
|
+
blockType: BLOCK_TYPE,
|
19
|
+
text: @text,
|
20
|
+
voiceName: @voice,
|
21
|
+
useSsml: @ssml
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
raise 'text is required' if @text.nil?
|
29
|
+
raise 'voice is required' if @voice.nil?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/tenios.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tenios/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'tenios'
|
9
|
+
spec.version = Tenios::VERSION
|
10
|
+
spec.authors = ['carwow Developers']
|
11
|
+
spec.email = ['developers@carwow.co.uk']
|
12
|
+
spec.summary = 'A ruby wrapper for Tenios Call Control API'
|
13
|
+
spec.homepage = 'https://github.com/carwow/tenios-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
if spec.respond_to?(:metadata)
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
else
|
19
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
20
|
+
'public gem pushes.'
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
29
|
+
spec.add_development_dependency 'carwow_rubocop'
|
30
|
+
spec.add_development_dependency 'rake'
|
31
|
+
spec.add_development_dependency 'rspec'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tenios
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- carwow Developers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carwow_rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- developers@carwow.co.uk
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".circleci/config.yml"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".rubocop.yml"
|
80
|
+
- ".rubocop_todo.yml"
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- lib/tenios.rb
|
87
|
+
- lib/tenios/blocks.rb
|
88
|
+
- lib/tenios/blocks/announcement.rb
|
89
|
+
- lib/tenios/blocks/bridge.rb
|
90
|
+
- lib/tenios/blocks/collect_digits.rb
|
91
|
+
- lib/tenios/blocks/collect_speech.rb
|
92
|
+
- lib/tenios/blocks/hang_up.rb
|
93
|
+
- lib/tenios/blocks/routing_plan.rb
|
94
|
+
- lib/tenios/blocks/say.rb
|
95
|
+
- lib/tenios/version.rb
|
96
|
+
- tenios.gemspec
|
97
|
+
homepage: https://github.com/carwow/tenios-ruby
|
98
|
+
licenses:
|
99
|
+
- MIT
|
100
|
+
metadata:
|
101
|
+
allowed_push_host: https://rubygems.org
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 2.7.6
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: A ruby wrapper for Tenios Call Control API
|
122
|
+
test_files: []
|