didww-v3 6.2.1 → 7.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/.github/workflows/tests.yml +8 -6
- data/.rubocop.yml +0 -110
- data/CHANGELOG.md +61 -0
- data/FILTERS.md +36 -12
- data/Gemfile +0 -2
- data/README.md +427 -56
- data/didww-v3.gemspec +11 -8
- data/docs/resource_relationships.md +35 -15
- data/examples/README.md +54 -61
- data/examples/capacity_pools.rb +28 -10
- data/examples/countries.rb +1 -1
- data/examples/did_groups.rb +1 -1
- data/examples/did_reservations.rb +35 -37
- data/examples/did_sms_routing.rb +91 -0
- data/examples/did_trunk_assignment.rb +106 -80
- data/examples/emergency_calling_services.rb +3 -3
- data/examples/emergency_requirements.rb +3 -3
- data/examples/emergency_scenario.rb +11 -11
- data/examples/emergency_verifications.rb +7 -5
- data/examples/exports.rb +1 -1
- data/examples/exports_sms.rb +72 -0
- data/examples/identity_address_proofs.rb +118 -0
- data/examples/includes.rb +65 -0
- data/examples/orders.rb +8 -6
- data/examples/orders_all_item_types.rb +63 -125
- data/examples/orders_emergency.rb +3 -3
- data/examples/{orders_by_sku.rb → orders_sku.rb} +12 -10
- data/examples/prices_download.rb +45 -0
- data/examples/prices_lookup.rb +43 -0
- data/examples/regions.rb +1 -1
- data/examples/sample.pdf +14 -0
- data/examples/sender_id_verifications.rb +63 -0
- data/examples/shared_capacity_groups.rb +44 -35
- data/examples/sms_trunk_groups.rb +71 -0
- data/examples/sms_trunks.rb +84 -0
- data/examples/test_readme.rb +1216 -0
- data/examples/trunks.rb +115 -0
- data/examples/upload_file.rb +44 -0
- data/examples/voice_in_trunk_groups.rb +57 -33
- data/examples/voice_in_trunk_sip_registration.rb +4 -1
- data/examples/voice_out_trunks.rb +11 -1
- data/examples/webhook.rb +51 -0
- data/lib/didww/auth/bearer_middleware.rb +74 -0
- data/lib/didww/auth/memory_store.rb +40 -0
- data/lib/didww/auth/token.rb +45 -0
- data/lib/didww/auth/token_provider.rb +215 -0
- data/lib/didww/base_middleware.rb +7 -8
- data/lib/didww/callback/request_validator.rb +2 -1
- data/lib/didww/client.rb +122 -13
- data/lib/didww/complex_objects/authentication_methods/generic.rb +6 -0
- data/lib/didww/complex_objects/configurations/base.rb +0 -18
- data/lib/didww/complex_objects/configurations/pstn_configuration.rb +0 -4
- data/lib/didww/complex_objects/configurations/sip_configuration.rb +86 -38
- data/lib/didww/complex_objects/emergency_order_item.rb +1 -1
- data/lib/didww/complex_objects/export_filters.rb +72 -6
- data/lib/didww/complex_objects/generic_order_item.rb +15 -0
- data/lib/didww/complex_objects/sms_trunk_configuration.rb +33 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/base.rb +26 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/generic.rb +32 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/http_in.rb +75 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/http_out.rb +35 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/smpp_esme.rb +37 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/smpp_smsc.rb +56 -0
- data/lib/didww/complex_objects/sms_trunk_configurations/sms_to_email.rb +27 -0
- data/lib/didww/errors.rb +103 -0
- data/lib/didww/http.rb +34 -0
- data/lib/didww/prices/lookup_result.rb +37 -0
- data/lib/didww/prices/price.rb +56 -0
- data/lib/didww/prices/price_file.rb +51 -0
- data/lib/didww/prices/service.rb +248 -0
- data/lib/didww/prices/sms_in_price.rb +43 -0
- data/lib/didww/prices/sms_out_price.rb +52 -0
- data/lib/didww/prices/voice_in_price.rb +48 -0
- data/lib/didww/prices/voice_out_price.rb +88 -0
- data/lib/didww/prices.rb +82 -0
- data/lib/didww/resource/address_requirement.rb +13 -3
- data/lib/didww/resource/base.rb +5 -2
- data/lib/didww/resource/concerns/number_types.rb +24 -0
- data/lib/didww/resource/did.rb +42 -3
- data/lib/didww/resource/did_group.rb +12 -1
- data/lib/didww/resource/emergency_calling_service.rb +10 -5
- data/lib/didww/resource/emergency_requirement.rb +27 -14
- data/lib/didww/resource/encrypted_file.rb +19 -6
- data/lib/didww/resource/export.rb +59 -12
- data/lib/didww/resource/identity.rb +9 -4
- data/lib/didww/resource/order.rb +1 -0
- data/lib/didww/resource/proof_type.rb +1 -1
- data/lib/didww/resource/sender_id_verification.rb +114 -0
- data/lib/didww/resource/sms_trunk.rb +76 -0
- data/lib/didww/resource/sms_trunk_group.rb +31 -0
- data/lib/didww/resource/sms_trunk_regenerate_credential.rb +16 -0
- data/lib/didww/resource/voice_in_trunk.rb +24 -1
- data/lib/didww/resource/voice_out_trunk.rb +72 -0
- data/lib/didww/types/ip_addresses.rb +1 -1
- data/lib/didww/types/strings.rb +1 -1
- data/lib/didww/types.rb +3 -1
- data/lib/didww/version.rb +1 -1
- data/lib/didww.rb +7 -0
- metadata +62 -24
- data/examples/identities_and_proofs.rb +0 -67
- data/examples/voice_in_trunks.rb +0 -108
- data/lib/didww/resource/did_group_type.rb +0 -10
- data/lib/didww/resource/exclusive_relationship.rb +0 -54
- data/lib/didww/resource/pop.rb +0 -10
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module DIDWW
|
|
3
|
+
module Resource
|
|
4
|
+
# Deleting a group also deletes the trunks in it.
|
|
5
|
+
class SmsTrunkGroup < Base
|
|
6
|
+
has_many :sms_trunks, class_name: 'SmsTrunk'
|
|
7
|
+
has_many :incoming_dids, class_name: 'Did'
|
|
8
|
+
|
|
9
|
+
property :name, type: :string
|
|
10
|
+
# Type: String
|
|
11
|
+
# Description: Friendly name of the group. Required when the group is created.
|
|
12
|
+
|
|
13
|
+
property :external_reference_id, type: :string
|
|
14
|
+
# Type: String
|
|
15
|
+
# Nullable: Yes
|
|
16
|
+
# Description: Customer-supplied reference. Max 100 characters.
|
|
17
|
+
|
|
18
|
+
property :created_at, type: :time
|
|
19
|
+
# Type: DateTime
|
|
20
|
+
# Description: Group created at DateTime. Read-only.
|
|
21
|
+
|
|
22
|
+
property :updated_at, type: :time
|
|
23
|
+
# Type: DateTime
|
|
24
|
+
# Description: Group updated at DateTime. Read-only.
|
|
25
|
+
|
|
26
|
+
def sms_trunks_count
|
|
27
|
+
attributes[:meta]&.[](:sms_trunks_count)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module Resource
|
|
5
|
+
# Rotates the generated credentials of an smpp_esme or http_out trunk.
|
|
6
|
+
# The new credentials are read back from the trunk.
|
|
7
|
+
class SmsTrunkRegenerateCredential < Base
|
|
8
|
+
has_one :sms_trunk
|
|
9
|
+
|
|
10
|
+
# The request declares no attributes; json_api_client would send "attributes": {}.
|
|
11
|
+
def as_json_api(*)
|
|
12
|
+
super.tap { |h| h.delete(:attributes) if h[:attributes].blank? }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -29,7 +29,25 @@ module DIDWW
|
|
|
29
29
|
CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
|
|
30
30
|
}.freeze
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
# Allowed values for trunk.pop
|
|
33
|
+
POP_NYC = 'nyc'
|
|
34
|
+
POP_FRA = 'fra'
|
|
35
|
+
POP_LAC = 'lac'
|
|
36
|
+
POP_MIA = 'mia'
|
|
37
|
+
POP_SG = 'sg'
|
|
38
|
+
POP_HK = 'hk'
|
|
39
|
+
POP_AMS = 'ams'
|
|
40
|
+
|
|
41
|
+
POPS = [
|
|
42
|
+
POP_NYC,
|
|
43
|
+
POP_FRA,
|
|
44
|
+
POP_LAC,
|
|
45
|
+
POP_MIA,
|
|
46
|
+
POP_SG,
|
|
47
|
+
POP_HK,
|
|
48
|
+
POP_AMS
|
|
49
|
+
].freeze
|
|
50
|
+
|
|
33
51
|
has_one :voice_in_trunk_group
|
|
34
52
|
|
|
35
53
|
property :priority, type: :integer
|
|
@@ -82,6 +100,11 @@ module DIDWW
|
|
|
82
100
|
# Type: String
|
|
83
101
|
# Description: Customer-supplied reference. Max 100 characters. (API 2026-04-16)
|
|
84
102
|
|
|
103
|
+
property :pop, type: :string
|
|
104
|
+
# Type: String
|
|
105
|
+
# Description: Point of presence the trunk is pinned to, one of POPS. Null lets DIDWW choose.
|
|
106
|
+
# Replaces the pop relationship.
|
|
107
|
+
|
|
85
108
|
def initialize(*args)
|
|
86
109
|
super
|
|
87
110
|
attribute_will_change!(:configuration) if configuration
|
|
@@ -51,6 +51,60 @@ module DIDWW
|
|
|
51
51
|
MEDIA_ENCRYPTION_MODE_ZRTP
|
|
52
52
|
].freeze
|
|
53
53
|
|
|
54
|
+
CODEC_TELEPHONE_EVENT = 'telephone_event'
|
|
55
|
+
CODEC_G723 = 'g723'
|
|
56
|
+
CODEC_G729 = 'g729'
|
|
57
|
+
CODEC_PCMU = 'pcmu'
|
|
58
|
+
CODEC_PCMA = 'pcma'
|
|
59
|
+
CODEC_GSM = 'gsm'
|
|
60
|
+
CODEC_G722 = 'g722'
|
|
61
|
+
CODEC_OPUS = 'opus'
|
|
62
|
+
CODEC_AMR = 'amr'
|
|
63
|
+
CODEC_AMR_WB = 'amr_wb'
|
|
64
|
+
|
|
65
|
+
CODECS = [
|
|
66
|
+
CODEC_TELEPHONE_EVENT,
|
|
67
|
+
CODEC_G723,
|
|
68
|
+
CODEC_G729,
|
|
69
|
+
CODEC_PCMU,
|
|
70
|
+
CODEC_PCMA,
|
|
71
|
+
CODEC_GSM,
|
|
72
|
+
CODEC_G722,
|
|
73
|
+
CODEC_OPUS,
|
|
74
|
+
CODEC_AMR,
|
|
75
|
+
CODEC_AMR_WB
|
|
76
|
+
].freeze
|
|
77
|
+
|
|
78
|
+
ICE_MODE_DISABLED = 'disabled'
|
|
79
|
+
ICE_MODE_ACCEPT = 'accept'
|
|
80
|
+
ICE_MODE_INITIATE = 'initiate'
|
|
81
|
+
|
|
82
|
+
ICE_MODES = [
|
|
83
|
+
ICE_MODE_DISABLED,
|
|
84
|
+
ICE_MODE_ACCEPT,
|
|
85
|
+
ICE_MODE_INITIATE
|
|
86
|
+
].freeze
|
|
87
|
+
|
|
88
|
+
RTCP_MUX_MODE_DISABLED = 'disabled'
|
|
89
|
+
RTCP_MUX_MODE_ACCEPT = 'accept'
|
|
90
|
+
RTCP_MUX_MODE_INITIATE = 'initiate'
|
|
91
|
+
|
|
92
|
+
RTCP_MUX_MODES = [
|
|
93
|
+
RTCP_MUX_MODE_DISABLED,
|
|
94
|
+
RTCP_MUX_MODE_ACCEPT,
|
|
95
|
+
RTCP_MUX_MODE_INITIATE
|
|
96
|
+
].freeze
|
|
97
|
+
|
|
98
|
+
RTCP_FEEDBACK_MODE_DISABLED = 'disabled'
|
|
99
|
+
RTCP_FEEDBACK_MODE_ACCEPT = 'accept'
|
|
100
|
+
RTCP_FEEDBACK_MODE_INITIATE = 'initiate'
|
|
101
|
+
|
|
102
|
+
RTCP_FEEDBACK_MODES = [
|
|
103
|
+
RTCP_FEEDBACK_MODE_DISABLED,
|
|
104
|
+
RTCP_FEEDBACK_MODE_ACCEPT,
|
|
105
|
+
RTCP_FEEDBACK_MODE_INITIATE
|
|
106
|
+
].freeze
|
|
107
|
+
|
|
54
108
|
property :name, type: :string
|
|
55
109
|
property :on_cli_mismatch_action, type: :string
|
|
56
110
|
property :capacity_limit, type: :integer
|
|
@@ -81,6 +135,24 @@ module DIDWW
|
|
|
81
135
|
# (API 2026-04-16)
|
|
82
136
|
property :rtp_timeout, type: :integer
|
|
83
137
|
|
|
138
|
+
# Type: Array of strings
|
|
139
|
+
# Description: Codecs offered on calls from the trunk, in priority order: the first has the
|
|
140
|
+
# highest priority. One or more of CODECS. Defaults to pcma, pcmu, telephone_event.
|
|
141
|
+
property :codecs, type: :strings
|
|
142
|
+
|
|
143
|
+
# Type: String
|
|
144
|
+
# Description: ICE (Interactive Connectivity Establishment) for calls from the trunk,
|
|
145
|
+
# one of ICE_MODES. Defaults to accept.
|
|
146
|
+
property :ice_mode, type: :string
|
|
147
|
+
|
|
148
|
+
# Type: String
|
|
149
|
+
# Description: RTP and RTCP multiplexed on one port, one of RTCP_MUX_MODES. Defaults to accept.
|
|
150
|
+
property :rtcp_mux_mode, type: :string
|
|
151
|
+
|
|
152
|
+
# Type: String
|
|
153
|
+
# Description: RTCP feedback (AVPF), one of RTCP_FEEDBACK_MODES. Defaults to accept.
|
|
154
|
+
property :rtcp_feedback_mode, type: :string
|
|
155
|
+
|
|
84
156
|
# Polymorphic authentication_method (2026-04-16). One of:
|
|
85
157
|
# - ip_only: { allowed_sip_ips, tech_prefix }
|
|
86
158
|
# - credentials_and_ip: { allowed_sip_ips, tech_prefix, username, password }
|
data/lib/didww/types/strings.rb
CHANGED
data/lib/didww/types.rb
CHANGED
|
@@ -6,9 +6,11 @@ require 'didww/types/strings'
|
|
|
6
6
|
require 'didww/complex_objects/base'
|
|
7
7
|
require 'didww/complex_objects/export_filters'
|
|
8
8
|
require 'didww/complex_objects/authentication_method'
|
|
9
|
+
require 'didww/complex_objects/sms_trunk_configuration'
|
|
9
10
|
|
|
10
11
|
JsonApiClient::Schema.register ip_addresses: DIDWW::Types::IpAddresses,
|
|
11
12
|
strings: DIDWW::Types::Strings,
|
|
12
13
|
complex_object: DIDWW::ComplexObject::Base,
|
|
13
14
|
export_filters: DIDWW::ComplexObject::ExportFilters,
|
|
14
|
-
authentication_method: DIDWW::ComplexObject::AuthenticationMethod::Base
|
|
15
|
+
authentication_method: DIDWW::ComplexObject::AuthenticationMethod::Base,
|
|
16
|
+
sms_trunk_configuration: DIDWW::ComplexObject::SmsTrunkConfiguration::Base
|
data/lib/didww/version.rb
CHANGED
data/lib/didww.rb
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'didww/version'
|
|
3
|
+
require 'didww/errors'
|
|
4
|
+
require 'didww/http'
|
|
5
|
+
require 'didww/auth/token'
|
|
6
|
+
require 'didww/auth/memory_store'
|
|
7
|
+
require 'didww/auth/token_provider'
|
|
8
|
+
require 'didww/auth/bearer_middleware'
|
|
3
9
|
require 'didww/client'
|
|
4
10
|
require 'didww/types'
|
|
5
11
|
require 'didww/base_middleware'
|
|
6
12
|
require 'didww/jsonapi_middleware'
|
|
7
13
|
require 'didww/callback/request_validator'
|
|
8
14
|
require 'didww/encrypt'
|
|
15
|
+
require 'didww/prices'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: didww-v3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 7.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Korobeinikov
|
|
@@ -30,75 +30,75 @@ dependencies:
|
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '9'
|
|
32
32
|
- !ruby/object:Gem::Dependency
|
|
33
|
-
name:
|
|
33
|
+
name: csv
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
36
|
- - "~>"
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
|
-
version: '
|
|
38
|
+
version: '3.0'
|
|
39
39
|
type: :runtime
|
|
40
40
|
prerelease: false
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
|
43
43
|
- - "~>"
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
45
|
+
version: '3.0'
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
|
-
name: faraday
|
|
47
|
+
name: faraday
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
|
50
50
|
- - "~>"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
52
|
+
version: '2.5'
|
|
53
53
|
type: :runtime
|
|
54
54
|
prerelease: false
|
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
57
|
- - "~>"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '
|
|
59
|
+
version: '2.5'
|
|
60
60
|
- !ruby/object:Gem::Dependency
|
|
61
|
-
name:
|
|
61
|
+
name: faraday-net_http
|
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
|
63
63
|
requirements:
|
|
64
|
-
- - "
|
|
64
|
+
- - ">="
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: '
|
|
66
|
+
version: '3.0'
|
|
67
67
|
type: :runtime
|
|
68
68
|
prerelease: false
|
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
|
-
- - "
|
|
71
|
+
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '
|
|
73
|
+
version: '3.0'
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
|
-
name:
|
|
75
|
+
name: faraday-multipart
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - "~>"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '
|
|
80
|
+
version: '1.0'
|
|
81
81
|
type: :runtime
|
|
82
82
|
prerelease: false
|
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements:
|
|
85
85
|
- - "~>"
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '
|
|
87
|
+
version: '1.0'
|
|
88
88
|
- !ruby/object:Gem::Dependency
|
|
89
|
-
name:
|
|
89
|
+
name: json_api_client
|
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements:
|
|
92
92
|
- - "~>"
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: '
|
|
94
|
+
version: '1.23'
|
|
95
95
|
type: :runtime
|
|
96
96
|
prerelease: false
|
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements:
|
|
99
99
|
- - "~>"
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '
|
|
101
|
+
version: '1.23'
|
|
102
102
|
- !ruby/object:Gem::Dependency
|
|
103
103
|
name: openssl-oaep
|
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -146,6 +146,7 @@ files:
|
|
|
146
146
|
- examples/did_groups.rb
|
|
147
147
|
- examples/did_history.rb
|
|
148
148
|
- examples/did_reservations.rb
|
|
149
|
+
- examples/did_sms_routing.rb
|
|
149
150
|
- examples/did_trunk_assignment.rb
|
|
150
151
|
- examples/dids.rb
|
|
151
152
|
- examples/emergency_calling_services.rb
|
|
@@ -154,22 +155,37 @@ files:
|
|
|
154
155
|
- examples/emergency_scenario.rb
|
|
155
156
|
- examples/emergency_verifications.rb
|
|
156
157
|
- examples/exports.rb
|
|
157
|
-
- examples/
|
|
158
|
+
- examples/exports_sms.rb
|
|
159
|
+
- examples/identity_address_proofs.rb
|
|
160
|
+
- examples/includes.rb
|
|
158
161
|
- examples/orders.rb
|
|
159
162
|
- examples/orders_all_item_types.rb
|
|
160
163
|
- examples/orders_available_dids.rb
|
|
161
|
-
- examples/orders_by_sku.rb
|
|
162
164
|
- examples/orders_capacity.rb
|
|
163
165
|
- examples/orders_emergency.rb
|
|
164
166
|
- examples/orders_nanpa.rb
|
|
165
167
|
- examples/orders_reservation_dids.rb
|
|
168
|
+
- examples/orders_sku.rb
|
|
169
|
+
- examples/prices_download.rb
|
|
170
|
+
- examples/prices_lookup.rb
|
|
166
171
|
- examples/regions.rb
|
|
172
|
+
- examples/sample.pdf
|
|
173
|
+
- examples/sender_id_verifications.rb
|
|
167
174
|
- examples/shared_capacity_groups.rb
|
|
175
|
+
- examples/sms_trunk_groups.rb
|
|
176
|
+
- examples/sms_trunks.rb
|
|
177
|
+
- examples/test_readme.rb
|
|
178
|
+
- examples/trunks.rb
|
|
179
|
+
- examples/upload_file.rb
|
|
168
180
|
- examples/voice_in_trunk_groups.rb
|
|
169
181
|
- examples/voice_in_trunk_sip_registration.rb
|
|
170
|
-
- examples/voice_in_trunks.rb
|
|
171
182
|
- examples/voice_out_trunks.rb
|
|
183
|
+
- examples/webhook.rb
|
|
172
184
|
- lib/didww.rb
|
|
185
|
+
- lib/didww/auth/bearer_middleware.rb
|
|
186
|
+
- lib/didww/auth/memory_store.rb
|
|
187
|
+
- lib/didww/auth/token.rb
|
|
188
|
+
- lib/didww/auth/token_provider.rb
|
|
173
189
|
- lib/didww/base_middleware.rb
|
|
174
190
|
- lib/didww/callback/const.rb
|
|
175
191
|
- lib/didww/callback/request_validator.rb
|
|
@@ -189,8 +205,28 @@ files:
|
|
|
189
205
|
- lib/didww/complex_objects/did_order_item.rb
|
|
190
206
|
- lib/didww/complex_objects/emergency_order_item.rb
|
|
191
207
|
- lib/didww/complex_objects/export_filters.rb
|
|
208
|
+
- lib/didww/complex_objects/generic_order_item.rb
|
|
209
|
+
- lib/didww/complex_objects/sms_trunk_configuration.rb
|
|
210
|
+
- lib/didww/complex_objects/sms_trunk_configurations/base.rb
|
|
211
|
+
- lib/didww/complex_objects/sms_trunk_configurations/generic.rb
|
|
212
|
+
- lib/didww/complex_objects/sms_trunk_configurations/http_in.rb
|
|
213
|
+
- lib/didww/complex_objects/sms_trunk_configurations/http_out.rb
|
|
214
|
+
- lib/didww/complex_objects/sms_trunk_configurations/smpp_esme.rb
|
|
215
|
+
- lib/didww/complex_objects/sms_trunk_configurations/smpp_smsc.rb
|
|
216
|
+
- lib/didww/complex_objects/sms_trunk_configurations/sms_to_email.rb
|
|
192
217
|
- lib/didww/encrypt.rb
|
|
218
|
+
- lib/didww/errors.rb
|
|
219
|
+
- lib/didww/http.rb
|
|
193
220
|
- lib/didww/jsonapi_middleware.rb
|
|
221
|
+
- lib/didww/prices.rb
|
|
222
|
+
- lib/didww/prices/lookup_result.rb
|
|
223
|
+
- lib/didww/prices/price.rb
|
|
224
|
+
- lib/didww/prices/price_file.rb
|
|
225
|
+
- lib/didww/prices/service.rb
|
|
226
|
+
- lib/didww/prices/sms_in_price.rb
|
|
227
|
+
- lib/didww/prices/sms_out_price.rb
|
|
228
|
+
- lib/didww/prices/voice_in_price.rb
|
|
229
|
+
- lib/didww/prices/voice_out_price.rb
|
|
194
230
|
- lib/didww/resource/address.rb
|
|
195
231
|
- lib/didww/resource/address_requirement.rb
|
|
196
232
|
- lib/didww/resource/address_requirement_validation.rb
|
|
@@ -202,10 +238,10 @@ files:
|
|
|
202
238
|
- lib/didww/resource/capacity_pool.rb
|
|
203
239
|
- lib/didww/resource/city.rb
|
|
204
240
|
- lib/didww/resource/concerns/has_status_helpers.rb
|
|
241
|
+
- lib/didww/resource/concerns/number_types.rb
|
|
205
242
|
- lib/didww/resource/country.rb
|
|
206
243
|
- lib/didww/resource/did.rb
|
|
207
244
|
- lib/didww/resource/did_group.rb
|
|
208
|
-
- lib/didww/resource/did_group_type.rb
|
|
209
245
|
- lib/didww/resource/did_history.rb
|
|
210
246
|
- lib/didww/resource/did_reservation.rb
|
|
211
247
|
- lib/didww/resource/emergency_calling_service.rb
|
|
@@ -213,19 +249,21 @@ files:
|
|
|
213
249
|
- lib/didww/resource/emergency_requirement_validation.rb
|
|
214
250
|
- lib/didww/resource/emergency_verification.rb
|
|
215
251
|
- lib/didww/resource/encrypted_file.rb
|
|
216
|
-
- lib/didww/resource/exclusive_relationship.rb
|
|
217
252
|
- lib/didww/resource/export.rb
|
|
218
253
|
- lib/didww/resource/identity.rb
|
|
219
254
|
- lib/didww/resource/nanpa_prefix.rb
|
|
220
255
|
- lib/didww/resource/order.rb
|
|
221
256
|
- lib/didww/resource/permanent_supporting_document.rb
|
|
222
|
-
- lib/didww/resource/pop.rb
|
|
223
257
|
- lib/didww/resource/proof.rb
|
|
224
258
|
- lib/didww/resource/proof_type.rb
|
|
225
259
|
- lib/didww/resource/public_key.rb
|
|
226
260
|
- lib/didww/resource/qty_based_pricing.rb
|
|
227
261
|
- lib/didww/resource/region.rb
|
|
262
|
+
- lib/didww/resource/sender_id_verification.rb
|
|
228
263
|
- lib/didww/resource/shared_capacity_group.rb
|
|
264
|
+
- lib/didww/resource/sms_trunk.rb
|
|
265
|
+
- lib/didww/resource/sms_trunk_group.rb
|
|
266
|
+
- lib/didww/resource/sms_trunk_regenerate_credential.rb
|
|
229
267
|
- lib/didww/resource/stock_keeping_unit.rb
|
|
230
268
|
- lib/didww/resource/supporting_document_template.rb
|
|
231
269
|
- lib/didww/resource/voice_in_trunk.rb
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# Lists identities, addresses, and proofs. Demonstrates compliance workflow.
|
|
3
|
-
#
|
|
4
|
-
# Usage: DIDWW_API_KEY=your_api_key ruby examples/identities_and_proofs.rb
|
|
5
|
-
|
|
6
|
-
require 'bundler/setup'
|
|
7
|
-
require 'didww'
|
|
8
|
-
|
|
9
|
-
DIDWW::Client.configure do |client|
|
|
10
|
-
client.api_key = ENV.fetch('DIDWW_API_KEY') { abort 'Please set DIDWW_API_KEY' }
|
|
11
|
-
client.api_mode = :sandbox
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# List identities (include country + birth_country, 2026-04-16 adds birth_country)
|
|
15
|
-
puts '=== Identities ==='
|
|
16
|
-
identities = DIDWW::Client.identities
|
|
17
|
-
.includes(:country, :birth_country)
|
|
18
|
-
.all
|
|
19
|
-
puts "Found #{identities.size} identities"
|
|
20
|
-
|
|
21
|
-
identities.first(10).each do |identity|
|
|
22
|
-
puts "\nIdentity: #{identity.id}"
|
|
23
|
-
puts " Name: #{identity.first_name} #{identity.last_name}"
|
|
24
|
-
puts " Phone: #{identity.phone_number}"
|
|
25
|
-
puts " Type: #{identity.identity_type}"
|
|
26
|
-
puts " Country: #{identity.country&.name}"
|
|
27
|
-
puts " Birth Country: #{identity.birth_country&.name}" # 2026-04-16
|
|
28
|
-
puts " Birth Date: #{identity.birth_date}"
|
|
29
|
-
puts " Verified: #{identity.verified}"
|
|
30
|
-
puts " Created: #{identity.created_at}"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# List addresses
|
|
34
|
-
puts "\n=== Addresses ==="
|
|
35
|
-
addresses = DIDWW::Client.addresses
|
|
36
|
-
.includes(:identity)
|
|
37
|
-
.all
|
|
38
|
-
|
|
39
|
-
puts "Found #{addresses.size} addresses"
|
|
40
|
-
|
|
41
|
-
addresses.first(10).each do |address|
|
|
42
|
-
puts "\nAddress: #{address.id}"
|
|
43
|
-
puts " Street: #{address.address}"
|
|
44
|
-
puts " City: #{address.city_name}"
|
|
45
|
-
puts " Postal Code: #{address.postal_code}"
|
|
46
|
-
puts " Verified: #{address.verified}"
|
|
47
|
-
if address.identity
|
|
48
|
-
puts " Identity: #{address.identity.first_name} #{address.identity.last_name}"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# List proof types
|
|
53
|
-
puts "\n=== Proof Types ==="
|
|
54
|
-
proof_types = DIDWW::Client.proof_types.all
|
|
55
|
-
puts "Found #{proof_types.size} proof types"
|
|
56
|
-
|
|
57
|
-
proof_types.first(10).each do |pt|
|
|
58
|
-
puts "#{pt.name} (#{pt.entity_type})"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
puts "\n=== Identities and Proofs Workflow ==="
|
|
62
|
-
puts '1. Create an identity with personal information'
|
|
63
|
-
puts '2. Create an address linked to the identity'
|
|
64
|
-
puts '3. Encrypt and upload identity/address documents'
|
|
65
|
-
puts '4. Create proofs attached to identity/address with uploaded files'
|
|
66
|
-
puts '5. Monitor verification status'
|
|
67
|
-
puts "\nNote: Creating and uploading encrypted files requires additional SDK setup."
|
data/examples/voice_in_trunks.rb
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# Lists voice in trunks and their configurations.
|
|
3
|
-
#
|
|
4
|
-
# Usage: DIDWW_API_KEY=your_api_key ruby examples/voice_in_trunks.rb
|
|
5
|
-
|
|
6
|
-
require 'bundler/setup'
|
|
7
|
-
require 'didww'
|
|
8
|
-
|
|
9
|
-
DIDWW::Client.configure do |client|
|
|
10
|
-
client.api_key = ENV.fetch('DIDWW_API_KEY') { abort 'Please set DIDWW_API_KEY' }
|
|
11
|
-
client.api_mode = :sandbox
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# List voice in trunks with included relationships
|
|
15
|
-
puts '=== Existing Trunks ==='
|
|
16
|
-
trunks = DIDWW::Client.voice_in_trunks
|
|
17
|
-
.includes(:pop, :voice_in_trunk_group)
|
|
18
|
-
.all
|
|
19
|
-
|
|
20
|
-
puts "Found #{trunks.size} trunks"
|
|
21
|
-
trunks.first(10).each do |trunk|
|
|
22
|
-
config_type = trunk.configuration ? trunk.configuration.class.name.split('::').last : 'unknown'
|
|
23
|
-
puts "#{trunk.name} [#{config_type}]"
|
|
24
|
-
puts " ID: #{trunk.id}"
|
|
25
|
-
puts " Priority: #{trunk.priority}"
|
|
26
|
-
puts " Weight: #{trunk.weight}"
|
|
27
|
-
puts " CLI Format: #{trunk.cli_format}"
|
|
28
|
-
puts " Ringing Timeout: #{trunk.ringing_timeout}"
|
|
29
|
-
if trunk.pop
|
|
30
|
-
puts " POP: #{trunk.pop.name}"
|
|
31
|
-
end
|
|
32
|
-
puts ''
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Find a specific trunk by ID
|
|
36
|
-
if !trunks.empty?
|
|
37
|
-
puts "\n=== Specific Trunk Details ==="
|
|
38
|
-
specific_trunk = DIDWW::Client.voice_in_trunks.find(trunks.first.id).first
|
|
39
|
-
puts "Trunk: #{specific_trunk.name}"
|
|
40
|
-
puts " ID: #{specific_trunk.id}"
|
|
41
|
-
puts " Description: #{specific_trunk.description}"
|
|
42
|
-
puts " Created at: #{specific_trunk.created_at}"
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# 2026-04-16 — surface the API 2026-04-16 SIP-registration-related attributes when
|
|
46
|
-
# the trunk uses a SIP configuration. `incoming_auth_username` /
|
|
47
|
-
# `incoming_auth_password` are server-generated and only present when
|
|
48
|
-
# `enabled_sip_registration` is true.
|
|
49
|
-
sip_trunk = trunks.find { |t| t.configuration.is_a?(DIDWW::ComplexObject::SipConfiguration) }
|
|
50
|
-
if sip_trunk
|
|
51
|
-
puts "\n=== SIP Configuration (2026-04-16 attributes) ==="
|
|
52
|
-
config = sip_trunk.configuration
|
|
53
|
-
puts "Trunk: #{sip_trunk.name}"
|
|
54
|
-
puts " enabled_sip_registration: #{config.enabled_sip_registration.inspect}"
|
|
55
|
-
puts " use_did_in_ruri: #{config.use_did_in_ruri.inspect}"
|
|
56
|
-
puts " network_protocol_priority: #{config.network_protocol_priority.inspect}"
|
|
57
|
-
puts " diversion_relay_policy: #{config.diversion_relay_policy.inspect}"
|
|
58
|
-
puts " diversion_inject_mode: #{config.diversion_inject_mode.inspect}"
|
|
59
|
-
puts " cnam_lookup: #{config.cnam_lookup.inspect}"
|
|
60
|
-
if config.enabled_sip_registration
|
|
61
|
-
puts " incoming_auth_username: #{config.incoming_auth_username.inspect}"
|
|
62
|
-
puts " incoming_auth_password: #{config.incoming_auth_password.inspect}"
|
|
63
|
-
else
|
|
64
|
-
puts ' (incoming_auth credentials only appear when SIP registration is enabled)'
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Example: create a new SIP trunk with SIP registration enabled. The server
|
|
69
|
-
# generates `incoming_auth_username` / `incoming_auth_password` and returns
|
|
70
|
-
# them in the response. They are READ-ONLY — sending them on POST/PATCH
|
|
71
|
-
# returns 400 Param not allowed; the SDK strips them from write payloads.
|
|
72
|
-
#
|
|
73
|
-
# Server-side rules to keep in mind:
|
|
74
|
-
# * When `enabled_sip_registration: true`, `host` and `port` MUST be left
|
|
75
|
-
# blank (the server will register inbound and pick the host itself).
|
|
76
|
-
# * When DISABLING SIP registration on an existing trunk, you must
|
|
77
|
-
# simultaneously set `host` to a non-blank value and `use_did_in_ruri`
|
|
78
|
-
# to `false` in the same PATCH — otherwise the server returns 422.
|
|
79
|
-
#
|
|
80
|
-
# Uncomment to actually create a trunk in your sandbox account:
|
|
81
|
-
#
|
|
82
|
-
# new_trunk = DIDWW::Resource::VoiceInTrunk.new(
|
|
83
|
-
# name: "SIP-registration trunk #{Time.now.to_i}",
|
|
84
|
-
# priority: 1,
|
|
85
|
-
# weight: 100,
|
|
86
|
-
# cli_format: 'e164',
|
|
87
|
-
# ringing_timeout: 30,
|
|
88
|
-
# configuration: DIDWW::ComplexObject::SipConfiguration.new(
|
|
89
|
-
# # NOTE: do NOT set `host` here — the server requires it to be blank
|
|
90
|
-
# # when enabled_sip_registration is true.
|
|
91
|
-
# enabled_sip_registration: true,
|
|
92
|
-
# use_did_in_ruri: true,
|
|
93
|
-
# cnam_lookup: false,
|
|
94
|
-
# diversion_relay_policy: 'as_is',
|
|
95
|
-
# diversion_inject_mode: 'did_number',
|
|
96
|
-
# network_protocol_priority: 'prefer_ipv4',
|
|
97
|
-
# codec_ids: [9, 7],
|
|
98
|
-
# transport_protocol_id: 1
|
|
99
|
-
# )
|
|
100
|
-
# )
|
|
101
|
-
# created = new_trunk.save
|
|
102
|
-
# if created
|
|
103
|
-
# puts "Created trunk #{new_trunk.id}"
|
|
104
|
-
# puts " incoming_auth_username: #{new_trunk.configuration.incoming_auth_username}"
|
|
105
|
-
# puts " incoming_auth_password: #{new_trunk.configuration.incoming_auth_password}"
|
|
106
|
-
# else
|
|
107
|
-
# puts "Errors: #{new_trunk.errors.full_messages}"
|
|
108
|
-
# end
|