didww-v3 1.3.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +5 -1
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +51 -2
  5. data/Gemfile +2 -1
  6. data/README.md +10 -1
  7. data/Rakefile +1 -0
  8. data/bin/console +1 -0
  9. data/didww-v3.gemspec +3 -1
  10. data/lib/didww/{middleware.rb → base_middleware.rb} +5 -4
  11. data/lib/didww/callback/const.rb +14 -0
  12. data/lib/didww/callback/request_validator.rb +77 -0
  13. data/lib/didww/client.rb +98 -39
  14. data/lib/didww/complex_objects/base.rb +2 -3
  15. data/lib/didww/complex_objects/capacity_order_item.rb +1 -0
  16. data/lib/didww/complex_objects/configurations/base.rb +143 -2
  17. data/lib/didww/complex_objects/configurations/h323_configuration.rb +1 -0
  18. data/lib/didww/complex_objects/configurations/iax2_configuration.rb +1 -0
  19. data/lib/didww/complex_objects/configurations/pstn_configuration.rb +1 -0
  20. data/lib/didww/complex_objects/configurations/sip_configuration.rb +34 -3
  21. data/lib/didww/complex_objects/configurations.rb +1 -0
  22. data/lib/didww/complex_objects/did_order_item.rb +15 -12
  23. data/lib/didww/complex_objects/export_filters.rb +26 -0
  24. data/lib/didww/encrypt.rb +101 -0
  25. data/lib/didww/jsonapi_middleware.rb +21 -0
  26. data/lib/didww/resource/address.rb +37 -0
  27. data/lib/didww/resource/address_verification.rb +56 -0
  28. data/lib/didww/resource/area.rb +12 -0
  29. data/lib/didww/{resources → resource}/available_did.rb +2 -0
  30. data/lib/didww/{resources → resource}/balance.rb +1 -0
  31. data/lib/didww/{resources → resource}/base.rb +2 -2
  32. data/lib/didww/{resources → resource}/capacity_pool.rb +1 -0
  33. data/lib/didww/resource/city.rb +14 -0
  34. data/lib/didww/{resources → resource}/country.rb +1 -0
  35. data/lib/didww/{resources → resource}/did.rb +5 -3
  36. data/lib/didww/{resources → resource}/did_group.rb +13 -25
  37. data/lib/didww/{resources → resource}/did_group_type.rb +1 -0
  38. data/lib/didww/{resources → resource}/did_reservation.rb +1 -0
  39. data/lib/didww/resource/encrypted_file.rb +58 -0
  40. data/lib/didww/{resources/cdr_export.rb → resource/export.rb} +24 -5
  41. data/lib/didww/resource/identity.rb +78 -0
  42. data/lib/didww/resource/nanpa_prefix.rb +18 -0
  43. data/lib/didww/{resources → resource}/order.rb +20 -12
  44. data/lib/didww/resource/permanent_supporting_document.rb +15 -0
  45. data/lib/didww/{resources → resource}/pop.rb +1 -0
  46. data/lib/didww/resource/proof.rb +19 -0
  47. data/lib/didww/resource/proof_type.rb +14 -0
  48. data/lib/didww/resource/public_key.rb +12 -0
  49. data/lib/didww/{resources → resource}/qty_based_pricing.rb +1 -0
  50. data/lib/didww/{resources → resource}/region.rb +1 -0
  51. data/lib/didww/resource/requirement.rb +61 -0
  52. data/lib/didww/resource/requirement_validation.rb +10 -0
  53. data/lib/didww/{resources → resource}/shared_capacity_group.rb +1 -0
  54. data/lib/didww/{resources → resource}/stock_keeping_unit.rb +1 -0
  55. data/lib/didww/resource/supporting_document_template.rb +14 -0
  56. data/lib/didww/{resources/trunk.rb → resource/voice_in_trunk.rb} +40 -4
  57. data/lib/didww/{resources/trunk_group.rb → resource/voice_in_trunk_group.rb} +3 -2
  58. data/lib/didww/resource/voice_out_trunk.rb +75 -0
  59. data/lib/didww/resource/voice_out_trunk_regenerate_credential.rb +11 -0
  60. data/lib/didww/types/ip_addresses.rb +23 -0
  61. data/lib/didww/types/strings.rb +21 -0
  62. data/lib/didww/types.rb +12 -0
  63. data/lib/didww/version.rb +2 -1
  64. data/lib/didww.rb +6 -1
  65. metadata +63 -28
  66. data/lib/didww/complex_objects/cdr_export_filter.rb +0 -23
  67. data/lib/didww/complex_objects/configurations/const.rb +0 -149
  68. data/lib/didww/resources/city.rb +0 -9
  69. data/lib/didww/resources/trunk/const.rb +0 -46
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didww-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Korobeinikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.3
47
+ version: 1.18.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.5.3
54
+ version: 1.18.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: http
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: openssl-oaep
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Ruby client for DIDWW API v3
84
98
  email:
85
99
  - alex.k@didww.com
@@ -100,39 +114,59 @@ files:
100
114
  - bin/setup
101
115
  - didww-v3.gemspec
102
116
  - lib/didww.rb
117
+ - lib/didww/base_middleware.rb
118
+ - lib/didww/callback/const.rb
119
+ - lib/didww/callback/request_validator.rb
103
120
  - lib/didww/client.rb
104
121
  - lib/didww/complex_objects/base.rb
105
122
  - lib/didww/complex_objects/capacity_order_item.rb
106
- - lib/didww/complex_objects/cdr_export_filter.rb
107
123
  - lib/didww/complex_objects/configurations.rb
108
124
  - lib/didww/complex_objects/configurations/base.rb
109
- - lib/didww/complex_objects/configurations/const.rb
110
125
  - lib/didww/complex_objects/configurations/h323_configuration.rb
111
126
  - lib/didww/complex_objects/configurations/iax2_configuration.rb
112
127
  - lib/didww/complex_objects/configurations/pstn_configuration.rb
113
128
  - lib/didww/complex_objects/configurations/sip_configuration.rb
114
129
  - lib/didww/complex_objects/did_order_item.rb
115
- - lib/didww/middleware.rb
116
- - lib/didww/resources/available_did.rb
117
- - lib/didww/resources/balance.rb
118
- - lib/didww/resources/base.rb
119
- - lib/didww/resources/capacity_pool.rb
120
- - lib/didww/resources/cdr_export.rb
121
- - lib/didww/resources/city.rb
122
- - lib/didww/resources/country.rb
123
- - lib/didww/resources/did.rb
124
- - lib/didww/resources/did_group.rb
125
- - lib/didww/resources/did_group_type.rb
126
- - lib/didww/resources/did_reservation.rb
127
- - lib/didww/resources/order.rb
128
- - lib/didww/resources/pop.rb
129
- - lib/didww/resources/qty_based_pricing.rb
130
- - lib/didww/resources/region.rb
131
- - lib/didww/resources/shared_capacity_group.rb
132
- - lib/didww/resources/stock_keeping_unit.rb
133
- - lib/didww/resources/trunk.rb
134
- - lib/didww/resources/trunk/const.rb
135
- - lib/didww/resources/trunk_group.rb
130
+ - lib/didww/complex_objects/export_filters.rb
131
+ - lib/didww/encrypt.rb
132
+ - lib/didww/jsonapi_middleware.rb
133
+ - lib/didww/resource/address.rb
134
+ - lib/didww/resource/address_verification.rb
135
+ - lib/didww/resource/area.rb
136
+ - lib/didww/resource/available_did.rb
137
+ - lib/didww/resource/balance.rb
138
+ - lib/didww/resource/base.rb
139
+ - lib/didww/resource/capacity_pool.rb
140
+ - lib/didww/resource/city.rb
141
+ - lib/didww/resource/country.rb
142
+ - lib/didww/resource/did.rb
143
+ - lib/didww/resource/did_group.rb
144
+ - lib/didww/resource/did_group_type.rb
145
+ - lib/didww/resource/did_reservation.rb
146
+ - lib/didww/resource/encrypted_file.rb
147
+ - lib/didww/resource/export.rb
148
+ - lib/didww/resource/identity.rb
149
+ - lib/didww/resource/nanpa_prefix.rb
150
+ - lib/didww/resource/order.rb
151
+ - lib/didww/resource/permanent_supporting_document.rb
152
+ - lib/didww/resource/pop.rb
153
+ - lib/didww/resource/proof.rb
154
+ - lib/didww/resource/proof_type.rb
155
+ - lib/didww/resource/public_key.rb
156
+ - lib/didww/resource/qty_based_pricing.rb
157
+ - lib/didww/resource/region.rb
158
+ - lib/didww/resource/requirement.rb
159
+ - lib/didww/resource/requirement_validation.rb
160
+ - lib/didww/resource/shared_capacity_group.rb
161
+ - lib/didww/resource/stock_keeping_unit.rb
162
+ - lib/didww/resource/supporting_document_template.rb
163
+ - lib/didww/resource/voice_in_trunk.rb
164
+ - lib/didww/resource/voice_in_trunk_group.rb
165
+ - lib/didww/resource/voice_out_trunk.rb
166
+ - lib/didww/resource/voice_out_trunk_regenerate_credential.rb
167
+ - lib/didww/types.rb
168
+ - lib/didww/types/ip_addresses.rb
169
+ - lib/didww/types/strings.rb
136
170
  - lib/didww/version.rb
137
171
  homepage: https://github.com/didww/didww-v3-ruby
138
172
  licenses:
@@ -153,7 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
187
  - !ruby/object:Gem::Version
154
188
  version: '0'
155
189
  requirements: []
156
- rubygems_version: 3.1.4
190
+ rubyforge_project:
191
+ rubygems_version: 2.7.6.2
157
192
  signing_key:
158
193
  specification_version: 4
159
194
  summary: Ruby client for DIDWW API v3
@@ -1,23 +0,0 @@
1
- require 'json_api_client/schema'
2
-
3
- module DIDWW
4
- module ComplexObject
5
- class CdrExportFilter < Base
6
- # Type casting for JsonApiClient parser/setters
7
- def self.cast_single_object(hash)
8
- new(hash)
9
- end
10
-
11
- property :year, type: :integer
12
- property :month, type: :integer
13
- property :did_number, type: :string
14
-
15
- def as_json(*)
16
- super[:attributes]
17
- end
18
-
19
- end
20
- end
21
- end
22
-
23
- JsonApiClient::Schema.register cdr_export_filter: DIDWW::ComplexObject::CdrExportFilter
@@ -1,149 +0,0 @@
1
- module DIDWW
2
- module ComplexObject
3
- module Configuration
4
- module CONST
5
- RX_DTMF_FORMATS = {
6
- 1 => 'RFC 2833' .freeze,
7
- 2 => 'SIP INFO application/dtmf-relay OR application/dtmf'.freeze,
8
- 3 => 'RFC 2833 OR SIP INFO' .freeze
9
- }.freeze
10
-
11
- TX_DTMF_FORMATS = {
12
- 0 => 'Disable sending' .freeze,
13
- 1 => 'RFC 2833' .freeze,
14
- 2 => 'SIP INFO application/dtmf-relay' .freeze,
15
- 4 => 'SIP INFO application/dtmf' .freeze
16
- }.freeze
17
-
18
- SST_REFRESH_METHODS = {
19
- 1 => 'Invite' .freeze,
20
- 2 => 'Update' .freeze,
21
- 3 => 'Update fallback Invite' .freeze
22
- }.freeze
23
-
24
- TRANSPORT_PROTOCOLS = {
25
- 1 => 'UDP' .freeze,
26
- 2 => 'TCP' .freeze
27
- }.freeze
28
-
29
- REROUTING_DISCONNECT_CODES = {
30
- 56 => '400 | Bad Request' .freeze,
31
- 57 => '401 | Unauthorized' .freeze,
32
- 58 => '402 | Payment Required' .freeze,
33
- 59 => '403 | Forbidden' .freeze,
34
- 60 => '404 | Not Found' .freeze,
35
- 64 => '408 | Request Timeout' .freeze,
36
- 65 => '409 | Conflict' .freeze,
37
- 66 => '410 | Gone' .freeze,
38
- 67 => '412 | Conditional Request Failed' .freeze,
39
- 68 => '413 | Request Entity Too Large' .freeze,
40
- 69 => '414 | Request-URI Too Long' .freeze,
41
- 70 => '415 | Unsupported Media Type' .freeze,
42
- 71 => '416 | Unsupported URI Scheme' .freeze,
43
- 72 => '417 | Unknown Resource-Priority' .freeze,
44
- 73 => '420 | Bad Extension' .freeze,
45
- 74 => '421 | Extension Required' .freeze,
46
- 75 => '422 | Session Interval Too Small' .freeze,
47
- 76 => '423 | Interval Too Brief' .freeze,
48
- 77 => '424 | Bad Location Information' .freeze,
49
- 78 => '428 | Use Identity Header' .freeze,
50
- 79 => '429 | Provide Referrer Identity' .freeze,
51
- 80 => '433 | Anonymity Disallowed' .freeze,
52
- 81 => '436 | Bad Identity-Info' .freeze,
53
- 82 => '437 | Unsupported Certificate' .freeze,
54
- 83 => '438 | Invalid Identity Header' .freeze,
55
- 84 => '480 | Temporarily Unavailable' .freeze,
56
- 86 => '482 | Loop Detected' .freeze,
57
- 87 => '483 | Too Many Hops' .freeze,
58
- 88 => '484 | Address Incomplete' .freeze,
59
- 89 => '485 | Ambiguous' .freeze,
60
- 90 => '486 | Busy Here' .freeze,
61
- 91 => '487 | Request Terminated' .freeze,
62
- 92 => '488 | Not Acceptable Here' .freeze,
63
- 96 => '494 | Security Agreement Required' .freeze,
64
- 97 => '500 | Server Internal Error' .freeze,
65
- 98 => '501 | Not Implemented' .freeze,
66
- 99 => '502 | Bad Gateway' .freeze,
67
- 100 => '503 | Service Unavailable' .freeze,
68
- 101 => '504 | Server Time-out' .freeze,
69
- 102 => '505 | Version Not Supported' .freeze,
70
- 103 => '513 | Message Too Large' .freeze,
71
- 104 => '580 | Precondition Failure' .freeze,
72
- 105 => '600 | Busy Everywhere' .freeze,
73
- 106 => '603 | Decline' .freeze,
74
- 107 => '604 | Does Not Exist Anywhere' .freeze,
75
- 108 => '606 | Not Acceptable' .freeze,
76
- 1505 => 'Ringing timeout' .freeze
77
- }.freeze
78
-
79
- CODECS = {
80
- 6 => 'telephone-event' .freeze,
81
- 7 => 'G723' .freeze,
82
- 8 => 'G729' .freeze,
83
- 9 => 'PCMU' .freeze,
84
- 10 => 'PCMA' .freeze,
85
- 12 => 'speex' .freeze,
86
- 13 => 'GSM' .freeze,
87
- 14 => 'G726-32' .freeze,
88
- 15 => 'G721' .freeze,
89
- 16 => 'G726-24' .freeze,
90
- 17 => 'G726-40' .freeze,
91
- 18 => 'G726-16' .freeze,
92
- 19 => 'L16' .freeze
93
- }.freeze
94
-
95
- DEFAULT_REROUTING_DISCONNECT_CODE_IDS = [
96
- 56,
97
- 58,
98
- 59,
99
- 60,
100
- 64,
101
- 65,
102
- 66,
103
- 67,
104
- 68,
105
- 69,
106
- 70,
107
- 71,
108
- 72,
109
- 73,
110
- 74,
111
- 75,
112
- 76,
113
- 77,
114
- 78,
115
- 79,
116
- 80,
117
- 81,
118
- 82,
119
- 83,
120
- 84,
121
- 86,
122
- 87,
123
- 88,
124
- 89,
125
- 90,
126
- 91,
127
- 92,
128
- 96,
129
- 97,
130
- 98,
131
- 99,
132
- 101,
133
- 102,
134
- 103,
135
- 104,
136
- 105,
137
- 106,
138
- 107,
139
- 108,
140
- 1505
141
- ].freeze
142
-
143
- DEFAULT_CODEC_IDS = [ 9, 10, 8, 7, 6 ].freeze
144
-
145
- DID_PLACEHOLDER = '{DID}'.freeze
146
- end
147
- end
148
- end
149
- end
@@ -1,9 +0,0 @@
1
- module DIDWW
2
- module Resource
3
- class City < Base
4
- property :name, type: :string
5
- # Type: String
6
- # Description: City name
7
- end
8
- end
9
- end
@@ -1,46 +0,0 @@
1
- module DIDWW
2
- module Resource
3
- class Trunk < Base
4
- module CONST
5
- # Allowed values for trunk.cli_format
6
- CLI_FORMAT_RAW = 'raw' .freeze
7
- CLI_FORMAT_E164 = 'e164' .freeze
8
- CLI_FORMAT_LOCAL = 'local' .freeze
9
-
10
- CLI_FORMATS = {
11
- CLI_FORMAT_RAW => 'Raw' .freeze,
12
- CLI_FORMAT_E164 => 'E.164' .freeze,
13
- CLI_FORMAT_LOCAL => 'Local' .freeze
14
- }.freeze
15
-
16
- # Configuration types
17
- CONF_TYPE_SIP = 'sip_configurations' .freeze
18
- CONF_TYPE_H323 = 'h323_configurations' .freeze
19
- CONF_TYPE_IAX2 = 'iax2_configurations' .freeze
20
- CONF_TYPE_PSTN = 'pstn_configurations' .freeze
21
-
22
- CONF_TYPES = {
23
- CONF_TYPE_SIP => 'SIP' .freeze,
24
- CONF_TYPE_H323 => 'H323' .freeze,
25
- CONF_TYPE_IAX2 => 'IAX2' .freeze,
26
- CONF_TYPE_PSTN => 'PSTN' .freeze
27
- }.freeze
28
-
29
- CONF_TYPE_CLASSES = {
30
- CONF_TYPE_SIP => DIDWW::ComplexObject::SipConfiguration,
31
- CONF_TYPE_H323 => DIDWW::ComplexObject::H323Configuration,
32
- CONF_TYPE_IAX2 => DIDWW::ComplexObject::Iax2Configuration,
33
- CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
34
- }.freeze
35
-
36
- def cli_format_human
37
- CLI_FORMATS[cli_format]
38
- end
39
-
40
- def configuration_type_human
41
- CONF_TYPES[configuration.type] if configuration
42
- end
43
- end
44
- end
45
- end
46
- end