didww-v3 2.0.0 → 3.0.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 +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +3 -2
- data/lib/didww/callback/const.rb +14 -0
- data/lib/didww/callback/request_validator.rb +12 -3
- data/lib/didww/client.rb +44 -38
- data/lib/didww/complex_objects/base.rb +1 -3
- data/lib/didww/complex_objects/configurations/base.rb +142 -2
- data/lib/didww/complex_objects/configurations/sip_configuration.rb +33 -3
- data/lib/didww/complex_objects/export_filters.rb +26 -0
- data/lib/didww/{resources → resource}/address.rb +0 -0
- data/lib/didww/{resources → resource}/address_verification.rb +0 -0
- data/lib/didww/{resources → resource}/area.rb +0 -0
- data/lib/didww/{resources → resource}/available_did.rb +0 -0
- data/lib/didww/{resources → resource}/balance.rb +0 -0
- data/lib/didww/{resources → resource}/base.rb +0 -1
- data/lib/didww/{resources → resource}/capacity_pool.rb +0 -0
- data/lib/didww/{resources → resource}/city.rb +0 -0
- data/lib/didww/{resources → resource}/country.rb +0 -0
- data/lib/didww/{resources → resource}/did.rb +2 -2
- data/lib/didww/{resources → resource}/did_group.rb +12 -17
- data/lib/didww/{resources → resource}/did_group_type.rb +0 -0
- data/lib/didww/{resources → resource}/did_reservation.rb +0 -0
- data/lib/didww/{resources → resource}/encrypted_file.rb +0 -0
- data/lib/didww/{resources/cdr_export.rb → resource/export.rb} +12 -4
- data/lib/didww/{resources → resource}/identity.rb +0 -0
- data/lib/didww/{resources → resource}/order.rb +12 -13
- data/lib/didww/{resources → resource}/permanent_supporting_document.rb +0 -0
- data/lib/didww/{resources → resource}/pop.rb +0 -0
- data/lib/didww/{resources → resource}/proof.rb +0 -0
- data/lib/didww/{resources → resource}/proof_type.rb +0 -0
- data/lib/didww/{resources → resource}/public_key.rb +0 -0
- data/lib/didww/{resources → resource}/qty_based_pricing.rb +0 -0
- data/lib/didww/{resources → resource}/region.rb +0 -0
- data/lib/didww/{resources → resource}/requirement.rb +0 -0
- data/lib/didww/{resources → resource}/requirement_validation.rb +0 -0
- data/lib/didww/{resources → resource}/shared_capacity_group.rb +0 -0
- data/lib/didww/{resources → resource}/stock_keeping_unit.rb +0 -0
- data/lib/didww/{resources → resource}/supporting_document_template.rb +0 -0
- data/lib/didww/{resources/trunk.rb → resource/voice_in_trunk.rb} +39 -4
- data/lib/didww/{resources/trunk_group.rb → resource/voice_in_trunk_group.rb} +2 -2
- data/lib/didww/resource/voice_out_trunk.rb +75 -0
- data/lib/didww/resource/voice_out_trunk_regenerate_credential.rb +11 -0
- data/lib/didww/types/ip_addresses.rb +23 -0
- data/lib/didww/types/strings.rb +21 -0
- data/lib/didww/types.rb +12 -0
- data/lib/didww/version.rb +1 -1
- data/lib/didww.rb +1 -0
- metadata +40 -36
- data/lib/didww/complex_objects/cdr_export_filter.rb +0 -24
- data/lib/didww/complex_objects/configurations/const.rb +0 -150
- data/lib/didww/resources/trunk/const.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3033b22b339631f852f135fcc40650102feab555bcb153072f64d73d03092eac
|
4
|
+
data.tar.gz: c9f1c20a485a40539f8034bc8cc8ba160ee26538b7585ffe2ed3e9bd3c0137e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4864de1d500e14be418849cfd3e9fb7d4ec3becbf2678972ff667afe587123893e12ad08e3030ad329f215ce70a9b902e31f422b87c883062c9c2f944d8a76d4
|
7
|
+
data.tar.gz: fd3651c1410f7d67148b79a5219d068a7c9304f6e497fd1455337229f8c5d0867d294932c35f5a63768c633e4ac5abc8d3cb80f74a3be724403a1ac3d574b9ae
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [3.0.0]
|
8
|
+
### Breaking Changes
|
9
|
+
- /v3/trunks being moved to /v3/voice_in_trunks.
|
10
|
+
- /v3/trunk_groups being moved to /v3/voice_in_trunk_groups.
|
11
|
+
- /v3/cdr_exports being moved to /v3/exports. Endpoint now allows generating both inbound and outbound CDRs export.
|
12
|
+
- /v3/exports result file will be CSV archived in GZIP.
|
13
|
+
- Callbacks payload for exports being changed: value of type attribute is changed to exports.
|
14
|
+
- /v3/exports export_type required attribute being added to request and response with possible values: cdr_in, cdr_out.
|
15
|
+
- /v3/exports filters attribute being removed from response.
|
16
|
+
- /v3/did_groups filter features allowed values to be changed to sms_in, sms_out, voice_in, voice_out, t38.
|
17
|
+
- /v3/did_groups response value of features attribute to be changed to sms_in, sms_out, voice_in, voice_out, t38.
|
18
|
+
- /v3/available_dids filter did_group.features allowed values being changed to sms_in, sms_out, voice_in, voice_out, t38.
|
19
|
+
- /v3/dids rename trunk_group relationship to voice_in_trunk_group with type voice_in_trunk_groups.
|
20
|
+
- /v3/dids rename trunks relationship to voice_in_trunks with type voice_in_trunks.
|
21
|
+
|
22
|
+
### Changes
|
23
|
+
- /v3/voice_out_trunks endpoints being added.
|
24
|
+
- /v3/voice_out_trunk_regenerate_credentials endpoint being added.
|
25
|
+
- /v3/voice_in_trunks SIP configuration additional attributes being added to request and response: media_encryption_mode, stir_shaken_mode, allowed_rtp_ips.
|
26
|
+
- /v3/dids filter add filter did_group.features with allowed values: sms_in, sms_out, voice_in, voice_out, t38.
|
27
|
+
- Callbacks allow receiving events about /v3/voice_out_trunks status change.
|
28
|
+
|
7
29
|
## [2.0.0] - 2021-10-26
|
8
30
|
### Breaking Changes
|
9
31
|
- upgrade `json_api_client` version to `1.18.0` [#9](https://github.com/didww/didww-v3-ruby/pull/9)
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Ruby client for DIDWW API v3.
|
2
2
|
|
3
3
|

|
4
|
+
[](https://badge.fury.io/rb/didww-v3)
|
4
5
|
|
5
6
|
About DIDWW API v3
|
6
7
|
-----
|
@@ -11,9 +12,9 @@ The DIDWW API v3 is a fully compliant implementation of the [JSON API specificat
|
|
11
12
|
|
12
13
|
Read more https://doc.didww.com/api
|
13
14
|
|
14
|
-
Gem Versions **2.X.X** are intended to use with DIDWW API 3 version [2021-04-19](https://doc.didww.com/api3/2021-04-19/index.html).
|
15
|
+
Gem Versions **2.X.X** and branch [master](https://github.com/didww/didww-v3-ruby) are intended to use with DIDWW API 3 version [2021-04-19](https://doc.didww.com/api3/2021-04-19/index.html).
|
15
16
|
|
16
|
-
Gem Versions **1.X.X** are intended to use with DIDWW API 3 version [2017-09-18](https://doc.didww.com/api3/2017-09-18/index.html).
|
17
|
+
Gem Versions **1.X.X** and branch [release-1](https://github.com/didww/didww-v3-ruby/tree/release-1) are intended to use with DIDWW API 3 version [2017-09-18](https://doc.didww.com/api3/2017-09-18/index.html).
|
17
18
|
|
18
19
|
## Installation
|
19
20
|
|
@@ -37,14 +37,23 @@ module DIDWW
|
|
37
37
|
private
|
38
38
|
|
39
39
|
# @param url [String]
|
40
|
-
# @param payload [Hash]
|
40
|
+
# @param payload [Hash,Array]
|
41
41
|
# @return [String] generated signature in URL safe format.
|
42
42
|
def valid_signature(url, payload)
|
43
|
-
|
44
|
-
data = normalized_url + payload.sort.join
|
43
|
+
data = normalize_url(url) + normalize_payload(payload)
|
45
44
|
OpenSSL::HMAC.hexdigest(DIGEST_ALGO, @api_key, data)
|
46
45
|
end
|
47
46
|
|
47
|
+
# @param payload [Hash,Array]
|
48
|
+
# @return [String] normalized payload.
|
49
|
+
def normalize_payload(payload)
|
50
|
+
if payload.is_a?(Hash)
|
51
|
+
payload.sort.join
|
52
|
+
else
|
53
|
+
payload.map { |item| item.sort.join }.join
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
# @return [String] normalized URL.
|
49
58
|
def normalize_url(url)
|
50
59
|
parsed_url = URI ensure_protocol_url(url)
|
data/lib/didww/client.rb
CHANGED
@@ -3,13 +3,13 @@ require 'active_support/core_ext/module/attribute_accessors'
|
|
3
3
|
require 'active_support/core_ext/object/blank'
|
4
4
|
require 'json_api_client'
|
5
5
|
|
6
|
-
require 'didww/
|
6
|
+
require 'didww/resource/base'
|
7
7
|
|
8
8
|
module DIDWW
|
9
9
|
module Client
|
10
10
|
BASE_URLS = {
|
11
11
|
sandbox: 'https://sandbox-api.didww.com/v3/' .freeze,
|
12
|
-
production: 'https://api.didww.com/v3/' .freeze
|
12
|
+
production: 'https://sandbox-api.didww.com/v3/' .freeze
|
13
13
|
}.freeze
|
14
14
|
DEFAULT_MODE = :sandbox
|
15
15
|
|
@@ -55,8 +55,8 @@ module DIDWW
|
|
55
55
|
Resource::CapacityPool
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
Resource::
|
58
|
+
def exports
|
59
|
+
Resource::Export
|
60
60
|
end
|
61
61
|
|
62
62
|
def shared_capacity_groups
|
@@ -95,12 +95,16 @@ module DIDWW
|
|
95
95
|
Resource::Region
|
96
96
|
end
|
97
97
|
|
98
|
-
def
|
99
|
-
Resource::
|
98
|
+
def voice_in_trunk_groups
|
99
|
+
Resource::VoiceInTrunkGroup
|
100
100
|
end
|
101
101
|
|
102
|
-
def
|
103
|
-
Resource::
|
102
|
+
def voice_in_trunks
|
103
|
+
Resource::VoiceInTrunk
|
104
|
+
end
|
105
|
+
|
106
|
+
def voice_out_trunks
|
107
|
+
Resource::VoiceOutTrunk
|
104
108
|
end
|
105
109
|
|
106
110
|
def available_dids
|
@@ -167,36 +171,38 @@ module DIDWW
|
|
167
171
|
end
|
168
172
|
|
169
173
|
def require_didww_resources
|
170
|
-
require 'didww/
|
171
|
-
require 'didww/
|
172
|
-
require 'didww/
|
173
|
-
require 'didww/
|
174
|
-
require 'didww/
|
175
|
-
require 'didww/
|
176
|
-
require 'didww/
|
177
|
-
require 'didww/
|
178
|
-
require 'didww/
|
179
|
-
require 'didww/
|
180
|
-
require 'didww/
|
181
|
-
require 'didww/
|
182
|
-
require 'didww/
|
183
|
-
require 'didww/
|
184
|
-
require 'didww/
|
185
|
-
require 'didww/
|
186
|
-
require 'didww/
|
187
|
-
require 'didww/
|
188
|
-
require 'didww/
|
189
|
-
require 'didww/
|
190
|
-
require 'didww/
|
191
|
-
require 'didww/
|
192
|
-
require 'didww/
|
193
|
-
require 'didww/
|
194
|
-
require 'didww/
|
195
|
-
require 'didww/
|
196
|
-
require 'didww/
|
197
|
-
require 'didww/
|
198
|
-
require 'didww/
|
199
|
-
require 'didww/
|
174
|
+
require 'didww/resource/balance'
|
175
|
+
require 'didww/resource/capacity_pool'
|
176
|
+
require 'didww/resource/export'
|
177
|
+
require 'didww/resource/shared_capacity_group'
|
178
|
+
require 'didww/resource/city'
|
179
|
+
require 'didww/resource/country'
|
180
|
+
require 'didww/resource/did_group_type'
|
181
|
+
require 'didww/resource/did_group'
|
182
|
+
require 'didww/resource/did'
|
183
|
+
require 'didww/resource/order'
|
184
|
+
require 'didww/resource/pop'
|
185
|
+
require 'didww/resource/qty_based_pricing'
|
186
|
+
require 'didww/resource/region'
|
187
|
+
require 'didww/resource/stock_keeping_unit'
|
188
|
+
require 'didww/resource/voice_in_trunk_group'
|
189
|
+
require 'didww/resource/voice_in_trunk'
|
190
|
+
require 'didww/resource/available_did'
|
191
|
+
require 'didww/resource/did_reservation'
|
192
|
+
require 'didww/resource/requirement'
|
193
|
+
require 'didww/resource/proof_type'
|
194
|
+
require 'didww/resource/supporting_document_template'
|
195
|
+
require 'didww/resource/identity'
|
196
|
+
require 'didww/resource/proof'
|
197
|
+
require 'didww/resource/address'
|
198
|
+
require 'didww/resource/permanent_supporting_document'
|
199
|
+
require 'didww/resource/encrypted_file'
|
200
|
+
require 'didww/resource/address_verification'
|
201
|
+
require 'didww/resource/requirement_validation'
|
202
|
+
require 'didww/resource/public_key'
|
203
|
+
require 'didww/resource/area'
|
204
|
+
require 'didww/resource/voice_out_trunk'
|
205
|
+
require 'didww/resource/voice_out_trunk_regenerate_credential'
|
200
206
|
end
|
201
207
|
|
202
208
|
end
|
@@ -12,7 +12,7 @@ module DIDWW
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def property(name, options = {})
|
15
|
-
|
15
|
+
schema.add(name, options)
|
16
16
|
define_method(name.to_sym) { self[name] }
|
17
17
|
define_method("#{name}=".to_sym) { |val| self[name] = val }
|
18
18
|
end
|
@@ -88,5 +88,3 @@ module DIDWW
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
92
|
-
JsonApiClient::Schema.register complex_object: DIDWW::ComplexObject::Base
|
@@ -1,11 +1,151 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'didww/complex_objects/configurations/const'
|
3
2
|
|
4
3
|
module DIDWW
|
5
4
|
module ComplexObject
|
6
5
|
module Configuration
|
7
6
|
class Base < ComplexObject::Base
|
8
|
-
|
7
|
+
RX_DTMF_FORMATS = {
|
8
|
+
1 => 'RFC 2833',
|
9
|
+
2 => 'SIP INFO application/dtmf-relay OR application/dtmf',
|
10
|
+
3 => 'RFC 2833 OR SIP INFO'
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
TX_DTMF_FORMATS = {
|
14
|
+
0 => 'Disable sending',
|
15
|
+
1 => 'RFC 2833',
|
16
|
+
2 => 'SIP INFO application/dtmf-relay',
|
17
|
+
4 => 'SIP INFO application/dtmf'
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
SST_REFRESH_METHODS = {
|
21
|
+
1 => 'Invite',
|
22
|
+
2 => 'Update',
|
23
|
+
3 => 'Update fallback Invite'
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
TRANSPORT_PROTOCOLS = {
|
27
|
+
1 => 'UDP',
|
28
|
+
2 => 'TCP',
|
29
|
+
3 => 'TLS'
|
30
|
+
}.freeze
|
31
|
+
|
32
|
+
REROUTING_DISCONNECT_CODES = {
|
33
|
+
56 => '400 | Bad Request',
|
34
|
+
57 => '401 | Unauthorized',
|
35
|
+
58 => '402 | Payment Required',
|
36
|
+
59 => '403 | Forbidden',
|
37
|
+
60 => '404 | Not Found',
|
38
|
+
64 => '408 | Request Timeout',
|
39
|
+
65 => '409 | Conflict',
|
40
|
+
66 => '410 | Gone',
|
41
|
+
67 => '412 | Conditional Request Failed',
|
42
|
+
68 => '413 | Request Entity Too Large',
|
43
|
+
69 => '414 | Request-URI Too Long',
|
44
|
+
70 => '415 | Unsupported Media Type',
|
45
|
+
71 => '416 | Unsupported URI Scheme',
|
46
|
+
72 => '417 | Unknown Resource-Priority',
|
47
|
+
73 => '420 | Bad Extension',
|
48
|
+
74 => '421 | Extension Required',
|
49
|
+
75 => '422 | Session Interval Too Small',
|
50
|
+
76 => '423 | Interval Too Brief',
|
51
|
+
77 => '424 | Bad Location Information',
|
52
|
+
78 => '428 | Use Identity Header',
|
53
|
+
79 => '429 | Provide Referrer Identity',
|
54
|
+
80 => '433 | Anonymity Disallowed',
|
55
|
+
81 => '436 | Bad Identity-Info',
|
56
|
+
82 => '437 | Unsupported Certificate',
|
57
|
+
83 => '438 | Invalid Identity Header',
|
58
|
+
84 => '480 | Temporarily Unavailable',
|
59
|
+
86 => '482 | Loop Detected',
|
60
|
+
87 => '483 | Too Many Hops',
|
61
|
+
88 => '484 | Address Incomplete',
|
62
|
+
89 => '485 | Ambiguous',
|
63
|
+
90 => '486 | Busy Here',
|
64
|
+
91 => '487 | Request Terminated',
|
65
|
+
92 => '488 | Not Acceptable Here',
|
66
|
+
96 => '494 | Security Agreement Required',
|
67
|
+
97 => '500 | Server Internal Error',
|
68
|
+
98 => '501 | Not Implemented',
|
69
|
+
99 => '502 | Bad Gateway',
|
70
|
+
100 => '503 | Service Unavailable',
|
71
|
+
101 => '504 | Server Time-out',
|
72
|
+
102 => '505 | Version Not Supported',
|
73
|
+
103 => '513 | Message Too Large',
|
74
|
+
104 => '580 | Precondition Failure',
|
75
|
+
105 => '600 | Busy Everywhere',
|
76
|
+
106 => '603 | Decline',
|
77
|
+
107 => '604 | Does Not Exist Anywhere',
|
78
|
+
108 => '606 | Not Acceptable',
|
79
|
+
1505 => 'Ringing timeout'
|
80
|
+
}.freeze
|
81
|
+
|
82
|
+
CODECS = {
|
83
|
+
6 => 'telephone-event',
|
84
|
+
7 => 'G723',
|
85
|
+
8 => 'G729',
|
86
|
+
9 => 'PCMU',
|
87
|
+
10 => 'PCMA',
|
88
|
+
12 => 'speex',
|
89
|
+
13 => 'GSM',
|
90
|
+
14 => 'G726-32',
|
91
|
+
15 => 'G721',
|
92
|
+
16 => 'G726-24',
|
93
|
+
17 => 'G726-40',
|
94
|
+
18 => 'G726-16',
|
95
|
+
19 => 'L16'
|
96
|
+
}.freeze
|
97
|
+
|
98
|
+
DEFAULT_REROUTING_DISCONNECT_CODE_IDS = [
|
99
|
+
56,
|
100
|
+
58,
|
101
|
+
59,
|
102
|
+
60,
|
103
|
+
64,
|
104
|
+
65,
|
105
|
+
66,
|
106
|
+
67,
|
107
|
+
68,
|
108
|
+
69,
|
109
|
+
70,
|
110
|
+
71,
|
111
|
+
72,
|
112
|
+
73,
|
113
|
+
74,
|
114
|
+
75,
|
115
|
+
76,
|
116
|
+
77,
|
117
|
+
78,
|
118
|
+
79,
|
119
|
+
80,
|
120
|
+
81,
|
121
|
+
82,
|
122
|
+
83,
|
123
|
+
84,
|
124
|
+
86,
|
125
|
+
87,
|
126
|
+
88,
|
127
|
+
89,
|
128
|
+
90,
|
129
|
+
91,
|
130
|
+
92,
|
131
|
+
96,
|
132
|
+
97,
|
133
|
+
98,
|
134
|
+
99,
|
135
|
+
101,
|
136
|
+
102,
|
137
|
+
103,
|
138
|
+
104,
|
139
|
+
105,
|
140
|
+
106,
|
141
|
+
107,
|
142
|
+
108,
|
143
|
+
1505
|
144
|
+
].freeze
|
145
|
+
|
146
|
+
DEFAULT_CODEC_IDS = [9, 10, 8, 7, 6].freeze
|
147
|
+
|
148
|
+
DID_PLACEHOLDER = '{DID}'
|
9
149
|
end
|
10
150
|
end
|
11
151
|
end
|
@@ -148,7 +148,7 @@ module DIDWW
|
|
148
148
|
property :transport_protocol_id, type: :integer
|
149
149
|
# Type: Integer
|
150
150
|
# Nullable: No
|
151
|
-
# Description: The transport layer that will be responsible for the actual transmission of SIP requests and responses
|
151
|
+
# Description: The transport layer that will be responsible for the actual transmission of SIP requests and responses. See TRANSPORT_PROTOCOLS for available values.
|
152
152
|
|
153
153
|
property :max_transfers, type: :integer
|
154
154
|
# Nullable: No
|
@@ -158,6 +158,36 @@ module DIDWW
|
|
158
158
|
# Nullable: No
|
159
159
|
# Description: Max count of 301/302 redirects
|
160
160
|
|
161
|
+
property :media_encryption_mode, type: :string
|
162
|
+
# Type: String
|
163
|
+
# Nullable: No
|
164
|
+
# Description: The Media encryption mode for RTP traffic. See MEDIA_ENCRYPTION_MODES for available values.
|
165
|
+
|
166
|
+
property :stir_shaken_mode, type: :string
|
167
|
+
# Type: String
|
168
|
+
# Nullable: No
|
169
|
+
# Description: The STIR/SHAKEN mode for sending identity via SIP. See STIR_SHAKEN_MODES for available values.
|
170
|
+
|
171
|
+
property :allowed_rtp_ips, type: :ip_addresses
|
172
|
+
# Type: Array of strings
|
173
|
+
# Nullable: Yes
|
174
|
+
# Description: Allowed IP addresses for RTP connection.
|
175
|
+
|
176
|
+
MEDIA_ENCRYPTION_MODES = [
|
177
|
+
'disabled',
|
178
|
+
'srtp_sdes',
|
179
|
+
'srtp_dtls',
|
180
|
+
'zrtp'
|
181
|
+
].freeze
|
182
|
+
|
183
|
+
STIR_SHAKEN_MODES = [
|
184
|
+
'disabled',
|
185
|
+
'original',
|
186
|
+
'pai',
|
187
|
+
'original_pai',
|
188
|
+
'verstat'
|
189
|
+
].freeze
|
190
|
+
|
161
191
|
DEFAULTS = {
|
162
192
|
username: DID_PLACEHOLDER,
|
163
193
|
port: '5060',
|
@@ -177,7 +207,7 @@ module DIDWW
|
|
177
207
|
transport_protocol_id: 1
|
178
208
|
}.freeze
|
179
209
|
|
180
|
-
RECOMMENDED = DEFAULTS.merge(
|
210
|
+
RECOMMENDED = DEFAULTS.merge(
|
181
211
|
#-- Authentication
|
182
212
|
auth_user: '',
|
183
213
|
auth_password: '',
|
@@ -191,7 +221,7 @@ module DIDWW
|
|
191
221
|
#-- Advanced Signalling Settings
|
192
222
|
sst_enabled: false,
|
193
223
|
sst_session_expires: '',
|
194
|
-
|
224
|
+
).freeze
|
195
225
|
|
196
226
|
def sst_refresh_method
|
197
227
|
SST_REFRESH_METHODS[sst_refresh_method_id]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'json_api_client/schema'
|
3
|
+
|
4
|
+
module DIDWW
|
5
|
+
module ComplexObject
|
6
|
+
class ExportFilters < Base
|
7
|
+
# Type casting for JsonApiClient parser/setters
|
8
|
+
def self.cast_single_object(hash)
|
9
|
+
new(hash)
|
10
|
+
end
|
11
|
+
|
12
|
+
property :year, type: :integer
|
13
|
+
property :month, type: :integer
|
14
|
+
property :day, type: :integer # only for CDR Out
|
15
|
+
property :did_number, type: :string # only for CDR in
|
16
|
+
property :voice_out_trunk_id, type: :string # only for CDR Out
|
17
|
+
|
18
|
+
def as_json(*)
|
19
|
+
result = attributes.as_json.with_indifferent_access
|
20
|
+
result[:'voice_out_trunk.id'] = result.delete(:voice_out_trunk_id) if result.key?(:voice_out_trunk_id)
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,23 +2,15 @@
|
|
2
2
|
module DIDWW
|
3
3
|
module Resource
|
4
4
|
class DidGroup < Base
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}.freeze
|
15
|
-
|
16
|
-
def features_human
|
17
|
-
Array.wrap(features).map { |f| FEATURES[f] }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
include CONST
|
5
|
+
# Possible values for did_group.features array
|
6
|
+
FEATURE_VOICE = 'voice' .freeze
|
7
|
+
FEATURE_T38 = 't38' .freeze
|
8
|
+
FEATURE_SMS = 'sms' .freeze
|
9
|
+
FEATURES = {
|
10
|
+
FEATURE_VOICE => 'Voice' .freeze,
|
11
|
+
FEATURE_T38 => 'T.38 Fax' .freeze,
|
12
|
+
FEATURE_SMS => 'SMS' .freeze
|
13
|
+
}.freeze
|
22
14
|
|
23
15
|
has_one :country, class: Country
|
24
16
|
has_one :city, class: City
|
@@ -62,6 +54,9 @@ module DIDWW
|
|
62
54
|
# Type: Boolean
|
63
55
|
# Description: Defines if numbers in this DID Group are currently in stock.
|
64
56
|
|
57
|
+
def features_human
|
58
|
+
Array.wrap(features).map { |f| FEATURES[f] }
|
59
|
+
end
|
65
60
|
end
|
66
61
|
end
|
67
62
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,16 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'forwardable'
|
3
|
-
require 'didww/complex_objects/cdr_export_filter'
|
4
3
|
require 'down/http'
|
4
|
+
require 'didww/callback/const'
|
5
5
|
|
6
6
|
module DIDWW
|
7
7
|
module Resource
|
8
|
-
class
|
8
|
+
class Export < Base
|
9
|
+
include DIDWW::Callback::CONST
|
9
10
|
extend Forwardable
|
10
11
|
|
11
12
|
STATUS_COMPLETED = 'Completed'
|
12
13
|
|
13
|
-
|
14
|
+
EXPORT_TYPE_CDR_IN = 'cdr_in'
|
15
|
+
EXPORT_TYPE_CDR_OUT = 'cdr_out'
|
16
|
+
EXPORT_TYPES = [
|
17
|
+
EXPORT_TYPE_CDR_IN,
|
18
|
+
EXPORT_TYPE_CDR_OUT
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
property :filters, type: :export_filters
|
14
22
|
# Type: CDR Export Filters Object
|
15
23
|
# Nullable: No
|
16
24
|
# Description: Filters
|
@@ -38,7 +46,7 @@ module DIDWW
|
|
38
46
|
# Type: String
|
39
47
|
# Description: GET or POST
|
40
48
|
|
41
|
-
|
49
|
+
property :export_type, type: :string
|
42
50
|
|
43
51
|
def initialize(params = {})
|
44
52
|
super params.reverse_merge(filters: {})
|
File without changes
|
@@ -1,23 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'didww/complex_objects/did_order_item'
|
3
3
|
require 'didww/complex_objects/capacity_order_item'
|
4
|
+
require 'didww/callback/const'
|
4
5
|
|
5
6
|
module DIDWW
|
6
7
|
module Resource
|
7
8
|
class Order < Base
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
include CONST
|
9
|
+
include DIDWW::Callback::CONST
|
10
|
+
|
11
|
+
# Possible values for order.status
|
12
|
+
STATUS_PENDING = 'Pending'
|
13
|
+
STATUS_COMPLETED = 'Completed'
|
14
|
+
STATUS_CANCELLED = 'Canceled'
|
15
|
+
STATUSES = [
|
16
|
+
STATUS_PENDING,
|
17
|
+
STATUS_COMPLETED,
|
18
|
+
STATUS_CANCELLED
|
19
|
+
].freeze
|
21
20
|
|
22
21
|
property :reference, type: :string
|
23
22
|
# Type: String
|
File without changes
|