didww-v3 6.2.0 → 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 +65 -0
- data/FILTERS.md +36 -12
- data/Gemfile +0 -2
- data/README.md +431 -58
- 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 +7 -5
- 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 +63 -25
- 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
|
@@ -139,11 +139,30 @@ module DIDWW
|
|
|
139
139
|
# Nullable: No
|
|
140
140
|
# Description: Rerouting disconnect codes
|
|
141
141
|
|
|
142
|
-
property :
|
|
143
|
-
#
|
|
144
|
-
#
|
|
142
|
+
property :codecs, type: :strings
|
|
143
|
+
# Type: Array of strings
|
|
144
|
+
# Nullable: No
|
|
145
|
+
# Description: Codecs offered on calls to the trunk, in priority order: the first has the
|
|
146
|
+
# highest priority. See CODECS for available values. Defaults to pcmu, pcma, g729, g723,
|
|
147
|
+
# telephone_event.
|
|
148
|
+
|
|
149
|
+
property :ice_mode, type: :string
|
|
150
|
+
# Type: String
|
|
151
|
+
# Nullable: No
|
|
152
|
+
# Description: ICE (Interactive Connectivity Establishment) for calls to the trunk.
|
|
153
|
+
# See ICE_MODES for available values. Defaults to disabled.
|
|
154
|
+
|
|
155
|
+
property :rtcp_mux_mode, type: :string
|
|
156
|
+
# Type: String
|
|
157
|
+
# Nullable: No
|
|
158
|
+
# Description: RTP and RTCP multiplexed on one port. See RTCP_MUX_MODES for available values.
|
|
159
|
+
# Defaults to disabled.
|
|
160
|
+
|
|
161
|
+
property :rtcp_feedback_mode, type: :string
|
|
162
|
+
# Type: String
|
|
145
163
|
# Nullable: No
|
|
146
|
-
# Description:
|
|
164
|
+
# Description: RTCP feedback (AVPF). See RTCP_FEEDBACK_MODES for available values.
|
|
165
|
+
# Defaults to disabled.
|
|
147
166
|
|
|
148
167
|
property :transport_protocol_id, type: :integer
|
|
149
168
|
# Type: Integer
|
|
@@ -277,40 +296,69 @@ module DIDWW
|
|
|
277
296
|
'verstat'
|
|
278
297
|
].freeze
|
|
279
298
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
299
|
+
CODEC_TELEPHONE_EVENT = 'telephone_event'
|
|
300
|
+
CODEC_G723 = 'g723'
|
|
301
|
+
CODEC_G729 = 'g729'
|
|
302
|
+
CODEC_PCMU = 'pcmu'
|
|
303
|
+
CODEC_PCMA = 'pcma'
|
|
304
|
+
CODEC_SPEEX = 'speex'
|
|
305
|
+
CODEC_GSM = 'gsm'
|
|
306
|
+
CODEC_G726_32 = 'g726_32'
|
|
307
|
+
CODEC_G721 = 'g721'
|
|
308
|
+
CODEC_G726_24 = 'g726_24'
|
|
309
|
+
CODEC_G726_40 = 'g726_40'
|
|
310
|
+
CODEC_G726_16 = 'g726_16'
|
|
311
|
+
CODEC_L16 = 'l16'
|
|
312
|
+
CODEC_AMR = 'amr'
|
|
313
|
+
CODEC_AMR_WB = 'amr_wb'
|
|
314
|
+
|
|
315
|
+
CODECS = [
|
|
316
|
+
CODEC_TELEPHONE_EVENT,
|
|
317
|
+
CODEC_G723,
|
|
318
|
+
CODEC_G729,
|
|
319
|
+
CODEC_PCMU,
|
|
320
|
+
CODEC_PCMA,
|
|
321
|
+
CODEC_SPEEX,
|
|
322
|
+
CODEC_GSM,
|
|
323
|
+
CODEC_G726_32,
|
|
324
|
+
CODEC_G721,
|
|
325
|
+
CODEC_G726_24,
|
|
326
|
+
CODEC_G726_40,
|
|
327
|
+
CODEC_G726_16,
|
|
328
|
+
CODEC_L16,
|
|
329
|
+
CODEC_AMR,
|
|
330
|
+
CODEC_AMR_WB
|
|
331
|
+
].freeze
|
|
332
|
+
|
|
333
|
+
ICE_MODE_DISABLED = 'disabled'
|
|
334
|
+
ICE_MODE_ACCEPT = 'accept'
|
|
335
|
+
ICE_MODE_INITIATE = 'initiate'
|
|
336
|
+
|
|
337
|
+
ICE_MODES = [
|
|
338
|
+
ICE_MODE_DISABLED,
|
|
339
|
+
ICE_MODE_ACCEPT,
|
|
340
|
+
ICE_MODE_INITIATE
|
|
341
|
+
].freeze
|
|
342
|
+
|
|
343
|
+
RTCP_MUX_MODE_DISABLED = 'disabled'
|
|
344
|
+
RTCP_MUX_MODE_ACCEPT = 'accept'
|
|
345
|
+
RTCP_MUX_MODE_INITIATE = 'initiate'
|
|
346
|
+
|
|
347
|
+
RTCP_MUX_MODES = [
|
|
348
|
+
RTCP_MUX_MODE_DISABLED,
|
|
349
|
+
RTCP_MUX_MODE_ACCEPT,
|
|
350
|
+
RTCP_MUX_MODE_INITIATE
|
|
351
|
+
].freeze
|
|
352
|
+
|
|
353
|
+
RTCP_FEEDBACK_MODE_DISABLED = 'disabled'
|
|
354
|
+
RTCP_FEEDBACK_MODE_ACCEPT = 'accept'
|
|
355
|
+
RTCP_FEEDBACK_MODE_INITIATE = 'initiate'
|
|
356
|
+
|
|
357
|
+
RTCP_FEEDBACK_MODES = [
|
|
358
|
+
RTCP_FEEDBACK_MODE_DISABLED,
|
|
359
|
+
RTCP_FEEDBACK_MODE_ACCEPT,
|
|
360
|
+
RTCP_FEEDBACK_MODE_INITIATE
|
|
361
|
+
].freeze
|
|
314
362
|
|
|
315
363
|
def sst_refresh_method
|
|
316
364
|
SST_REFRESH_METHODS[sst_refresh_method_id]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module DIDWW
|
|
3
3
|
module ComplexObject
|
|
4
4
|
class EmergencyOrderItem < Base
|
|
5
|
-
#
|
|
5
|
+
# returned; the API creates emergency orders, POST /orders does not accept these items
|
|
6
6
|
property :qty, type: :int
|
|
7
7
|
property :emergency_calling_service_id, type: :string
|
|
8
8
|
|
|
@@ -4,20 +4,86 @@ require 'json_api_client/schema'
|
|
|
4
4
|
module DIDWW
|
|
5
5
|
module ComplexObject
|
|
6
6
|
class ExportFilters < Base
|
|
7
|
+
# Allowed values for trunk_type (sms_in only)
|
|
8
|
+
TRUNK_TYPE_SMPP_SMSC = 'smpp_smsc'
|
|
9
|
+
TRUNK_TYPE_SMPP_ESME = 'smpp_esme'
|
|
10
|
+
TRUNK_TYPE_SMS_TO_EMAIL = 'sms_to_email'
|
|
11
|
+
TRUNK_TYPE_HTTP_IN = 'http_in'
|
|
12
|
+
|
|
13
|
+
TRUNK_TYPES = [
|
|
14
|
+
TRUNK_TYPE_SMPP_SMSC,
|
|
15
|
+
TRUNK_TYPE_SMPP_ESME,
|
|
16
|
+
TRUNK_TYPE_SMS_TO_EMAIL,
|
|
17
|
+
TRUNK_TYPE_HTTP_IN
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
# Allowed values for service_type (sms_out only)
|
|
21
|
+
SERVICE_TYPE_A2P = 'a2p'
|
|
22
|
+
SERVICE_TYPE_P2P = 'p2p'
|
|
23
|
+
|
|
24
|
+
SERVICE_TYPES = [
|
|
25
|
+
SERVICE_TYPE_A2P,
|
|
26
|
+
SERVICE_TYPE_P2P
|
|
27
|
+
].freeze
|
|
28
|
+
|
|
29
|
+
# Ruby-friendly property names for the dotted keys on the wire
|
|
30
|
+
DOTTED_KEYS = {
|
|
31
|
+
'voice_out_trunk_id' => 'voice_out_trunk.id',
|
|
32
|
+
'sms_trunk_id' => 'sms_trunk.id',
|
|
33
|
+
'sender_id_verification_id' => 'sender_id_verification.id'
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
7
36
|
# Type casting for JsonApiClient parser/setters
|
|
8
37
|
def self.cast_single_object(hash)
|
|
9
38
|
new(hash)
|
|
10
39
|
end
|
|
11
40
|
|
|
12
|
-
|
|
13
|
-
property :
|
|
14
|
-
property :
|
|
15
|
-
|
|
41
|
+
# Every export type
|
|
42
|
+
property :from, type: :string # "YYYY-MM-DD HH:MM:SS" UTC lower bound, INCLUSIVE (time_start >= from). Required.
|
|
43
|
+
property :to, type: :string # "YYYY-MM-DD HH:MM:SS" UTC upper bound, EXCLUSIVE (time_start < to). Required.
|
|
44
|
+
|
|
45
|
+
# cdr_in
|
|
46
|
+
property :did_number, type: :string
|
|
47
|
+
property :source_number, type: :string
|
|
48
|
+
property :source_number_out, type: :string
|
|
49
|
+
property :source_country_iso, type: :string
|
|
50
|
+
|
|
51
|
+
# cdr_out
|
|
52
|
+
property :voice_out_trunk_id, type: :string # sent as voice_out_trunk.id
|
|
53
|
+
property :source, type: :string
|
|
54
|
+
property :cli, type: :string
|
|
55
|
+
property :destination, type: :string
|
|
56
|
+
|
|
57
|
+
# sms_in and sms_out
|
|
58
|
+
property :source_address_eq, type: :string
|
|
59
|
+
property :source_address_cont, type: :string
|
|
60
|
+
property :destination_address_eq, type: :string
|
|
61
|
+
property :destination_address_cont, type: :string
|
|
62
|
+
# sms_in: success, failed, queued; sms_out: routing_error, in_progress, queued, failed, success
|
|
63
|
+
property :status, type: :string
|
|
64
|
+
property :sms_trunk_id # String or Array of Strings, sent as sms_trunk.id
|
|
65
|
+
property :sms_id, type: :string
|
|
66
|
+
|
|
67
|
+
# sms_in only
|
|
68
|
+
property :trunk_type # String or Array of Strings from TRUNK_TYPES
|
|
69
|
+
|
|
70
|
+
# sms_out only
|
|
71
|
+
property :service_type, type: :string # one of SERVICE_TYPES, lowercase
|
|
72
|
+
property :sender_id_verification_id # String or Array of Strings, sent as sender_id_verification.id
|
|
73
|
+
|
|
74
|
+
# Returned on exports created at earlier API versions only
|
|
75
|
+
property :year, type: :string, read_only: true
|
|
76
|
+
property :month, type: :string, read_only: true
|
|
77
|
+
property :day, type: :string, read_only: true
|
|
78
|
+
|
|
79
|
+
def initialize(params = {})
|
|
80
|
+
super(params.to_h.transform_keys { |key| DOTTED_KEYS.key(key.to_s) || key })
|
|
81
|
+
end
|
|
16
82
|
|
|
17
83
|
def as_json(*)
|
|
18
84
|
result = attributes.as_json.with_indifferent_access
|
|
19
|
-
result[
|
|
20
|
-
result
|
|
85
|
+
DOTTED_KEYS.each { |name, wire_key| result[wire_key] = result.delete(name) if result.key?(name) }
|
|
86
|
+
result.except(*self.class.read_only_attributes)
|
|
21
87
|
end
|
|
22
88
|
|
|
23
89
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module DIDWW
|
|
3
|
+
module ComplexObject
|
|
4
|
+
# An order item for any other charge, such as a Sender ID verification.
|
|
5
|
+
# It is returned only; orders are not created with it.
|
|
6
|
+
class GenericOrderItem < Base
|
|
7
|
+
property :qty, type: :int
|
|
8
|
+
property :nrc, type: :decimal
|
|
9
|
+
property :mrc, type: :decimal
|
|
10
|
+
property :prorated_mrc, type: :boolean
|
|
11
|
+
property :billed_from, type: :string
|
|
12
|
+
property :billed_to, type: :string
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'didww/complex_objects/sms_trunk_configurations/base'
|
|
3
|
+
require 'didww/complex_objects/sms_trunk_configurations/generic'
|
|
4
|
+
require 'didww/complex_objects/sms_trunk_configurations/sms_to_email'
|
|
5
|
+
require 'didww/complex_objects/sms_trunk_configurations/http_in'
|
|
6
|
+
require 'didww/complex_objects/sms_trunk_configurations/http_out'
|
|
7
|
+
require 'didww/complex_objects/sms_trunk_configurations/smpp_esme'
|
|
8
|
+
require 'didww/complex_objects/sms_trunk_configurations/smpp_smsc'
|
|
9
|
+
|
|
10
|
+
module DIDWW
|
|
11
|
+
module ComplexObject
|
|
12
|
+
module SmsTrunkConfiguration
|
|
13
|
+
TYPE_CLASSES = [
|
|
14
|
+
SmsToEmail,
|
|
15
|
+
HttpIn,
|
|
16
|
+
HttpOut,
|
|
17
|
+
SmppEsme,
|
|
18
|
+
SmppSmsc
|
|
19
|
+
].to_h { |klass| [klass.type, klass] }.freeze
|
|
20
|
+
|
|
21
|
+
TYPES = TYPE_CLASSES.keys.freeze
|
|
22
|
+
|
|
23
|
+
# Production accepts nyc and ams; the sandbox accepts nyc only.
|
|
24
|
+
SERVER_LOCATION_NYC = 'nyc'
|
|
25
|
+
SERVER_LOCATION_AMS = 'ams'
|
|
26
|
+
|
|
27
|
+
SERVER_LOCATIONS = [
|
|
28
|
+
SERVER_LOCATION_NYC,
|
|
29
|
+
SERVER_LOCATION_AMS
|
|
30
|
+
].freeze
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
class Base < ComplexObject::Base
|
|
7
|
+
class << self
|
|
8
|
+
protected
|
|
9
|
+
|
|
10
|
+
# Resolves the subclass from the explicit TYPE_CLASSES map: the wire types
|
|
11
|
+
# (sms_to_email, http_in, ...) are not pluralized class names. An unknown
|
|
12
|
+
# type is wrapped in Generic so it round-trips through PATCH.
|
|
13
|
+
def cast_single_object(hash)
|
|
14
|
+
hash = hash.with_indifferent_access
|
|
15
|
+
klass = SmsTrunkConfiguration::TYPE_CLASSES[hash[:type]]
|
|
16
|
+
if klass
|
|
17
|
+
klass.new(hash[:attributes] || {})
|
|
18
|
+
else
|
|
19
|
+
Generic.new(hash[:attributes] || {}, hash[:type])
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# Fallback for a configuration type this gem version does not know yet.
|
|
7
|
+
# Keeps the type and attributes as received.
|
|
8
|
+
class Generic < Base
|
|
9
|
+
attr_reader :stored_type
|
|
10
|
+
|
|
11
|
+
def initialize(params = {}, stored_type = nil)
|
|
12
|
+
@stored_type = stored_type
|
|
13
|
+
params.each { |k, v| attributes[k] = v }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def type
|
|
17
|
+
stored_type || self.class.type
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def as_json(*)
|
|
21
|
+
{ type: type, attributes: attributes.as_json }.with_indifferent_access
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Every value is redacted: which attributes of an unknown type carry credentials is not known.
|
|
25
|
+
def inspect
|
|
26
|
+
formatted = attributes.map { |k, v| "#{k}=#{(v.nil? ? v : FILTERED).inspect}" }
|
|
27
|
+
"#<#{self.class.name} type=#{type.inspect} #{formatted.join(' ')}>"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# Inbound messages are delivered as an HTTP request. Query parameters, headers
|
|
7
|
+
# and body may use the placeholders {SMS_TEXT}, {SMS_TEXT_BASE64_ENCODED},
|
|
8
|
+
# {SMS_SRC_ADDR}, {SMS_DST_ADDR} and {SMS_TIME}.
|
|
9
|
+
class HttpIn < Base
|
|
10
|
+
HTTP_METHOD_GET = 'get'
|
|
11
|
+
HTTP_METHOD_POST = 'post'
|
|
12
|
+
HTTP_METHOD_PUT = 'put'
|
|
13
|
+
|
|
14
|
+
HTTP_METHODS = [
|
|
15
|
+
HTTP_METHOD_GET,
|
|
16
|
+
HTTP_METHOD_POST,
|
|
17
|
+
HTTP_METHOD_PUT
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
BODY_TYPE_JSON = 'json'
|
|
21
|
+
BODY_TYPE_HTML_MULTIPART = 'html_multipart'
|
|
22
|
+
BODY_TYPE_HTML_URL_ENCODED = 'html_url_encoded'
|
|
23
|
+
BODY_TYPE_RAW = 'raw'
|
|
24
|
+
|
|
25
|
+
BODY_TYPES = [
|
|
26
|
+
BODY_TYPE_JSON,
|
|
27
|
+
BODY_TYPE_HTML_MULTIPART,
|
|
28
|
+
BODY_TYPE_HTML_URL_ENCODED,
|
|
29
|
+
BODY_TYPE_RAW
|
|
30
|
+
].freeze
|
|
31
|
+
|
|
32
|
+
def self.type
|
|
33
|
+
'http_in'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
property :url, type: :string
|
|
37
|
+
# Type: String
|
|
38
|
+
# Description: Endpoint the request is sent to. Required when the trunk is created.
|
|
39
|
+
|
|
40
|
+
property :http_method, type: :string
|
|
41
|
+
# Type: String
|
|
42
|
+
# Description: One of HTTP_METHODS. Required when the trunk is created.
|
|
43
|
+
|
|
44
|
+
property :query_parameters
|
|
45
|
+
# Type: Hash
|
|
46
|
+
# Nullable: Yes
|
|
47
|
+
# Description: Query parameters added to the request
|
|
48
|
+
|
|
49
|
+
property :headers, sensitive: true
|
|
50
|
+
# Type: Hash
|
|
51
|
+
# Nullable: Yes
|
|
52
|
+
# Description: Headers added to the request. Redacted in #inspect, as they may carry credentials.
|
|
53
|
+
|
|
54
|
+
property :body_type, type: :string
|
|
55
|
+
# Type: String
|
|
56
|
+
# Nullable: Yes
|
|
57
|
+
# Description: One of BODY_TYPES. Required for post and put, refused for get.
|
|
58
|
+
|
|
59
|
+
property :body
|
|
60
|
+
# Type: String or Hash
|
|
61
|
+
# Nullable: Yes
|
|
62
|
+
# Description: Request body template: a JSON string for json, a Hash for the form
|
|
63
|
+
# encodings, a String for raw. Required for post and put, refused for get.
|
|
64
|
+
|
|
65
|
+
property :follow_redirect, type: :boolean
|
|
66
|
+
# Type: Boolean
|
|
67
|
+
# Description: Follow 3xx responses
|
|
68
|
+
|
|
69
|
+
property :validate_https_certificate, type: :boolean
|
|
70
|
+
# Type: Boolean
|
|
71
|
+
# Description: Reject an untrusted TLS certificate
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# Outbound messages are submitted to DIDWW over HTTP. The submit URL is
|
|
7
|
+
# returned in the trunk's meta as host.
|
|
8
|
+
class HttpOut < Base
|
|
9
|
+
def self.type
|
|
10
|
+
'http_out'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
property :callback_url, type: :string
|
|
14
|
+
# Type: String
|
|
15
|
+
# Nullable: Yes
|
|
16
|
+
# Description: URL the status events of submitted messages are sent to
|
|
17
|
+
|
|
18
|
+
property :allowed_ips, type: :strings
|
|
19
|
+
# Type: Array of Strings
|
|
20
|
+
# Nullable: Yes
|
|
21
|
+
# Description: Addresses messages are accepted from
|
|
22
|
+
|
|
23
|
+
property :auth_name, type: :string, read_only: true, sensitive: true
|
|
24
|
+
# Type: String
|
|
25
|
+
# Nullable: Yes
|
|
26
|
+
# Description: Generated HTTP username
|
|
27
|
+
|
|
28
|
+
property :auth_password, type: :string, read_only: true, sensitive: true
|
|
29
|
+
# Type: String
|
|
30
|
+
# Nullable: Yes
|
|
31
|
+
# Description: Generated HTTP password
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# The customer connects to DIDWW as an SMPP ESME.
|
|
7
|
+
class SmppEsme < Base
|
|
8
|
+
def self.type
|
|
9
|
+
'smpp_esme'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
property :system_type, type: :string
|
|
13
|
+
# Type: String
|
|
14
|
+
# Nullable: Yes
|
|
15
|
+
# Description: SMPP system_type, up to 12 characters
|
|
16
|
+
|
|
17
|
+
property :allowed_ips, type: :strings
|
|
18
|
+
# Type: Array of Strings
|
|
19
|
+
# Nullable: Yes
|
|
20
|
+
# Description: Addresses the ESME may bind from
|
|
21
|
+
|
|
22
|
+
property :server_location, type: :string
|
|
23
|
+
# Type: String
|
|
24
|
+
# Description: DIDWW SMPP server location, one of SERVER_LOCATIONS. Required when
|
|
25
|
+
# the trunk is created.
|
|
26
|
+
|
|
27
|
+
property :system_id, type: :string, read_only: true, sensitive: true
|
|
28
|
+
# Type: String
|
|
29
|
+
# Description: Generated SMPP system_id to bind with
|
|
30
|
+
|
|
31
|
+
property :password, type: :string, read_only: true, sensitive: true
|
|
32
|
+
# Type: String
|
|
33
|
+
# Description: Generated SMPP bind password
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# DIDWW connects to the customer as an SMPP client.
|
|
7
|
+
# host, system_id, password and server_location are required when the trunk is created.
|
|
8
|
+
class SmppSmsc < Base
|
|
9
|
+
def self.type
|
|
10
|
+
'smpp_smsc'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
property :host, type: :string
|
|
14
|
+
# Type: String
|
|
15
|
+
# Description: SMSC host DIDWW binds to
|
|
16
|
+
|
|
17
|
+
property :tx_port, type: :integer
|
|
18
|
+
# Type: Integer
|
|
19
|
+
# Description: Transmitter port. Defaults to 2775.
|
|
20
|
+
|
|
21
|
+
property :rx_port, type: :integer
|
|
22
|
+
# Type: Integer
|
|
23
|
+
# Description: Receiver port. Defaults to 2776.
|
|
24
|
+
|
|
25
|
+
property :transceiver_mode, type: :boolean
|
|
26
|
+
# Type: Boolean
|
|
27
|
+
# Description: Bind as a transceiver instead of separate tx/rx
|
|
28
|
+
|
|
29
|
+
property :connection_timeout, type: :integer
|
|
30
|
+
# Type: Integer
|
|
31
|
+
# Description: Bind timeout, seconds
|
|
32
|
+
|
|
33
|
+
property :use_ssl, type: :boolean
|
|
34
|
+
# Type: Boolean
|
|
35
|
+
# Description: Wrap the connection in TLS
|
|
36
|
+
|
|
37
|
+
property :system_id, type: :string
|
|
38
|
+
# Type: String
|
|
39
|
+
# Description: SMPP system_id DIDWW binds with, up to 15 characters
|
|
40
|
+
|
|
41
|
+
property :system_type, type: :string
|
|
42
|
+
# Type: String
|
|
43
|
+
# Nullable: Yes
|
|
44
|
+
# Description: SMPP system_type, up to 12 characters
|
|
45
|
+
|
|
46
|
+
property :password, type: :string, sensitive: true
|
|
47
|
+
# Type: String
|
|
48
|
+
# Description: SMPP bind password, up to 8 characters
|
|
49
|
+
|
|
50
|
+
property :server_location, type: :string
|
|
51
|
+
# Type: String
|
|
52
|
+
# Description: DIDWW SMPP server location, one of SERVER_LOCATIONS
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DIDWW
|
|
4
|
+
module ComplexObject
|
|
5
|
+
module SmsTrunkConfiguration
|
|
6
|
+
# Inbound messages are forwarded as email.
|
|
7
|
+
# send_to, subject and message are required when the trunk is created.
|
|
8
|
+
class SmsToEmail < Base
|
|
9
|
+
def self.type
|
|
10
|
+
'sms_to_email'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
property :send_to, type: :string
|
|
14
|
+
# Type: String
|
|
15
|
+
# Description: Recipient address
|
|
16
|
+
|
|
17
|
+
property :subject, type: :string
|
|
18
|
+
# Type: String
|
|
19
|
+
# Description: Subject template
|
|
20
|
+
|
|
21
|
+
property :message, type: :string
|
|
22
|
+
# Type: String
|
|
23
|
+
# Description: Body template
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|