didww-v3 1.0.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/tests.yml +23 -0
- data/.rubocop.yml +19 -19
- data/CHANGELOG.md +35 -0
- data/Gemfile +19 -0
- data/README.md +3 -1
- data/Rakefile +5 -1
- data/didww-v3.gemspec +1 -18
- data/lib/didww/client.rb +40 -4
- data/lib/didww/complex_objects/base.rb +8 -6
- data/lib/didww/complex_objects/capacity_order_item.rb +16 -0
- data/lib/didww/complex_objects/configurations/sip_configuration.rb +10 -0
- data/lib/didww/complex_objects/did_order_item.rb +12 -5
- data/lib/didww/middleware.rb +1 -0
- data/lib/didww/resources/available_did.rb +12 -0
- data/lib/didww/resources/capacity_pool.rb +46 -0
- data/lib/didww/resources/did.rb +6 -0
- data/lib/didww/resources/did_group.rb +4 -0
- data/lib/didww/resources/did_reservation.rb +16 -0
- data/lib/didww/resources/order.rb +1 -0
- data/lib/didww/resources/pop.rb +9 -0
- data/lib/didww/resources/qty_based_pricing.rb +19 -0
- data/lib/didww/resources/shared_capacity_group.rb +26 -0
- data/lib/didww/resources/trunk/const.rb +0 -15
- data/lib/didww/resources/trunk.rb +1 -4
- data/lib/didww/version.rb +1 -1
- metadata +16 -163
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 67435ef42f0af2a8862a0951069af3d7a4ce4b3afedfeef02c89203fef215645
|
4
|
+
data.tar.gz: f5bcb5ea9069ef3b10a1ac6c9b714d315e3b0f55d80fc132e22e21cc076a24ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 843ef3ddb29b72b09a7ef3b586169fe2f481463a0de49a8361642ff20c31973dee901f0c0d4f21bfa0c6aff60df2243e0e9e2e22b1e123168775bea200ecd6f0
|
7
|
+
data.tar.gz: 842db8a8747dcfe7aa79fb363d45022d31a407ef2321e2599b770b7294c9eba890b4f1858a35735f77512d639a58948db44d25afddc69cfcad50f26f581820ec
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Tests
|
2
|
+
on: [ 'pull_request' ]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
strategy:
|
8
|
+
matrix:
|
9
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
10
|
+
rails: [ '~> 5.0', '~> 6.0' ]
|
11
|
+
name: Tests with Ruby ${{ matrix.ruby }} Activesupport ${{ matrix.rails }}
|
12
|
+
env:
|
13
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- name: Run tests
|
20
|
+
run: |
|
21
|
+
gem install bundler -v 2.2.7
|
22
|
+
bundle install
|
23
|
+
bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-rspec
|
5
|
+
|
1
6
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.5
|
3
8
|
DisplayCopNames: true
|
4
9
|
DisabledByDefault: true
|
5
10
|
|
6
11
|
Exclude:
|
7
12
|
- db/migrate/**/*
|
8
13
|
|
9
|
-
Include:
|
10
|
-
- "**/*.rake"
|
11
|
-
- "**/Gemfile"
|
12
|
-
- "**/Rakefile"
|
13
|
-
|
14
14
|
##################### Layout ##################################
|
15
|
-
Layout/
|
15
|
+
Layout/TrailingEmptyLines:
|
16
16
|
Enabled: true
|
17
17
|
|
18
18
|
Layout/TrailingWhitespace:
|
@@ -68,7 +68,7 @@ Performance/EndWith:
|
|
68
68
|
Enabled: true
|
69
69
|
|
70
70
|
# Use `strip` instead of `lstrip.rstrip`.
|
71
|
-
|
71
|
+
Style/Strip:
|
72
72
|
Enabled: true
|
73
73
|
|
74
74
|
# Use `Range#cover?` instead of `Range#include?`.
|
@@ -91,7 +91,7 @@ Performance/RedundantMerge:
|
|
91
91
|
Enabled: true
|
92
92
|
|
93
93
|
# Use `sort` instead of `sort_by { |x| x }`.
|
94
|
-
|
94
|
+
Style/RedundantSortBy:
|
95
95
|
Enabled: true
|
96
96
|
|
97
97
|
# Use `start_with?` instead of a regex match anchored to the beginning of a
|
@@ -138,7 +138,7 @@ Lint/AssignmentInCondition:
|
|
138
138
|
Enabled: true
|
139
139
|
|
140
140
|
# Align block ends correctly.
|
141
|
-
|
141
|
+
Layout/BlockAlignment:
|
142
142
|
Enabled: true
|
143
143
|
|
144
144
|
# Default values in optional keyword arguments and optional ordinal arguments
|
@@ -147,7 +147,7 @@ Lint/CircularArgumentReference:
|
|
147
147
|
Enabled: true
|
148
148
|
|
149
149
|
# Checks for condition placed in a confusing position relative to the keyword.
|
150
|
-
|
150
|
+
Layout/ConditionPosition:
|
151
151
|
Enabled: true
|
152
152
|
|
153
153
|
# Check for debugger calls.
|
@@ -155,7 +155,7 @@ Lint/Debugger:
|
|
155
155
|
Enabled: true
|
156
156
|
|
157
157
|
# Align ends corresponding to defs correctly.
|
158
|
-
|
158
|
+
Layout/DefEndAlignment:
|
159
159
|
Enabled: true
|
160
160
|
|
161
161
|
# Check for deprecated class method calls.
|
@@ -179,11 +179,11 @@ Lint/EmptyWhen:
|
|
179
179
|
Enabled: true
|
180
180
|
|
181
181
|
# Align ends correctly.
|
182
|
-
|
182
|
+
Layout/EndAlignment:
|
183
183
|
Enabled: true
|
184
184
|
|
185
185
|
# END blocks should not be placed inside method definitions.
|
186
|
-
|
186
|
+
Style/EndBlock:
|
187
187
|
Enabled: true
|
188
188
|
|
189
189
|
# Do not use return in an ensure block.
|
@@ -199,7 +199,7 @@ Lint/FormatParameterMismatch:
|
|
199
199
|
Enabled: true
|
200
200
|
|
201
201
|
# This cop checks for *rescue* blocks with no body.
|
202
|
-
Lint/
|
202
|
+
Lint/SuppressedException:
|
203
203
|
Enabled: true
|
204
204
|
|
205
205
|
# Checks for adjacent string literals on the same line, which could better be
|
@@ -255,7 +255,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
255
255
|
Enabled: false
|
256
256
|
|
257
257
|
# Checks for Object#to_s usage in string interpolation.
|
258
|
-
Lint/
|
258
|
+
Lint/RedundantStringCoercion:
|
259
259
|
Enabled: false
|
260
260
|
|
261
261
|
# Do not use prefix `_` for a variable that is used.
|
@@ -269,11 +269,11 @@ Lint/UnifiedInteger:
|
|
269
269
|
# Checks for rubocop:disable comments that can be removed.
|
270
270
|
# Note: this cop is not disabled when disabling all cops.
|
271
271
|
# It must be explicitly disabled.
|
272
|
-
Lint/
|
272
|
+
Lint/RedundantCopDisableDirective:
|
273
273
|
Enabled: false
|
274
274
|
|
275
275
|
# This cop checks for unneeded usages of splat expansion
|
276
|
-
Lint/
|
276
|
+
Lint/RedundantSplatExpansion:
|
277
277
|
Enabled: false
|
278
278
|
|
279
279
|
# Unreachable code.
|
@@ -297,7 +297,7 @@ Lint/UselessAssignment:
|
|
297
297
|
Enabled: false
|
298
298
|
|
299
299
|
# Checks for comparison of something with itself.
|
300
|
-
Lint/
|
300
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
301
301
|
Enabled: false
|
302
302
|
|
303
303
|
# Checks for useless `else` in `begin..end` without `rescue`.
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [1.3.1] - 2021-10-26
|
8
|
+
### Changes
|
9
|
+
- replace travis with github actions [#7](https://github.com/didww/didww-v3-ruby/pull/7) [#9](https://github.com/didww/didww-v3-ruby/pull/9)
|
10
|
+
- use rubocop 1.9.X version [#7](https://github.com/didww/didww-v3-ruby/pull/7)
|
11
|
+
- add bundle-audit [#7](https://github.com/didww/didww-v3-ruby/pull/7)
|
12
|
+
|
13
|
+
### Bugfixes
|
14
|
+
- fix order purchase when activesupport 6.X.X is used.
|
15
|
+
- fix BigDecimal 2 support for ruby 2.7+.
|
16
|
+
|
17
|
+
## [1.3.0] - 2018-09-03
|
18
|
+
### Changes
|
19
|
+
- Add Capacity Pool and Shared Capacity Group resources
|
20
|
+
- Add Capacity Pool and Shared Capacity Group relationships to DID
|
21
|
+
- Add Quantity based pricings and Capacity type Order Item
|
22
|
+
|
23
|
+
## [1.2.0] - 2018-04-25
|
24
|
+
### Changes
|
25
|
+
- add number selection feature
|
26
|
+
|
27
|
+
## [1.1.0] - 2018-03-05
|
28
|
+
### Changes
|
29
|
+
- add Pop resource
|
30
|
+
- Remove old trunk.preferred_server property
|
31
|
+
- Add max_transfers and max_30x_redirects to sip_configurations
|
32
|
+
- Added custom user-agent header
|
33
|
+
|
34
|
+
## [1.0.0] - 2017-12-05
|
35
|
+
- initial release
|
data/Gemfile
CHANGED
@@ -4,3 +4,22 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in didww-v3.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
if ENV['RAILS_VERSION']
|
9
|
+
gem 'activesupport', ENV['RAILS_VERSION'], require: false
|
10
|
+
end
|
11
|
+
|
12
|
+
gem 'rake', '~> 12.0'
|
13
|
+
gem 'rspec', '~> 3.0'
|
14
|
+
gem 'pry'
|
15
|
+
gem 'byebug'
|
16
|
+
gem 'awesome_print'
|
17
|
+
gem 'http_logger'
|
18
|
+
gem 'rubocop', '~> 1.9'
|
19
|
+
gem 'rubocop-performance'
|
20
|
+
gem 'rubocop-rake'
|
21
|
+
gem 'rubocop-rspec'
|
22
|
+
gem 'simplecov'
|
23
|
+
gem 'smart_rspec'
|
24
|
+
gem 'webmock'
|
25
|
+
gem 'bundler-audit'
|
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
Ruby client for DIDWW API v3.
|
2
2
|
|
3
|
+
[![Build Status](https://github.com/didww/didww-v3-ruby/workflows/tests/badge.svg?branch=master)](https://github.com/didww/didww-v3-ruby/actions)
|
4
|
+
|
3
5
|
About DIDWW API v3
|
4
6
|
-----
|
5
7
|
|
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.
|
8
|
+
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.
|
7
9
|
|
8
10
|
The DIDWW API v3 is a fully compliant implementation of the [JSON API specification](http://jsonapi.org/format/).
|
9
11
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
+
require 'bundler/audit/task'
|
4
|
+
require 'rubocop/rake_task'
|
3
5
|
|
4
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
Bundler::Audit::Task.new
|
8
|
+
RuboCop::RakeTask.new
|
5
9
|
|
6
|
-
task default: :spec
|
10
|
+
task default: ['bundle:audit', :rubocop, :spec]
|
data/didww-v3.gemspec
CHANGED
@@ -21,26 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
25
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
|
28
|
-
# development
|
29
|
-
spec.add_development_dependency 'pry'
|
30
|
-
spec.add_development_dependency 'byebug'
|
31
|
-
spec.add_development_dependency 'awesome_print'
|
32
|
-
spec.add_development_dependency 'http_logger'
|
33
|
-
spec.add_development_dependency 'rubocop'
|
34
|
-
|
35
|
-
# test
|
36
|
-
spec.add_development_dependency 'simplecov'
|
37
|
-
spec.add_development_dependency 'smart_rspec'
|
38
|
-
spec.add_development_dependency 'webmock'
|
39
|
-
|
40
24
|
spec.add_dependency 'activesupport'
|
41
25
|
spec.add_dependency 'faraday'
|
42
|
-
spec.add_dependency 'json_api_client'
|
26
|
+
spec.add_dependency 'json_api_client', '1.5.3'
|
43
27
|
spec.add_dependency 'http'
|
44
28
|
spec.add_dependency 'down'
|
45
|
-
|
46
29
|
end
|
data/lib/didww/client.rb
CHANGED
@@ -3,6 +3,16 @@ require 'json_api_client'
|
|
3
3
|
|
4
4
|
require 'didww/resources/base'
|
5
5
|
|
6
|
+
# Fixes BigDecimal 2 support for ruby 2.7+ without introducing json_api_client breaking changes.
|
7
|
+
# https://github.com/JsonApiClient/json_api_client/commit/ac372b8bab3b71bb0aa5c4dcc6ced1d9c3fe8d14
|
8
|
+
class JsonApiClient::Schema::Types::FixedDecimal
|
9
|
+
def self.cast(value, _)
|
10
|
+
BigDecimal(value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
JsonApiClient::Schema.register decimal: JsonApiClient::Schema::Types::FixedDecimal
|
15
|
+
|
6
16
|
module DIDWW
|
7
17
|
module Client
|
8
18
|
BASE_URLS = {
|
@@ -37,6 +47,18 @@ module DIDWW
|
|
37
47
|
Resource::Balance.all.first
|
38
48
|
end
|
39
49
|
|
50
|
+
def capacity_pools
|
51
|
+
Resource::CapacityPool
|
52
|
+
end
|
53
|
+
|
54
|
+
def cdr_exports
|
55
|
+
Resource::CdrExport
|
56
|
+
end
|
57
|
+
|
58
|
+
def shared_capacity_groups
|
59
|
+
Resource::SharedCapacityGroup
|
60
|
+
end
|
61
|
+
|
40
62
|
def cities
|
41
63
|
Resource::City
|
42
64
|
end
|
@@ -61,6 +83,10 @@ module DIDWW
|
|
61
83
|
Resource::Order
|
62
84
|
end
|
63
85
|
|
86
|
+
def pops
|
87
|
+
Resource::Pop
|
88
|
+
end
|
89
|
+
|
64
90
|
def regions
|
65
91
|
Resource::Region
|
66
92
|
end
|
@@ -73,8 +99,12 @@ module DIDWW
|
|
73
99
|
Resource::Trunk
|
74
100
|
end
|
75
101
|
|
76
|
-
def
|
77
|
-
Resource::
|
102
|
+
def available_dids
|
103
|
+
Resource::AvailableDid
|
104
|
+
end
|
105
|
+
|
106
|
+
def did_reservations
|
107
|
+
Resource::DidReservation
|
78
108
|
end
|
79
109
|
|
80
110
|
def api_mode=(arg)
|
@@ -102,17 +132,23 @@ module DIDWW
|
|
102
132
|
|
103
133
|
def require_didww_resources
|
104
134
|
require 'didww/resources/balance'
|
135
|
+
require 'didww/resources/capacity_pool'
|
136
|
+
require 'didww/resources/cdr_export'
|
137
|
+
require 'didww/resources/shared_capacity_group'
|
105
138
|
require 'didww/resources/city'
|
106
139
|
require 'didww/resources/country'
|
107
140
|
require 'didww/resources/did_group_type'
|
108
141
|
require 'didww/resources/did_group'
|
109
142
|
require 'didww/resources/did'
|
110
143
|
require 'didww/resources/order'
|
144
|
+
require 'didww/resources/pop'
|
145
|
+
require 'didww/resources/qty_based_pricing'
|
111
146
|
require 'didww/resources/region'
|
147
|
+
require 'didww/resources/stock_keeping_unit'
|
112
148
|
require 'didww/resources/trunk_group'
|
113
149
|
require 'didww/resources/trunk'
|
114
|
-
require 'didww/resources/
|
115
|
-
require 'didww/resources/
|
150
|
+
require 'didww/resources/available_did'
|
151
|
+
require 'didww/resources/did_reservation'
|
116
152
|
end
|
117
153
|
|
118
154
|
end
|
@@ -12,10 +12,8 @@ module DIDWW
|
|
12
12
|
|
13
13
|
def property(name, options = {})
|
14
14
|
property = schema.add(name, options)
|
15
|
-
define_method(name) {
|
16
|
-
define_method("#{name}=".to_sym)
|
17
|
-
attributes[name] = property.cast(val)
|
18
|
-
end
|
15
|
+
define_method(name.to_sym) { self[name] }
|
16
|
+
define_method("#{name}=".to_sym) { |val| self[name] = val }
|
19
17
|
end
|
20
18
|
|
21
19
|
def schema
|
@@ -46,7 +44,10 @@ module DIDWW
|
|
46
44
|
|
47
45
|
# Returns a ComplexObject class if given JSON API type matches any
|
48
46
|
def class_for_type(type)
|
49
|
-
|
47
|
+
# activesupport 6 has breaking change - parent* methods renamed to module_parent*.
|
48
|
+
# see https://github.com/rails/rails/pull/34051
|
49
|
+
name = respond_to?(:module_parent_name) ? module_parent_name : parent_name
|
50
|
+
"#{name}::#{type.classify}".safe_constantize
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -70,7 +71,8 @@ module DIDWW
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def []=(key, value)
|
73
|
-
|
74
|
+
property = self.class.schema.find(key)
|
75
|
+
attributes[key] = property ? property.cast(value) : value
|
74
76
|
end
|
75
77
|
|
76
78
|
# When we represent this resource for serialization (create/update), we do so
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DIDWW
|
2
|
+
module ComplexObject
|
3
|
+
class CapacityOrderItem < Base
|
4
|
+
# passed at order creation
|
5
|
+
property :qty, type: :int
|
6
|
+
property :capacity_pool_id, type: :string
|
7
|
+
|
8
|
+
# returned
|
9
|
+
property :nrc, type: :decimal
|
10
|
+
property :mrc, type: :decimal
|
11
|
+
property :propated_mrc, type: :boolean
|
12
|
+
property :billed_from, type: :string
|
13
|
+
property :billed_to, type: :string
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -149,6 +149,14 @@ module DIDWW
|
|
149
149
|
# Nullable: No
|
150
150
|
# Description: The transport layer that will be responsible for the actual transmission of SIP requests and responses (1 - UDP, 2 - TCP)
|
151
151
|
|
152
|
+
property :max_transfers, type: :integer
|
153
|
+
# Nullable: No
|
154
|
+
# Description: Max count of the REFER requests
|
155
|
+
|
156
|
+
property :max_30x_redirects, type: :integer
|
157
|
+
# Nullable: No
|
158
|
+
# Description: Max count of 301/302 redirects
|
159
|
+
|
152
160
|
DEFAULTS = {
|
153
161
|
username: DID_PLACEHOLDER,
|
154
162
|
port: '5060',
|
@@ -161,6 +169,8 @@ module DIDWW
|
|
161
169
|
dns_srv_failover_timer: 2000,
|
162
170
|
rtp_timeout: 30,
|
163
171
|
auth_enabled: false,
|
172
|
+
max_transfers: 0,
|
173
|
+
max_30x_redirects: 0,
|
164
174
|
codec_ids: DEFAULT_CODEC_IDS,
|
165
175
|
rerouting_disconnect_code_ids: DEFAULT_REROUTING_DISCONNECT_CODE_IDS,
|
166
176
|
transport_protocol_id: 1
|
@@ -2,13 +2,20 @@ module DIDWW
|
|
2
2
|
module ComplexObject
|
3
3
|
class DidOrderItem < Base
|
4
4
|
# passed at order creation
|
5
|
-
property :qty,
|
6
|
-
property :
|
5
|
+
property :qty, type: :int
|
6
|
+
property :available_did_id, type: :string
|
7
|
+
property :did_reservation_id, type: :string
|
8
|
+
property :sku_id, type: :string
|
7
9
|
|
8
10
|
# returned
|
9
|
-
property :setup_price,
|
10
|
-
property :monthly_price,
|
11
|
-
property :
|
11
|
+
property :setup_price, type: :decimal
|
12
|
+
property :monthly_price, type: :decimal
|
13
|
+
property :nrc, type: :decimal
|
14
|
+
property :mrc, type: :decimal
|
15
|
+
property :propated_mrc, type: :boolean
|
16
|
+
property :billed_from, type: :string
|
17
|
+
property :billed_to, type: :string
|
18
|
+
property :did_group_id, type: :string
|
12
19
|
end
|
13
20
|
end
|
14
21
|
end
|
data/lib/didww/middleware.rb
CHANGED
@@ -5,6 +5,7 @@ module DIDWW
|
|
5
5
|
headers = {}
|
6
6
|
headers['Content-Type'] = 'application/vnd.api+json'
|
7
7
|
headers['Api-Key'] = DIDWW::Client.api_key
|
8
|
+
headers['User-Agent'] = "didww-v3 Ruby gem v#{VERSION}"
|
8
9
|
|
9
10
|
request_env[:request_headers].merge!(headers)
|
10
11
|
request_env.url.host = URI(DIDWW::Client.api_base_url).host
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module DIDWW
|
2
|
+
module Resource
|
3
|
+
class CapacityPool < Base
|
4
|
+
has_many :countries, class: 'Country'
|
5
|
+
has_many :shared_capacity_groups, class: 'SharedCapacityGroup'
|
6
|
+
has_many :qty_based_pricings, class: 'QtyBasedPricing'
|
7
|
+
|
8
|
+
property :name, type: :string
|
9
|
+
# Type: String
|
10
|
+
# Description: Capacity pool name
|
11
|
+
|
12
|
+
property :renew_date, type: :string
|
13
|
+
# Type: String
|
14
|
+
# Description: Next monthly renew date in format 'YYYY-MM-DD'
|
15
|
+
|
16
|
+
property :total_channels_count, type: :integer
|
17
|
+
# Type: Integer
|
18
|
+
# Description: Channels count owned by customer in this pool
|
19
|
+
|
20
|
+
property :assigned_channels_count, type: :integer
|
21
|
+
# Type: Integer
|
22
|
+
# Description: Channels used by at least one service in this pool
|
23
|
+
|
24
|
+
property :minimum_limit, type: :integer
|
25
|
+
# Type: Integer
|
26
|
+
# Description: A minimum amount of channels in this pool. Customer cannot remove unassigned channels below this level.
|
27
|
+
|
28
|
+
property :minimum_qty_per_order, type: :integer
|
29
|
+
# Type: Integer
|
30
|
+
# Description: A minimum amount of new channels to add to this pool in one order.
|
31
|
+
|
32
|
+
property :setup_price, type: :decimal
|
33
|
+
# Type: String
|
34
|
+
# Description: Non-recurring price per channel
|
35
|
+
|
36
|
+
property :monthly_price, type: :decimal
|
37
|
+
# Type: String
|
38
|
+
# Description: Monthly recurring price per channel
|
39
|
+
|
40
|
+
property :metered_rate, type: :decimal
|
41
|
+
# Type: String
|
42
|
+
# Description: Metered rate per minute
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/didww/resources/did.rb
CHANGED
@@ -3,6 +3,8 @@ module DIDWW
|
|
3
3
|
class Did < Base
|
4
4
|
has_one :trunk
|
5
5
|
has_one :trunk_group
|
6
|
+
has_one :capacity_pool
|
7
|
+
has_one :shared_capacity_group
|
6
8
|
|
7
9
|
property :blocked, type: :boolean
|
8
10
|
# Type: Boolean
|
@@ -36,6 +38,10 @@ module DIDWW
|
|
36
38
|
# Type: Integer
|
37
39
|
# Description: The number of channels included with this DID.
|
38
40
|
|
41
|
+
property :dedicated_channels_count, type: :integer
|
42
|
+
# Type: Integer
|
43
|
+
# Description: The number of channels included with this DID.
|
44
|
+
|
39
45
|
property :expires_at, type: :time
|
40
46
|
# Type: DateTime
|
41
47
|
# Description: DateTime when the DID expired or will expire. DateTime is in the ISO 8601 format "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", where "SSS" are milliseconds and 'Z' denotes Zulu time (UTC).
|
@@ -49,6 +49,10 @@ module DIDWW
|
|
49
49
|
# TODO
|
50
50
|
# Meta attributes
|
51
51
|
#
|
52
|
+
# :available_dids_enabled
|
53
|
+
# Type: Boolean
|
54
|
+
# Description: Defines if particular DID from this DID group can be ordered via available_dids or did_reservations.
|
55
|
+
#
|
52
56
|
# needs_registration
|
53
57
|
# Type: Boolean
|
54
58
|
# Description: Defines if end-user registration is required for this DID Group.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DIDWW
|
2
|
+
module Resource
|
3
|
+
class DidReservation < Base
|
4
|
+
has_one :available_did
|
5
|
+
|
6
|
+
property :expire_at, type: :time
|
7
|
+
# Type: DateTime
|
8
|
+
# Description: DateTime when the DID reservation expired or will expire. DateTime is in the ISO 8601 format "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", where "SSS" are milliseconds and 'Z' denotes Zulu time (UTC).
|
9
|
+
|
10
|
+
property :created_at, type: :time
|
11
|
+
# Type: DateTime
|
12
|
+
# Description: DID reservation created at DateTime.
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module DIDWW
|
2
|
+
module Resource
|
3
|
+
class QtyBasedPricing < Base
|
4
|
+
belongs_to :capacity_pool
|
5
|
+
|
6
|
+
property :qty, type: :integer
|
7
|
+
# Type: Integer
|
8
|
+
# Description: A treshold starting at which provided prices per channel apply
|
9
|
+
|
10
|
+
property :setup_price, type: :decimal
|
11
|
+
# Type: String
|
12
|
+
# Description: Non-recurring price per channel
|
13
|
+
|
14
|
+
property :monthly_price, type: :decimal
|
15
|
+
# Type: String
|
16
|
+
# Description: Monthly recurring price per channel
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module DIDWW
|
2
|
+
module Resource
|
3
|
+
class SharedCapacityGroup < Base
|
4
|
+
has_one :capacity_pool, class: 'CapacityPool'
|
5
|
+
|
6
|
+
has_many :dids, class: 'Did'
|
7
|
+
|
8
|
+
property :name, type: :string
|
9
|
+
# Type: String
|
10
|
+
# Description: Shared capacity group name
|
11
|
+
|
12
|
+
property :shared_channels_count, type: :integer
|
13
|
+
# Type: Integer
|
14
|
+
# Description: Channels count assigned to this Group and shared among its DIDs
|
15
|
+
|
16
|
+
property :metered_channels_count, type: :integer
|
17
|
+
# Type: Integer
|
18
|
+
# Description: Maximum amount of Metered channels used by this Group DIDs
|
19
|
+
|
20
|
+
property :created_at, type: :time
|
21
|
+
# Type: DateTime
|
22
|
+
# Description: Shared capacity group created at DateTime
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -2,17 +2,6 @@ module DIDWW
|
|
2
2
|
module Resource
|
3
3
|
class Trunk < Base
|
4
4
|
module CONST
|
5
|
-
# Allowed values for trunk.preferred_server
|
6
|
-
PREFERRED_SERVER_LOCAL = 'LOCAL' .freeze
|
7
|
-
PREFERRED_SERVER_USA = 'USA' .freeze
|
8
|
-
PREFERRED_SERVER_EUROPE = 'Europe' .freeze
|
9
|
-
|
10
|
-
PREFERRED_SERVERS = {
|
11
|
-
PREFERRED_SERVER_LOCAL => 'Local' .freeze,
|
12
|
-
PREFERRED_SERVER_USA => 'United States' .freeze,
|
13
|
-
PREFERRED_SERVER_EUROPE => 'Europe' .freeze
|
14
|
-
}.freeze
|
15
|
-
|
16
5
|
# Allowed values for trunk.cli_format
|
17
6
|
CLI_FORMAT_RAW = 'raw' .freeze
|
18
7
|
CLI_FORMAT_E164 = 'e164' .freeze
|
@@ -44,10 +33,6 @@ module DIDWW
|
|
44
33
|
CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
|
45
34
|
}.freeze
|
46
35
|
|
47
|
-
def preferred_server_human
|
48
|
-
PREFERRED_SERVERS[preferred_server]
|
49
|
-
end
|
50
|
-
|
51
36
|
def cli_format_human
|
52
37
|
CLI_FORMATS[cli_format]
|
53
38
|
end
|
@@ -6,6 +6,7 @@ module DIDWW
|
|
6
6
|
class Trunk < Base
|
7
7
|
include CONST
|
8
8
|
|
9
|
+
has_one :pop
|
9
10
|
has_one :trunk_group
|
10
11
|
|
11
12
|
property :priority, type: :integer
|
@@ -44,10 +45,6 @@ module DIDWW
|
|
44
45
|
# Type: String
|
45
46
|
# Description: Optional description of trunk
|
46
47
|
|
47
|
-
property :preferred_server, type: :string
|
48
|
-
# Type: String
|
49
|
-
# Description: Preferred server for your voice route. In general, you should choose the server that is the closest to your location ["LOCAL", "USA", "DE"] or omit.
|
50
|
-
|
51
48
|
property :configuration, type: :complex_object
|
52
49
|
# Type: one of
|
53
50
|
# sip_configurations
|
data/lib/didww/version.rb
CHANGED
metadata
CHANGED
@@ -1,169 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: didww-v3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Korobeinikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
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: '1.16'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
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
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: byebug
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: awesome_print
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: http_logger
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: smart_rspec
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: webmock
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
13
|
- !ruby/object:Gem::Dependency
|
168
14
|
name: activesupport
|
169
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,16 +42,16 @@ dependencies:
|
|
196
42
|
name: json_api_client
|
197
43
|
requirement: !ruby/object:Gem::Requirement
|
198
44
|
requirements:
|
199
|
-
- -
|
45
|
+
- - '='
|
200
46
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
47
|
+
version: 1.5.3
|
202
48
|
type: :runtime
|
203
49
|
prerelease: false
|
204
50
|
version_requirements: !ruby/object:Gem::Requirement
|
205
51
|
requirements:
|
206
|
-
- -
|
52
|
+
- - '='
|
207
53
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
54
|
+
version: 1.5.3
|
209
55
|
- !ruby/object:Gem::Dependency
|
210
56
|
name: http
|
211
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,10 +87,11 @@ executables: []
|
|
241
87
|
extensions: []
|
242
88
|
extra_rdoc_files: []
|
243
89
|
files:
|
90
|
+
- ".github/workflows/tests.yml"
|
244
91
|
- ".gitignore"
|
245
92
|
- ".rspec"
|
246
93
|
- ".rubocop.yml"
|
247
|
-
-
|
94
|
+
- CHANGELOG.md
|
248
95
|
- Gemfile
|
249
96
|
- LICENSE.txt
|
250
97
|
- README.md
|
@@ -255,6 +102,7 @@ files:
|
|
255
102
|
- lib/didww.rb
|
256
103
|
- lib/didww/client.rb
|
257
104
|
- lib/didww/complex_objects/base.rb
|
105
|
+
- lib/didww/complex_objects/capacity_order_item.rb
|
258
106
|
- lib/didww/complex_objects/cdr_export_filter.rb
|
259
107
|
- lib/didww/complex_objects/configurations.rb
|
260
108
|
- lib/didww/complex_objects/configurations/base.rb
|
@@ -265,16 +113,22 @@ files:
|
|
265
113
|
- lib/didww/complex_objects/configurations/sip_configuration.rb
|
266
114
|
- lib/didww/complex_objects/did_order_item.rb
|
267
115
|
- lib/didww/middleware.rb
|
116
|
+
- lib/didww/resources/available_did.rb
|
268
117
|
- lib/didww/resources/balance.rb
|
269
118
|
- lib/didww/resources/base.rb
|
119
|
+
- lib/didww/resources/capacity_pool.rb
|
270
120
|
- lib/didww/resources/cdr_export.rb
|
271
121
|
- lib/didww/resources/city.rb
|
272
122
|
- lib/didww/resources/country.rb
|
273
123
|
- lib/didww/resources/did.rb
|
274
124
|
- lib/didww/resources/did_group.rb
|
275
125
|
- lib/didww/resources/did_group_type.rb
|
126
|
+
- lib/didww/resources/did_reservation.rb
|
276
127
|
- lib/didww/resources/order.rb
|
128
|
+
- lib/didww/resources/pop.rb
|
129
|
+
- lib/didww/resources/qty_based_pricing.rb
|
277
130
|
- lib/didww/resources/region.rb
|
131
|
+
- lib/didww/resources/shared_capacity_group.rb
|
278
132
|
- lib/didww/resources/stock_keeping_unit.rb
|
279
133
|
- lib/didww/resources/trunk.rb
|
280
134
|
- lib/didww/resources/trunk/const.rb
|
@@ -299,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
153
|
- !ruby/object:Gem::Version
|
300
154
|
version: '0'
|
301
155
|
requirements: []
|
302
|
-
|
303
|
-
rubygems_version: 2.6.14
|
156
|
+
rubygems_version: 3.1.4
|
304
157
|
signing_key:
|
305
158
|
specification_version: 4
|
306
159
|
summary: Ruby client for DIDWW API v3
|