didww-v3 4.1.0 → 5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c311027f0ab58fdac3f8cd0558485659e23a623c1eec3065369e7a2a44bcad3b
4
- data.tar.gz: 6f64fd27e3f51c0c77a3102f7efcdbc1d62d0aecc7b3b83eb233d4c385bbeb10
3
+ metadata.gz: 22a712d25c5bdfa402c73df24b8529f0e001e97256cf7d84cdfbb8d492af4dcd
4
+ data.tar.gz: f3fdb4186c6821dd1d9c93744515e0a3eb6d0d1b3da3c1da4d0449dd8d726512
5
5
  SHA512:
6
- metadata.gz: cb9c3864d94db9f49eac0324b695d44a56bf5387816c53203bea979c7a705f2e8a348559b0804151c34bd080e55ccef149e62e1738030e87f69ceda4aa5d96d1
7
- data.tar.gz: cb964ac512ecc7a75083e9be7373529c754fc3b9d6809eae7e420726d8f7a4f7a7504f7aa414da352a9ff8f8bba0c2949149d73c1bc492311e0e065bc8347b71
6
+ metadata.gz: de07093d853e4576ea5e18552786f3bb88d3013456a75f2efdaae56a3dbbb2560384d11bd22d1cd42f3cd739c0baf531e190dc70e700fba23bd46e3309861d16
7
+ data.tar.gz: 2a434cb0c3a17840b8b7490b45078f66bb835f5656241fb98a6f629f6c7ee7305cfe6015366c7b9fbfb47233c02dbfe3292e0408deaf8f80e116b089524f5c0c
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  steps:
17
17
  - name: Checkout code
18
- uses: actions/checkout@v2
18
+ uses: actions/checkout@v4
19
19
 
20
20
  - name: Install codespell
21
21
  run: |
@@ -4,25 +4,22 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - master
7
- schedule:
8
- - cron: "0 9 * * *"
9
7
 
10
8
  jobs:
11
9
  test:
12
10
  runs-on: ubuntu-latest
13
11
  strategy:
14
12
  matrix:
15
- ruby: [ '2.7', '3.0', '3.1', '3.2' ]
16
- rails: [ '~> 6.0', '~> 6.1', '~> 7.0' ]
13
+ ruby: [ '3.3', '3.4' ]
14
+ rails: [ '~> 7.2', '~> 8.0', '~> 8.1' ]
17
15
  name: Tests with Ruby ${{ matrix.ruby }} Activesupport ${{ matrix.rails }}
18
16
  env:
19
17
  RAILS_VERSION: ${{ matrix.rails }}
20
18
  steps:
21
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v4
22
20
  - uses: ruby/setup-ruby@v1
23
21
  with:
24
22
  ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true
25
24
  - name: Run tests
26
- run: |
27
- bundle install
28
- bundle exec rake
25
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -10,6 +10,7 @@ AllCops:
10
10
 
11
11
  Exclude:
12
12
  - db/migrate/**/*
13
+ - vendor/**/*
13
14
 
14
15
  ##################### Layout ##################################
15
16
  Layout/TrailingEmptyLines:
data/Gemfile CHANGED
@@ -10,13 +10,13 @@ if ENV['RAILS_VERSION']
10
10
  gem 'activesupport', ENV['RAILS_VERSION'], require: false
11
11
  end
12
12
 
13
- gem 'rake', '~> 12.0'
13
+ gem 'rake', '~> 13.0'
14
14
  gem 'rspec', '~> 3.0'
15
15
  gem 'pry'
16
- gem 'byebug'
16
+ gem 'debug'
17
17
  gem 'awesome_print'
18
18
  gem 'http_logger'
19
- gem 'rubocop', '~> 1.28.2'
19
+ gem 'rubocop', '~> 1.50'
20
20
  gem 'rubocop-performance'
21
21
  gem 'rubocop-rake'
22
22
  gem 'rubocop-rspec'
data/README.md CHANGED
@@ -53,6 +53,10 @@ For details on obtaining your API key please visit https://doc.didww.com/api#int
53
53
 
54
54
  See integration example at https://github.com/didww/didww-v3-rails-sample
55
55
 
56
+ ## Resource Relationships
57
+
58
+ See [docs/resource_relationships.md](docs/resource_relationships.md) for a Mermaid ER diagram showing all `has_one`, `has_many`, and `belongs_to` relationships between resources.
59
+
56
60
  ## Development
57
61
 
58
62
  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.
data/didww-v3.gemspec CHANGED
@@ -22,9 +22,11 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
+ spec.required_ruby_version = '>= 3.3'
26
+
25
27
  spec.add_dependency 'activesupport'
26
28
  spec.add_dependency 'faraday'
27
- spec.add_dependency 'json_api_client', '1.18.0'
29
+ spec.add_dependency 'json_api_client', '1.23.0'
28
30
  spec.add_dependency 'http'
29
31
  spec.add_dependency 'down'
30
32
  spec.add_dependency 'openssl-oaep'
@@ -0,0 +1,138 @@
1
+ # Resource Relationships
2
+
3
+ This diagram shows all `has_one`, `has_many`, and `belongs_to` relationships between DIDWW API v3 resources.
4
+
5
+ **Legend:**
6
+ - `||--o|` — has_one (one-to-zero-or-one)
7
+ - `||--o{` — has_many (one-to-many)
8
+ - `}o--||` — belongs_to (many-to-one)
9
+
10
+ ```mermaid
11
+ erDiagram
12
+ Address ||--o| Identity : "has_one identity"
13
+ Address ||--o| Country : "has_one country"
14
+ Address ||--o{ Proof : "has_many proofs"
15
+ Address ||--o{ City : "has_many city"
16
+ Address ||--o{ Area : "has_many area"
17
+
18
+ AddressVerification ||--o| Address : "has_one address"
19
+ AddressVerification ||--o{ Did : "has_many dids"
20
+ AddressVerification ||--o{ EncryptedFile : "has_many onetime_files"
21
+
22
+ Area ||--o| Country : "has_one country"
23
+
24
+ AvailableDid ||--o| DidGroup : "has_one did_group"
25
+ AvailableDid ||--o| NanpaPrefix : "has_one nanpa_prefix"
26
+
27
+ CapacityPool ||--o{ Country : "has_many countries"
28
+ CapacityPool ||--o{ SharedCapacityGroup : "has_many shared_capacity_groups"
29
+ CapacityPool ||--o{ QtyBasedPricing : "has_many qty_based_pricings"
30
+
31
+ City ||--o| Country : "has_one country"
32
+ City ||--o| Region : "has_one region"
33
+ City ||--o| Area : "has_one area"
34
+
35
+ Country ||--o{ Region : "has_many regions"
36
+
37
+ Did ||--o| DidGroup : "has_one did_group"
38
+ Did ||--o| Order : "has_one order"
39
+ Did ||--o| VoiceInTrunk : "has_one voice_in_trunk"
40
+ Did ||--o| VoiceInTrunkGroup : "has_one voice_in_trunk_group"
41
+ Did ||--o| CapacityPool : "has_one capacity_pool"
42
+ Did ||--o| SharedCapacityGroup : "has_one shared_capacity_group"
43
+ Did ||--o| AddressVerification : "has_one address_verification"
44
+
45
+ DidGroup ||--o| Country : "has_one country"
46
+ DidGroup ||--o| City : "has_one city"
47
+ DidGroup ||--o| DidGroupType : "has_one did_group_type"
48
+ DidGroup ||--o| Region : "has_one region"
49
+ DidGroup ||--o{ StockKeepingUnit : "has_many stock_keeping_units"
50
+
51
+ DidReservation ||--o| AvailableDid : "has_one available_did"
52
+
53
+ Identity ||--o| Country : "has_one country"
54
+ Identity ||--o{ Proof : "has_many proofs"
55
+ Identity ||--o{ Address : "has_many addresses"
56
+ Identity ||--o{ PermanentSupportingDocument : "has_many permanent_documents"
57
+
58
+ NanpaPrefix ||--o| Country : "has_one country"
59
+ NanpaPrefix ||--o| Region : "has_one region"
60
+
61
+ PermanentSupportingDocument ||--o| SupportingDocumentTemplate : "has_one template"
62
+ PermanentSupportingDocument ||--o| Identity : "has_one identity"
63
+ PermanentSupportingDocument ||--o{ EncryptedFile : "has_many files"
64
+
65
+ Proof ||--o| ProofType : "has_one proof_type"
66
+ Proof ||--o{ EncryptedFile : "has_many files"
67
+
68
+ QtyBasedPricing }o--|| CapacityPool : "belongs_to capacity_pool"
69
+
70
+ Region ||--o| Country : "has_one country"
71
+
72
+ Requirement ||--o| Country : "has_one country"
73
+ Requirement ||--o| DidGroupType : "has_one did_group_type"
74
+ Requirement ||--o| SupportingDocumentTemplate : "has_one personal_permanent_document"
75
+ Requirement ||--o| SupportingDocumentTemplate : "has_one business_permanent_document"
76
+ Requirement ||--o| SupportingDocumentTemplate : "has_one personal_onetime_document"
77
+ Requirement ||--o| SupportingDocumentTemplate : "has_one business_onetime_document"
78
+ Requirement ||--o{ ProofType : "has_many personal_proof_types"
79
+ Requirement ||--o{ ProofType : "has_many business_proof_types"
80
+ Requirement ||--o{ ProofType : "has_many address_proof_types"
81
+
82
+ RequirementValidation ||--o| Requirement : "has_one requirement"
83
+ RequirementValidation ||--o| Address : "has_one address"
84
+ RequirementValidation ||--o| Identity : "has_one identity"
85
+
86
+ SharedCapacityGroup ||--o| CapacityPool : "has_one capacity_pool"
87
+ SharedCapacityGroup ||--o{ Did : "has_many dids"
88
+
89
+ StockKeepingUnit }o--|| DidGroup : "belongs_to did_group"
90
+
91
+ VoiceInTrunk ||--o| Pop : "has_one pop"
92
+ VoiceInTrunk ||--o| VoiceInTrunkGroup : "has_one voice_in_trunk_group"
93
+
94
+ VoiceInTrunkGroup ||--o{ VoiceInTrunk : "has_many voice_in_trunks"
95
+
96
+ VoiceOutTrunk ||--o| Did : "has_one default_did"
97
+ VoiceOutTrunk ||--o{ Did : "has_many dids"
98
+
99
+ VoiceOutTrunkRegenerateCredential ||--o| VoiceOutTrunk : "has_one voice_out_trunk"
100
+ ```
101
+
102
+ ## Resource Summary
103
+
104
+ | Resource | has_one | has_many | belongs_to |
105
+ |----------|---------|----------|------------|
106
+ | Address | identity, country | proofs, city, area | — |
107
+ | AddressVerification | address | dids, onetime_files | — |
108
+ | Area | country | — | — |
109
+ | AvailableDid | did_group, nanpa_prefix | — | — |
110
+ | Balance | — | — | — |
111
+ | CapacityPool | — | countries, shared_capacity_groups, qty_based_pricings | — |
112
+ | City | country, region, area | — | — |
113
+ | Country | — | regions | — |
114
+ | Did | did_group, order, voice_in_trunk, voice_in_trunk_group, capacity_pool, shared_capacity_group, address_verification | — | — |
115
+ | DidGroup | country, city, did_group_type, region | stock_keeping_units | — |
116
+ | DidGroupType | — | — | — |
117
+ | DidReservation | available_did | — | — |
118
+ | EncryptedFile | — | — | — |
119
+ | Export | — | — | — |
120
+ | Identity | country | proofs, addresses, permanent_documents | — |
121
+ | NanpaPrefix | country, region | — | — |
122
+ | Order | — | — | — |
123
+ | PermanentSupportingDocument | template, identity | files | — |
124
+ | Pop | — | — | — |
125
+ | Proof | proof_type | files | — |
126
+ | ProofType | — | — | — |
127
+ | PublicKey | — | — | — |
128
+ | QtyBasedPricing | — | — | capacity_pool |
129
+ | Region | country | — | — |
130
+ | Requirement | country, did_group_type, personal_permanent_document, business_permanent_document, personal_onetime_document, business_onetime_document | personal_proof_types, business_proof_types, address_proof_types | — |
131
+ | RequirementValidation | requirement, address, identity | — | — |
132
+ | SharedCapacityGroup | capacity_pool | dids | — |
133
+ | StockKeepingUnit | — | — | did_group |
134
+ | SupportingDocumentTemplate | — | — | — |
135
+ | VoiceInTrunk | pop, voice_in_trunk_group | — | — |
136
+ | VoiceInTrunkGroup | — | voice_in_trunks | — |
137
+ | VoiceOutTrunk | default_did | dids | — |
138
+ | VoiceOutTrunkRegenerateCredential | voice_out_trunk | — | — |
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'didww/complex_objects/configurations/base'
3
3
  require 'didww/complex_objects/configurations/sip_configuration'
4
- require 'didww/complex_objects/configurations/iax2_configuration'
5
4
  require 'didww/complex_objects/configurations/pstn_configuration'
6
- require 'didww/complex_objects/configurations/h323_configuration'
7
5
 
8
6
  module DIDWW
9
7
  module ComplexObject
data/lib/didww/encrypt.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'base64'
2
3
  require 'openssl'
3
4
  require 'openssl/oaep'
4
5
  require 'net/http'
@@ -2,9 +2,9 @@
2
2
  module DIDWW
3
3
  module Resource
4
4
  class CapacityPool < Base
5
- has_many :countries, class: 'Country'
6
- has_many :shared_capacity_groups, class: 'SharedCapacityGroup'
7
- has_many :qty_based_pricings, class: 'QtyBasedPricing'
5
+ has_many :countries, class_name: 'Country'
6
+ has_many :shared_capacity_groups, class_name: 'SharedCapacityGroup'
7
+ has_many :qty_based_pricings, class_name: 'QtyBasedPricing'
8
8
 
9
9
  property :name, type: :string
10
10
  # Type: String
@@ -2,6 +2,8 @@
2
2
  module DIDWW
3
3
  module Resource
4
4
  class Country < Base
5
+ has_many :regions, class_name: 'Region'
6
+
5
7
  property :name, type: :string
6
8
  # Type: String
7
9
  # Description: Country name
@@ -2,6 +2,8 @@
2
2
  module DIDWW
3
3
  module Resource
4
4
  class Did < Base
5
+ has_one :did_group
6
+ has_one :order
5
7
  has_one :voice_in_trunk
6
8
  has_one :voice_in_trunk_group
7
9
  has_one :capacity_pool
@@ -17,8 +17,11 @@ module DIDWW
17
17
  FEATURE_OUT_SMS => 'SMS OUT'
18
18
  }.freeze
19
19
 
20
- has_one :country, class: Country
21
- has_one :city, class: City
20
+ has_one :country, class_name: 'Country'
21
+ has_one :city, class_name: 'City'
22
+ has_one :did_group_type, class_name: 'DidGroupType'
23
+ has_one :region, class_name: 'Region'
24
+ has_many :stock_keeping_units, class_name: 'StockKeepingUnit'
22
25
 
23
26
  property :area_name, type: :string
24
27
  # Type: String
@@ -2,6 +2,8 @@
2
2
  module DIDWW
3
3
  module Resource
4
4
  class Region < Base
5
+ has_one :country, class_name: 'Country'
6
+
5
7
  property :name, type: :string
6
8
  # Type: String
7
9
  # Description: Region name
@@ -2,9 +2,9 @@
2
2
  module DIDWW
3
3
  module Resource
4
4
  class SharedCapacityGroup < Base
5
- has_one :capacity_pool, class: 'CapacityPool'
5
+ has_one :capacity_pool, class_name: 'CapacityPool'
6
6
 
7
- has_many :dids, class: 'Did'
7
+ has_many :dids, class_name: 'Did'
8
8
 
9
9
  property :name, type: :string
10
10
  # Type: String
@@ -17,21 +17,15 @@ module DIDWW
17
17
 
18
18
  # Configuration types
19
19
  CONF_TYPE_SIP = 'sip_configurations'
20
- CONF_TYPE_H323 = 'h323_configurations'
21
- CONF_TYPE_IAX2 = 'iax2_configurations'
22
20
  CONF_TYPE_PSTN = 'pstn_configurations'
23
21
 
24
22
  CONF_TYPES = {
25
23
  CONF_TYPE_SIP => 'SIP',
26
- CONF_TYPE_H323 => 'H323',
27
- CONF_TYPE_IAX2 => 'IAX2',
28
24
  CONF_TYPE_PSTN => 'PSTN'
29
25
  }.freeze
30
26
 
31
27
  CONF_TYPE_CLASSES = {
32
28
  CONF_TYPE_SIP => DIDWW::ComplexObject::SipConfiguration,
33
- CONF_TYPE_H323 => DIDWW::ComplexObject::H323Configuration,
34
- CONF_TYPE_IAX2 => DIDWW::ComplexObject::Iax2Configuration,
35
29
  CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
36
30
  }.freeze
37
31
 
@@ -78,8 +72,6 @@ module DIDWW
78
72
  # Type: one of
79
73
  # sip_configurations
80
74
  # pstn_configurations
81
- # iax2_configurations
82
- # h323_configurations
83
75
  # Description: Trunk configuration complex object
84
76
 
85
77
  property :created_at, type: :time
@@ -63,6 +63,7 @@ module DIDWW
63
63
  property :force_symmetric_rtp, type: :boolean
64
64
  property :allowed_rtp_ips, type: :ip_addresses
65
65
 
66
+ has_one :default_did, class_name: 'Did'
66
67
  has_many :dids
67
68
 
68
69
  def regenerate_credentials
data/lib/didww/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module DIDWW
3
- VERSION = '4.1.0'.freeze
3
+ VERSION = '5.0.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didww-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Korobeinikov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -44,14 +43,14 @@ dependencies:
44
43
  requirements:
45
44
  - - '='
46
45
  - !ruby/object:Gem::Version
47
- version: 1.18.0
46
+ version: 1.23.0
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - '='
53
52
  - !ruby/object:Gem::Version
54
- version: 1.18.0
53
+ version: 1.23.0
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: http
57
56
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +115,7 @@ files:
116
115
  - bin/setup
117
116
  - codespell_ignore_words.txt
118
117
  - didww-v3.gemspec
118
+ - docs/resource_relationships.md
119
119
  - lib/didww.rb
120
120
  - lib/didww/base_middleware.rb
121
121
  - lib/didww/callback/const.rb
@@ -125,8 +125,6 @@ files:
125
125
  - lib/didww/complex_objects/capacity_order_item.rb
126
126
  - lib/didww/complex_objects/configurations.rb
127
127
  - lib/didww/complex_objects/configurations/base.rb
128
- - lib/didww/complex_objects/configurations/h323_configuration.rb
129
- - lib/didww/complex_objects/configurations/iax2_configuration.rb
130
128
  - lib/didww/complex_objects/configurations/pstn_configuration.rb
131
129
  - lib/didww/complex_objects/configurations/sip_configuration.rb
132
130
  - lib/didww/complex_objects/did_order_item.rb
@@ -175,7 +173,6 @@ homepage: https://github.com/didww/didww-v3-ruby
175
173
  licenses:
176
174
  - MIT
177
175
  metadata: {}
178
- post_install_message:
179
176
  rdoc_options: []
180
177
  require_paths:
181
178
  - lib
@@ -183,16 +180,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
180
  requirements:
184
181
  - - ">="
185
182
  - !ruby/object:Gem::Version
186
- version: '0'
183
+ version: '3.3'
187
184
  required_rubygems_version: !ruby/object:Gem::Requirement
188
185
  requirements:
189
186
  - - ">="
190
187
  - !ruby/object:Gem::Version
191
188
  version: '0'
192
189
  requirements: []
193
- rubyforge_project:
194
- rubygems_version: 2.7.6.2
195
- signing_key:
190
+ rubygems_version: 4.0.4
196
191
  specification_version: 4
197
192
  summary: Ruby client for DIDWW API v3
198
193
  test_files: []
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
- module DIDWW
3
- module ComplexObject
4
- module Configuration
5
- class H323Configuration < Base
6
- property :dst, type: :string
7
- # Type: String
8
- # Nullable: No
9
- # Description: Phone number
10
-
11
- property :host, type: :string
12
- # Type: String
13
- # Nullable: No
14
- # Description: Destination server
15
-
16
- property :port, type: :string
17
- # Type: String
18
- # Nullable: No
19
- # Description: Destination port
20
-
21
- property :codec_ids, type: :array
22
- # TODO array type
23
- # Type: Array
24
- # Nullable: No
25
- # Description:
26
-
27
- DEFAULTS = {
28
- codec_ids: DEFAULT_CODEC_IDS,
29
- dst: DID_PLACEHOLDER,
30
- }.freeze
31
-
32
- RECOMMENDED = {}.freeze
33
- end
34
- end
35
- end
36
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
- module DIDWW
3
- module ComplexObject
4
- module Configuration
5
- class Iax2Configuration < Base
6
- property :dst, type: :string
7
- # Type: String
8
- # Nullable: No
9
- # Description: Phone number
10
-
11
- property :host, type: :string
12
- # Type: String
13
- # Nullable: No
14
- # Description: Destination server
15
-
16
- property :port, type: :string
17
- # Type: String
18
- # Nullable: No
19
- # Description: Destination port
20
-
21
- property :auth_user, type: :string
22
- # Type: String
23
- # Nullable: No
24
- # Description: Optional authorization user
25
-
26
- property :auth_password, type: :string
27
- # Type: String
28
- # Nullable: No
29
- # Description: Optional authorization password
30
-
31
- property :codec_ids, type: :array
32
- # TODO array type
33
- # Type: Array
34
- # Nullable: No
35
- # Description:
36
-
37
- DEFAULTS = {
38
- codec_ids: DEFAULT_CODEC_IDS,
39
- dst: DID_PLACEHOLDER,
40
- }.freeze
41
-
42
- RECOMMENDED = {}.freeze
43
- end
44
- end
45
- end
46
- end