didww-v3 1.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +27 -0
  3. data/.rubocop.yml +22 -19
  4. data/CHANGELOG.md +75 -0
  5. data/Gemfile +20 -0
  6. data/README.md +8 -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 -4
  11. data/lib/didww/callback/const.rb +14 -0
  12. data/lib/didww/callback/request_validator.rb +77 -0
  13. data/lib/didww/client.rb +101 -26
  14. data/lib/didww/complex_objects/base.rb +6 -4
  15. data/lib/didww/complex_objects/capacity_order_item.rb +17 -0
  16. data/lib/didww/complex_objects/configurations/base.rb +143 -2
  17. data/lib/didww/complex_objects/configurations/h323_configuration.rb +1 -0
  18. data/lib/didww/complex_objects/configurations/iax2_configuration.rb +1 -0
  19. data/lib/didww/complex_objects/configurations/pstn_configuration.rb +1 -0
  20. data/lib/didww/complex_objects/configurations/sip_configuration.rb +34 -3
  21. data/lib/didww/complex_objects/configurations.rb +1 -0
  22. data/lib/didww/complex_objects/did_order_item.rb +14 -7
  23. data/lib/didww/complex_objects/export_filters.rb +26 -0
  24. data/lib/didww/encrypt.rb +101 -0
  25. data/lib/didww/jsonapi_middleware.rb +21 -0
  26. data/lib/didww/resource/address.rb +37 -0
  27. data/lib/didww/resource/address_verification.rb +56 -0
  28. data/lib/didww/resource/area.rb +12 -0
  29. data/lib/didww/{resources → resource}/available_did.rb +1 -0
  30. data/lib/didww/{resources → resource}/balance.rb +1 -0
  31. data/lib/didww/{resources → resource}/base.rb +2 -2
  32. data/lib/didww/resource/capacity_pool.rb +47 -0
  33. data/lib/didww/resource/city.rb +14 -0
  34. data/lib/didww/{resources → resource}/country.rb +1 -0
  35. data/lib/didww/{resources → resource}/did.rb +11 -3
  36. data/lib/didww/{resources → resource}/did_group.rb +13 -21
  37. data/lib/didww/{resources → resource}/did_group_type.rb +1 -0
  38. data/lib/didww/{resources → resource}/did_reservation.rb +1 -0
  39. data/lib/didww/resource/encrypted_file.rb +58 -0
  40. data/lib/didww/{resources/cdr_export.rb → resource/export.rb} +24 -5
  41. data/lib/didww/resource/identity.rb +78 -0
  42. data/lib/didww/{resources → resource}/order.rb +21 -12
  43. data/lib/didww/resource/permanent_supporting_document.rb +15 -0
  44. data/lib/didww/{resources → resource}/pop.rb +1 -0
  45. data/lib/didww/resource/proof.rb +19 -0
  46. data/lib/didww/resource/proof_type.rb +14 -0
  47. data/lib/didww/resource/public_key.rb +12 -0
  48. data/lib/didww/resource/qty_based_pricing.rb +20 -0
  49. data/lib/didww/{resources → resource}/region.rb +1 -0
  50. data/lib/didww/resource/requirement.rb +61 -0
  51. data/lib/didww/resource/requirement_validation.rb +10 -0
  52. data/lib/didww/resource/shared_capacity_group.rb +27 -0
  53. data/lib/didww/{resources → resource}/stock_keeping_unit.rb +1 -0
  54. data/lib/didww/resource/supporting_document_template.rb +14 -0
  55. data/lib/didww/{resources/trunk.rb → resource/voice_in_trunk.rb} +40 -4
  56. data/lib/didww/{resources/trunk_group.rb → resource/voice_in_trunk_group.rb} +3 -2
  57. data/lib/didww/resource/voice_out_trunk.rb +75 -0
  58. data/lib/didww/resource/voice_out_trunk_regenerate_credential.rb +11 -0
  59. data/lib/didww/types/ip_addresses.rb +23 -0
  60. data/lib/didww/types/strings.rb +21 -0
  61. data/lib/didww/types.rb +12 -0
  62. data/lib/didww/version.rb +2 -1
  63. data/lib/didww.rb +6 -1
  64. metadata +59 -176
  65. data/.travis.yml +0 -5
  66. data/lib/didww/complex_objects/cdr_export_filter.rb +0 -23
  67. data/lib/didww/complex_objects/configurations/const.rb +0 -149
  68. data/lib/didww/resources/city.rb +0 -9
  69. data/lib/didww/resources/trunk/const.rb +0 -46
@@ -1,8 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class Did < Base
4
- has_one :trunk
5
- has_one :trunk_group
5
+ has_one :voice_in_trunk
6
+ has_one :voice_in_trunk_group
7
+ has_one :capacity_pool
8
+ has_one :shared_capacity_group
9
+ has_one :address_verification
6
10
 
7
11
  property :blocked, type: :boolean
8
12
  # Type: Boolean
@@ -16,7 +20,7 @@ module DIDWW
16
20
  # Type: Boolean
17
21
  # Description: Identifier for terminated DIDs that will be removed from service at the end of the billing cycle.
18
22
 
19
- property :pending_removal, type: :boolean
23
+ property :billing_cycles_count, type: :integer
20
24
  # Type: Boolean
21
25
  # Description: Identifier for DIDs that are pending removal from your account.
22
26
 
@@ -36,6 +40,10 @@ module DIDWW
36
40
  # Type: Integer
37
41
  # Description: The number of channels included with this DID.
38
42
 
43
+ property :dedicated_channels_count, type: :integer
44
+ # Type: Integer
45
+ # Description: The number of channels included with this DID.
46
+
39
47
  property :expires_at, type: :time
40
48
  # Type: DateTime
41
49
  # Description: DateTime when the DID expired or will expire. DateTime is in the ISO 8601 format "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", where "SSS" are milliseconds and 'Z' denotes Zulu time (UTC).
@@ -1,23 +1,16 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class DidGroup < Base
4
- module CONST
5
- # Possible values for did_group.features array
6
- FEATURE_VOICE = 'voice' .freeze
7
- FEATURE_T38 = 't38' .freeze
8
- FEATURE_SMS = 'sms' .freeze
9
- FEATURES = {
10
- FEATURE_VOICE => 'Voice' .freeze,
11
- FEATURE_T38 => 'T.38 Fax' .freeze,
12
- FEATURE_SMS => 'SMS' .freeze
13
- }.freeze
14
-
15
- def features_human
16
- Array.wrap(features).map { |f| FEATURES[f] }
17
- end
18
- end
19
-
20
- include CONST
5
+ # Possible values for did_group.features array
6
+ FEATURE_VOICE = 'voice' .freeze
7
+ FEATURE_T38 = 't38' .freeze
8
+ FEATURE_SMS = 'sms' .freeze
9
+ FEATURES = {
10
+ FEATURE_VOICE => 'Voice' .freeze,
11
+ FEATURE_T38 => 'T.38 Fax' .freeze,
12
+ FEATURE_SMS => 'SMS' .freeze
13
+ }.freeze
21
14
 
22
15
  has_one :country, class: Country
23
16
  has_one :city, class: City
@@ -60,11 +53,10 @@ module DIDWW
60
53
  # is_available
61
54
  # Type: Boolean
62
55
  # Description: Defines if numbers in this DID Group are currently in stock.
63
- #
64
- # restrictions
65
- # Type: String
66
- # Description: Describes possible restrictions for the DID Group, such as "End User Registration is Required".
67
56
 
57
+ def features_human
58
+ Array.wrap(features).map { |f| FEATURES[f] }
59
+ end
68
60
  end
69
61
  end
70
62
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class DidGroupType < Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class DidReservation < Base
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class EncryptedFile < Base
5
+ class UploadError < StandardError
6
+ end
7
+
8
+ property :description, type: :string
9
+ # Type: String
10
+ # Description:
11
+
12
+ property :expire_at, type: :date
13
+ # Type: Date
14
+ # Description:
15
+
16
+ # @return [Faraday::Connection]
17
+ def self.upload_connection
18
+ Faraday.new(url: site) do |connection|
19
+ connection.request :multipart
20
+ connection.request :url_encoded
21
+ connection.adapter Faraday.default_adapter
22
+ connection.use DIDWW::BaseMiddleware
23
+ end
24
+ end
25
+
26
+ # @param files [Rack::Multipart::UploadedFile,(#tempfile,#content_type,#original_filename)]
27
+ # @return [Array<String>]
28
+ # @raise [DIDWW::Resource::EncryptedFile::UploadError]
29
+ def self.upload_files(files, fingerprint)
30
+ items = files.map do |file|
31
+ {
32
+ file: Faraday::UploadIO.new(file.tempfile, file.content_type),
33
+ description: file.original_filename
34
+ }
35
+ end
36
+ payload = { encryption_fingerprint: fingerprint, items: items }
37
+ upload(payload)
38
+ end
39
+
40
+ # @param payload [Hash]
41
+ # encryption_fingerprint [String] DIDWW::Encrypt#encryption_fingerprint
42
+ # items [Array]
43
+ # file [Faraday::UploadIO] upload io
44
+ # description [String,nil] optional description
45
+ # @return [Array<String>]
46
+ # @raise [DIDWW::Resource::EncryptedFile::UploadError]
47
+ def self.upload(payload)
48
+ connection = upload_connection
49
+ response = connection.post('/v3/encrypted_files', encrypted_files: payload)
50
+ if response.status == 201
51
+ JSON.parse(response.body, symbolize_names: true)[:ids]
52
+ else
53
+ raise UploadError, "Code: #{response.status} #{response.body}"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,13 +1,24 @@
1
+ # frozen_string_literal: true
1
2
  require 'forwardable'
2
- require 'didww/complex_objects/cdr_export_filter'
3
3
  require 'down/http'
4
+ require 'didww/callback/const'
4
5
 
5
6
  module DIDWW
6
7
  module Resource
7
- class CdrExport < Base
8
+ class Export < Base
9
+ include DIDWW::Callback::CONST
8
10
  extend Forwardable
9
11
 
10
- property :filters, type: :cdr_export_filter
12
+ STATUS_COMPLETED = 'Completed'
13
+
14
+ EXPORT_TYPE_CDR_IN = 'cdr_in'
15
+ EXPORT_TYPE_CDR_OUT = 'cdr_out'
16
+ EXPORT_TYPES = [
17
+ EXPORT_TYPE_CDR_IN,
18
+ EXPORT_TYPE_CDR_OUT
19
+ ].freeze
20
+
21
+ property :filters, type: :export_filters
11
22
  # Type: CDR Export Filters Object
12
23
  # Nullable: No
13
24
  # Description: Filters
@@ -27,7 +38,15 @@ module DIDWW
27
38
  # Nullable: true
28
39
  # Description: url of csv file for downloading. available only when status is "Completed"
29
40
 
30
- def_delegators :filters, :year, :month, :did_number, :year=, :month=, :did_number=
41
+ property :callback_url, type: :string
42
+ # Type: String
43
+ # Description: valid URI for callbacks
44
+
45
+ property :callback_method, type: :string
46
+ # Type: String
47
+ # Description: GET or POST
48
+
49
+ property :export_type, type: :string
31
50
 
32
51
  def initialize(params = {})
33
52
  super params.reverse_merge(filters: {})
@@ -39,7 +58,7 @@ module DIDWW
39
58
  end
40
59
 
41
60
  def complete?
42
- status == 'Completed'
61
+ status == STATUS_COMPLETED
43
62
  end
44
63
  alias_method :completed?, :complete?
45
64
  end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class Identity < Base
5
+ IDENTITY_TYPE_PERSONAL = 'Personal'
6
+ IDENTITY_TYPE_BUSINESS = 'Business'
7
+
8
+ has_one :country, class_name: 'Country'
9
+ has_many :proofs, class_name: 'Proof'
10
+ has_many :addresses, class_name: 'Address'
11
+ has_many :permanent_documents, class_name: 'PermanentSupportingDocument'
12
+
13
+ property :first_name, type: :string
14
+ # Type: String
15
+ # Description:
16
+
17
+ property :last_name, type: :string
18
+ # Type: String
19
+ # Description:
20
+
21
+ property :phone_number, type: :string
22
+ # Type: String
23
+ # Description:
24
+
25
+ property :id_number, type: :string
26
+ # Type: String
27
+ # Description:
28
+
29
+ property :birth_date, type: :date
30
+ # Type: Date
31
+ # Description:
32
+
33
+ property :company_name, type: :string
34
+ # Type: String
35
+ # Description:
36
+
37
+ property :company_reg_number, type: :string
38
+ # Type: String
39
+ # Description:
40
+
41
+ property :vat_id, type: :string
42
+ # Type: String
43
+ # Description:
44
+
45
+ property :description, type: :string
46
+ # Type: String
47
+ # Description:
48
+
49
+ property :personal_tax_id, type: :string
50
+ # Type: String
51
+ # Description:
52
+
53
+ property :identity_type, type: :string
54
+ # Type: String
55
+ # Description:
56
+
57
+ property :created_at, type: :date
58
+ # Type: Date
59
+ # Description:
60
+
61
+ property :external_reference_id, type: :string
62
+ # Type: String
63
+ # Description:
64
+
65
+ property :verified, type: :boolean
66
+ # Type: Boolean
67
+ # Description:
68
+
69
+ def personal?
70
+ identity_type == IDENTITY_TYPE_PERSONAL
71
+ end
72
+
73
+ def business?
74
+ identity_type == IDENTITY_TYPE_BUSINESS
75
+ end
76
+ end
77
+ end
78
+ end
@@ -1,21 +1,22 @@
1
+ # frozen_string_literal: true
1
2
  require 'didww/complex_objects/did_order_item'
3
+ require 'didww/complex_objects/capacity_order_item'
4
+ require 'didww/callback/const'
2
5
 
3
6
  module DIDWW
4
7
  module Resource
5
8
  class Order < Base
6
- module CONST
7
- # Possible values for order.status
8
- STATUS_PENDING = 'Pending' .freeze
9
- STATUS_COMPLETED = 'Completed' .freeze
10
- STATUS_CANCELLED = 'Canceled' .freeze
11
- STATUSES = [
12
- STATUS_PENDING,
13
- STATUS_COMPLETED,
14
- STATUS_CANCELLED
15
- ].freeze
16
- end
9
+ include DIDWW::Callback::CONST
17
10
 
18
- include CONST
11
+ # Possible values for order.status
12
+ STATUS_PENDING = 'Pending'
13
+ STATUS_COMPLETED = 'Completed'
14
+ STATUS_CANCELLED = 'Canceled'
15
+ STATUSES = [
16
+ STATUS_PENDING,
17
+ STATUS_COMPLETED,
18
+ STATUS_CANCELLED
19
+ ].freeze
19
20
 
20
21
  property :reference, type: :string
21
22
  # Type: String
@@ -45,6 +46,14 @@ module DIDWW
45
46
  # Type: Boolean
46
47
  # Description: Allowing back ordering
47
48
 
49
+ property :callback_url, type: :string
50
+ # Type: String
51
+ # Description: valid URI for callbacks
52
+
53
+ property :callback_method, type: :string
54
+ # Type: String
55
+ # Description: GET or POST
56
+
48
57
  def initialize(*args)
49
58
  super
50
59
  self.items ||= []
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ module DIDWW
3
+ module Resource
4
+ class PermanentSupportingDocument < Base
5
+
6
+ has_many :files, class_name: 'EncryptedFile'
7
+ has_one :template, class_name: 'SupportingDocumentTemplate'
8
+ has_one :identity, class_name: 'Identity'
9
+
10
+ property :created_at, type: :date
11
+ # Type: Date
12
+ # Description:
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
4
  class Pop < Base
@@ -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,13 +1,42 @@
1
+ # frozen_string_literal: true
1
2
  require 'didww/complex_objects/configurations'
2
- require 'didww/resources/trunk/const'
3
3
 
4
4
  module DIDWW
5
5
  module Resource
6
- class Trunk < Base
7
- include CONST
6
+ class VoiceInTrunk < Base
7
+ # Allowed values for trunk.cli_format
8
+ CLI_FORMAT_RAW = 'raw'
9
+ CLI_FORMAT_E164 = 'e164'
10
+ CLI_FORMAT_LOCAL = 'local'
11
+
12
+ CLI_FORMATS = {
13
+ CLI_FORMAT_RAW => 'Raw',
14
+ CLI_FORMAT_E164 => 'E.164',
15
+ CLI_FORMAT_LOCAL => 'Local'
16
+ }.freeze
17
+
18
+ # Configuration types
19
+ CONF_TYPE_SIP = 'sip_configurations'
20
+ CONF_TYPE_H323 = 'h323_configurations'
21
+ CONF_TYPE_IAX2 = 'iax2_configurations'
22
+ CONF_TYPE_PSTN = 'pstn_configurations'
23
+
24
+ CONF_TYPES = {
25
+ CONF_TYPE_SIP => 'SIP',
26
+ CONF_TYPE_H323 => 'H323',
27
+ CONF_TYPE_IAX2 => 'IAX2',
28
+ CONF_TYPE_PSTN => 'PSTN'
29
+ }.freeze
30
+
31
+ CONF_TYPE_CLASSES = {
32
+ CONF_TYPE_SIP => DIDWW::ComplexObject::SipConfiguration,
33
+ CONF_TYPE_H323 => DIDWW::ComplexObject::H323Configuration,
34
+ CONF_TYPE_IAX2 => DIDWW::ComplexObject::Iax2Configuration,
35
+ CONF_TYPE_PSTN => DIDWW::ComplexObject::PstnConfiguration
36
+ }.freeze
8
37
 
9
38
  has_one :pop
10
- has_one :trunk_group
39
+ has_one :voice_in_trunk_group
11
40
 
12
41
  property :priority, type: :integer
13
42
  # Type: Integer
@@ -62,6 +91,13 @@ module DIDWW
62
91
  attribute_will_change!(:configuration) if configuration
63
92
  end
64
93
 
94
+ def cli_format_human
95
+ CLI_FORMATS[cli_format]
96
+ end
97
+
98
+ def configuration_type_human
99
+ CONF_TYPES[configuration.type] if configuration
100
+ end
65
101
  end
66
102
  end
67
103
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module DIDWW
2
3
  module Resource
3
- class TrunkGroup < Base
4
- has_many :trunks
4
+ class VoiceInTrunkGroup < Base
5
+ has_many :voice_in_trunks
5
6
 
6
7
  property :name, type: :string
7
8
  # Type: String