didww-v3 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/tests.yml +27 -0
  3. data/.rubocop.yml +22 -19
  4. data/CHANGELOG.md +53 -0
  5. data/Gemfile +20 -0
  6. data/README.md +7 -1
  7. data/Rakefile +6 -1
  8. data/bin/console +1 -0
  9. data/didww-v3.gemspec +3 -18
  10. data/lib/didww/{middleware.rb → base_middleware.rb} +5 -3
  11. data/lib/didww/callback/request_validator.rb +68 -0
  12. data/lib/didww/client.rb +91 -7
  13. data/lib/didww/complex_objects/base.rb +9 -6
  14. data/lib/didww/complex_objects/capacity_order_item.rb +17 -0
  15. data/lib/didww/complex_objects/cdr_export_filter.rb +1 -0
  16. data/lib/didww/complex_objects/configurations/base.rb +1 -0
  17. data/lib/didww/complex_objects/configurations/const.rb +1 -0
  18. data/lib/didww/complex_objects/configurations/h323_configuration.rb +1 -0
  19. data/lib/didww/complex_objects/configurations/iax2_configuration.rb +1 -0
  20. data/lib/didww/complex_objects/configurations/pstn_configuration.rb +1 -0
  21. data/lib/didww/complex_objects/configurations/sip_configuration.rb +11 -0
  22. data/lib/didww/complex_objects/configurations.rb +1 -0
  23. data/lib/didww/complex_objects/did_order_item.rb +14 -5
  24. data/lib/didww/encrypt.rb +101 -0
  25. data/lib/didww/jsonapi_middleware.rb +21 -0
  26. data/lib/didww/resources/address.rb +37 -0
  27. data/lib/didww/resources/address_verification.rb +56 -0
  28. data/lib/didww/resources/area.rb +12 -0
  29. data/lib/didww/resources/available_did.rb +13 -0
  30. data/lib/didww/resources/balance.rb +1 -0
  31. data/lib/didww/resources/base.rb +2 -1
  32. data/lib/didww/resources/capacity_pool.rb +47 -0
  33. data/lib/didww/resources/cdr_export.rb +12 -1
  34. data/lib/didww/resources/city.rb +5 -0
  35. data/lib/didww/resources/country.rb +1 -0
  36. data/lib/didww/resources/did.rb +9 -1
  37. data/lib/didww/resources/did_group.rb +5 -4
  38. data/lib/didww/resources/did_group_type.rb +1 -0
  39. data/lib/didww/resources/did_reservation.rb +17 -0
  40. data/lib/didww/resources/encrypted_file.rb +58 -0
  41. data/lib/didww/resources/identity.rb +78 -0
  42. data/lib/didww/resources/order.rb +10 -0
  43. data/lib/didww/resources/permanent_supporting_document.rb +15 -0
  44. data/lib/didww/resources/pop.rb +10 -0
  45. data/lib/didww/resources/proof.rb +19 -0
  46. data/lib/didww/resources/proof_type.rb +14 -0
  47. data/lib/didww/resources/public_key.rb +12 -0
  48. data/lib/didww/resources/qty_based_pricing.rb +20 -0
  49. data/lib/didww/resources/region.rb +1 -0
  50. data/lib/didww/resources/requirement.rb +61 -0
  51. data/lib/didww/resources/requirement_validation.rb +10 -0
  52. data/lib/didww/resources/shared_capacity_group.rb +27 -0
  53. data/lib/didww/resources/stock_keeping_unit.rb +1 -0
  54. data/lib/didww/resources/supporting_document_template.rb +14 -0
  55. data/lib/didww/resources/trunk/const.rb +1 -15
  56. data/lib/didww/resources/trunk.rb +2 -4
  57. data/lib/didww/resources/trunk_group.rb +1 -0
  58. data/lib/didww/version.rb +2 -1
  59. data/lib/didww.rb +5 -1
  60. metadata +39 -157
  61. data/.travis.yml +0 -5
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class Pop < Base
5
+ property :name, type: :string
6
+ # Type: String
7
+ # Description: POP name
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class Proof < Base
5
+
6
+ has_many :files, class_name: 'EncryptedFile'
7
+ has_one :proof_type, class_name: 'ProofType'
8
+ has_one :entity, class_name: 'Entity', polymorphic: true
9
+
10
+ property :created_at, type: :date
11
+ # Type: Date
12
+ # Description:
13
+
14
+ property :is_expired, type: :boolean
15
+ # Type: Boolean
16
+ # Description:
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class ProofType < Base
5
+ property :name, type: :string
6
+ # Type: String
7
+ # Description:
8
+
9
+ property :entity_type, type: :string
10
+ # Type: String
11
+ # Description:
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class PublicKey < Base
5
+
6
+ property :key, type: :string
7
+ # Type: String
8
+ # Description: Public key for encryption.
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class QtyBasedPricing < Base
5
+ belongs_to :capacity_pool
6
+
7
+ property :qty, type: :integer
8
+ # Type: Integer
9
+ # Description: A treshold starting at which provided prices per channel apply
10
+
11
+ property :setup_price, type: :decimal
12
+ # Type: String
13
+ # Description: Non-recurring price per channel
14
+
15
+ property :monthly_price, type: :decimal
16
+ # Type: String
17
+ # Description: Monthly recurring price per channel
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class Region < Base
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class Requirement < Base
5
+
6
+ has_one :country, class_name: 'Country'
7
+ has_one :did_group_type, class_name: 'DidGroupType', relation_name: :group_type
8
+ has_one :personal_permanent_document, class_name: 'SupportingDocumentTemplate'
9
+ has_one :business_permanent_document, class_name: 'SupportingDocumentTemplate'
10
+ has_one :personal_onetime_document, class_name: 'SupportingDocumentTemplate'
11
+ has_one :business_onetime_document, class_name: 'SupportingDocumentTemplate'
12
+ has_many :personal_proof_types, class_name: 'ProofType'
13
+ has_many :business_proof_types, class_name: 'ProofType'
14
+ has_many :address_proof_types, class_name: 'ProofType'
15
+
16
+ property :identity_type, type: :integer
17
+ # Type: Integer
18
+ # Description:
19
+
20
+ property :personal_area_level, type: :string
21
+ # Type: String
22
+ # Description:
23
+
24
+ property :business_area_level, type: :string
25
+ # Type: String
26
+ # Description:
27
+
28
+ property :address_area_level, type: :string
29
+ # Type: String
30
+ # Description:
31
+
32
+ property :personal_proof_qty, type: :integer
33
+ # Type: Integer
34
+ # Description:
35
+
36
+ property :business_proof_qty, type: :integer
37
+ # Type: Integer
38
+ # Description:
39
+
40
+ property :address_proof_qty, type: :integer
41
+ # Type: Integer
42
+ # Description:
43
+
44
+ property :personal_mandatory_fields, type: :array
45
+ # Type: String[]
46
+ # Description:
47
+
48
+ property :business_mandatory_fields, type: :array
49
+ # Type: String[]
50
+ # Description:
51
+
52
+ property :service_description_required, type: :boolean
53
+ # Type: Boolean
54
+ # Description:
55
+
56
+ property :restriction_message, type: :string
57
+ # Type: String
58
+ # Description:
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class RequirementValidation < Base
5
+ has_one :requirement, class_name: 'Requirement'
6
+ has_one :address, class_name: 'Address'
7
+ has_one :identity, class_name: 'Identity'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class SharedCapacityGroup < Base
5
+ has_one :capacity_pool, class: 'CapacityPool'
6
+
7
+ has_many :dids, class: 'Did'
8
+
9
+ property :name, type: :string
10
+ # Type: String
11
+ # Description: Shared capacity group name
12
+
13
+ property :shared_channels_count, type: :integer
14
+ # Type: Integer
15
+ # Description: Channels count assigned to this Group and shared among its DIDs
16
+
17
+ property :metered_channels_count, type: :integer
18
+ # Type: Integer
19
+ # Description: Maximum amount of Metered channels used by this Group DIDs
20
+
21
+ property :created_at, type: :time
22
+ # Type: DateTime
23
+ # Description: Shared capacity group created at DateTime
24
+
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class StockKeepingUnit < Base
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class SupportingDocumentTemplate < Base
5
+ property :name, type: :string
6
+ # Type: String
7
+ # Description:
8
+
9
+ property :url, type: :string
10
+ # Type: String
11
+ # Description:
12
+ end
13
+ end
14
+ end
@@ -1,18 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class Trunk < Base
4
5
  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
6
  # Allowed values for trunk.cli_format
17
7
  CLI_FORMAT_RAW = 'raw' .freeze
18
8
  CLI_FORMAT_E164 = 'e164' .freeze
@@ -44,10 +34,6 @@ module DIDWW
44
34
  CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
45
35
  }.freeze
46
36
 
47
- def preferred_server_human
48
- PREFERRED_SERVERS[preferred_server]
49
- end
50
-
51
37
  def cli_format_human
52
38
  CLI_FORMATS[cli_format]
53
39
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'didww/complex_objects/configurations'
2
3
  require 'didww/resources/trunk/const'
3
4
 
@@ -6,6 +7,7 @@ module DIDWW
6
7
  class Trunk < Base
7
8
  include CONST
8
9
 
10
+ has_one :pop
9
11
  has_one :trunk_group
10
12
 
11
13
  property :priority, type: :integer
@@ -44,10 +46,6 @@ module DIDWW
44
46
  # Type: String
45
47
  # Description: Optional description of trunk
46
48
 
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
49
  property :configuration, type: :complex_object
52
50
  # Type: one of
53
51
  # sip_configurations
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class TrunkGroup < Base
data/lib/didww/version.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
- VERSION = '1.0.0'.freeze
3
+ VERSION = '2.0.0'.freeze
3
4
  end
data/lib/didww.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  require 'didww/version'
2
3
  require 'didww/client'
3
- require 'didww/middleware'
4
+ require 'didww/base_middleware'
5
+ require 'didww/jsonapi_middleware'
6
+ require 'didww/callback/request_validator'
7
+ require 'didww/encrypt'
metadata CHANGED
@@ -1,163 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didww-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.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: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
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
14
+ name: activesupport
155
15
  requirement: !ruby/object:Gem::Requirement
156
16
  requirements:
157
17
  - - ">="
158
18
  - !ruby/object:Gem::Version
159
19
  version: '0'
160
- type: :development
20
+ type: :runtime
161
21
  prerelease: false
162
22
  version_requirements: !ruby/object:Gem::Requirement
163
23
  requirements:
@@ -165,7 +25,7 @@ dependencies:
165
25
  - !ruby/object:Gem::Version
166
26
  version: '0'
167
27
  - !ruby/object:Gem::Dependency
168
- name: activesupport
28
+ name: faraday
169
29
  requirement: !ruby/object:Gem::Requirement
170
30
  requirements:
171
31
  - - ">="
@@ -179,21 +39,21 @@ dependencies:
179
39
  - !ruby/object:Gem::Version
180
40
  version: '0'
181
41
  - !ruby/object:Gem::Dependency
182
- name: faraday
42
+ name: json_api_client
183
43
  requirement: !ruby/object:Gem::Requirement
184
44
  requirements:
185
- - - ">="
45
+ - - '='
186
46
  - !ruby/object:Gem::Version
187
- version: '0'
47
+ version: 1.18.0
188
48
  type: :runtime
189
49
  prerelease: false
190
50
  version_requirements: !ruby/object:Gem::Requirement
191
51
  requirements:
192
- - - ">="
52
+ - - '='
193
53
  - !ruby/object:Gem::Version
194
- version: '0'
54
+ version: 1.18.0
195
55
  - !ruby/object:Gem::Dependency
196
- name: json_api_client
56
+ name: http
197
57
  requirement: !ruby/object:Gem::Requirement
198
58
  requirements:
199
59
  - - ">="
@@ -207,7 +67,7 @@ dependencies:
207
67
  - !ruby/object:Gem::Version
208
68
  version: '0'
209
69
  - !ruby/object:Gem::Dependency
210
- name: http
70
+ name: down
211
71
  requirement: !ruby/object:Gem::Requirement
212
72
  requirements:
213
73
  - - ">="
@@ -221,7 +81,7 @@ dependencies:
221
81
  - !ruby/object:Gem::Version
222
82
  version: '0'
223
83
  - !ruby/object:Gem::Dependency
224
- name: down
84
+ name: openssl-oaep
225
85
  requirement: !ruby/object:Gem::Requirement
226
86
  requirements:
227
87
  - - ">="
@@ -241,10 +101,11 @@ executables: []
241
101
  extensions: []
242
102
  extra_rdoc_files: []
243
103
  files:
104
+ - ".github/workflows/tests.yml"
244
105
  - ".gitignore"
245
106
  - ".rspec"
246
107
  - ".rubocop.yml"
247
- - ".travis.yml"
108
+ - CHANGELOG.md
248
109
  - Gemfile
249
110
  - LICENSE.txt
250
111
  - README.md
@@ -253,8 +114,11 @@ files:
253
114
  - bin/setup
254
115
  - didww-v3.gemspec
255
116
  - lib/didww.rb
117
+ - lib/didww/base_middleware.rb
118
+ - lib/didww/callback/request_validator.rb
256
119
  - lib/didww/client.rb
257
120
  - lib/didww/complex_objects/base.rb
121
+ - lib/didww/complex_objects/capacity_order_item.rb
258
122
  - lib/didww/complex_objects/cdr_export_filter.rb
259
123
  - lib/didww/complex_objects/configurations.rb
260
124
  - lib/didww/complex_objects/configurations/base.rb
@@ -264,18 +128,37 @@ files:
264
128
  - lib/didww/complex_objects/configurations/pstn_configuration.rb
265
129
  - lib/didww/complex_objects/configurations/sip_configuration.rb
266
130
  - lib/didww/complex_objects/did_order_item.rb
267
- - lib/didww/middleware.rb
131
+ - lib/didww/encrypt.rb
132
+ - lib/didww/jsonapi_middleware.rb
133
+ - lib/didww/resources/address.rb
134
+ - lib/didww/resources/address_verification.rb
135
+ - lib/didww/resources/area.rb
136
+ - lib/didww/resources/available_did.rb
268
137
  - lib/didww/resources/balance.rb
269
138
  - lib/didww/resources/base.rb
139
+ - lib/didww/resources/capacity_pool.rb
270
140
  - lib/didww/resources/cdr_export.rb
271
141
  - lib/didww/resources/city.rb
272
142
  - lib/didww/resources/country.rb
273
143
  - lib/didww/resources/did.rb
274
144
  - lib/didww/resources/did_group.rb
275
145
  - lib/didww/resources/did_group_type.rb
146
+ - lib/didww/resources/did_reservation.rb
147
+ - lib/didww/resources/encrypted_file.rb
148
+ - lib/didww/resources/identity.rb
276
149
  - lib/didww/resources/order.rb
150
+ - lib/didww/resources/permanent_supporting_document.rb
151
+ - lib/didww/resources/pop.rb
152
+ - lib/didww/resources/proof.rb
153
+ - lib/didww/resources/proof_type.rb
154
+ - lib/didww/resources/public_key.rb
155
+ - lib/didww/resources/qty_based_pricing.rb
277
156
  - lib/didww/resources/region.rb
157
+ - lib/didww/resources/requirement.rb
158
+ - lib/didww/resources/requirement_validation.rb
159
+ - lib/didww/resources/shared_capacity_group.rb
278
160
  - lib/didww/resources/stock_keeping_unit.rb
161
+ - lib/didww/resources/supporting_document_template.rb
279
162
  - lib/didww/resources/trunk.rb
280
163
  - lib/didww/resources/trunk/const.rb
281
164
  - lib/didww/resources/trunk_group.rb
@@ -299,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
182
  - !ruby/object:Gem::Version
300
183
  version: '0'
301
184
  requirements: []
302
- rubyforge_project:
303
- rubygems_version: 2.6.14
185
+ rubygems_version: 3.1.4
304
186
  signing_key:
305
187
  specification_version: 4
306
188
  summary: Ruby client for DIDWW API v3
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.2
5
- before_install: gem install bundler -v 1.16.0