wavix-sdk-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +124 -0
  4. data/lib/middleware/follow_redirects_middleware.rb +15 -0
  5. data/lib/services/fields_validator.rb +26 -0
  6. data/lib/wavix-sdk-ruby.rb +5 -0
  7. data/lib/wavix_api/base_methods.rb +180 -0
  8. data/lib/wavix_api/v1/base_destroy.rb +31 -0
  9. data/lib/wavix_api/v1/base_find.rb +31 -0
  10. data/lib/wavix_api/v1/base_search.rb +31 -0
  11. data/lib/wavix_api/v1/billing/invoices/find.rb +44 -0
  12. data/lib/wavix_api/v1/billing/invoices/search.rb +21 -0
  13. data/lib/wavix_api/v1/billing/transactions/search.rb +39 -0
  14. data/lib/wavix_api/v1/buy/carts/checkout.rb +23 -0
  15. data/lib/wavix_api/v1/buy/carts/find.rb +23 -0
  16. data/lib/wavix_api/v1/buy/carts/update.rb +34 -0
  17. data/lib/wavix_api/v1/buy/cities/search.rb +47 -0
  18. data/lib/wavix_api/v1/buy/countries/search.rb +31 -0
  19. data/lib/wavix_api/v1/buy/dids/search.rb +41 -0
  20. data/lib/wavix_api/v1/buy/regions/search.rb +33 -0
  21. data/lib/wavix_api/v1/call/recordings/destroy.rb +23 -0
  22. data/lib/wavix_api/v1/call/recordings/month_statistics/details.rb +35 -0
  23. data/lib/wavix_api/v1/call/recordings/month_statistics/search.rb +35 -0
  24. data/lib/wavix_api/v1/call/recordings/recording_settings.rb +40 -0
  25. data/lib/wavix_api/v1/call/recordings/retention_policy.rb +23 -0
  26. data/lib/wavix_api/v1/call/recordings/search.rb +55 -0
  27. data/lib/wavix_api/v1/call/recordings/update_recording_settings.rb +48 -0
  28. data/lib/wavix_api/v1/call/recordings/update_retention_policy.rb +37 -0
  29. data/lib/wavix_api/v1/call/transcriptions/find.rb +31 -0
  30. data/lib/wavix_api/v1/call/transcriptions/retranscribe.rb +35 -0
  31. data/lib/wavix_api/v1/cdrs/advanced_search.rb +67 -0
  32. data/lib/wavix_api/v1/cdrs/common_vars.rb +22 -0
  33. data/lib/wavix_api/v1/cdrs/metrics.rb +29 -0
  34. data/lib/wavix_api/v1/cdrs/search.rb +35 -0
  35. data/lib/wavix_api/v1/e911_records/create.rb +47 -0
  36. data/lib/wavix_api/v1/e911_records/destroy.rb +31 -0
  37. data/lib/wavix_api/v1/e911_records/search.rb +33 -0
  38. data/lib/wavix_api/v1/e911_records/validate_address.rb +44 -0
  39. data/lib/wavix_api/v1/mydids/cities.rb +32 -0
  40. data/lib/wavix_api/v1/mydids/destroy.rb +55 -0
  41. data/lib/wavix_api/v1/mydids/find.rb +21 -0
  42. data/lib/wavix_api/v1/mydids/search.rb +35 -0
  43. data/lib/wavix_api/v1/mydids/update.rb +40 -0
  44. data/lib/wavix_api/v1/mydids/update_destinations.rb +73 -0
  45. data/lib/wavix_api/v1/mydids/update_sms_enabled.rb +32 -0
  46. data/lib/wavix_api/v1/papers/create.rb +65 -0
  47. data/lib/wavix_api/v1/papers/find.rb +42 -0
  48. data/lib/wavix_api/v1/profile/account_config.rb +21 -0
  49. data/lib/wavix_api/v1/profile/find.rb +21 -0
  50. data/lib/wavix_api/v1/profile/update.rb +58 -0
  51. data/lib/wavix_api/v1/sub_organizations/create.rb +36 -0
  52. data/lib/wavix_api/v1/sub_organizations/find.rb +19 -0
  53. data/lib/wavix_api/v1/sub_organizations/search.rb +31 -0
  54. data/lib/wavix_api/v1/sub_organizations/transactions.rb +39 -0
  55. data/lib/wavix_api/v1/sub_organizations/update.rb +40 -0
  56. data/lib/wavix_api/v1/trunks/create.rb +76 -0
  57. data/lib/wavix_api/v1/trunks/destroy.rb +19 -0
  58. data/lib/wavix_api/v1/trunks/find.rb +19 -0
  59. data/lib/wavix_api/v1/trunks/search.rb +30 -0
  60. data/lib/wavix_api/v1/trunks/update.rb +85 -0
  61. data/lib/wavix_api/v1/voice_campaigns/create.rb +39 -0
  62. data/lib/wavix_api/v1/voice_campaigns/find.rb +21 -0
  63. data/lib/wavix_api/v2/base_destroy.rb +10 -0
  64. data/lib/wavix_api/v2/base_find.rb +10 -0
  65. data/lib/wavix_api/v2/base_search.rb +10 -0
  66. data/lib/wavix_api/v2/messages/all.rb +23 -0
  67. data/lib/wavix_api/v2/messages/async_create.rb +23 -0
  68. data/lib/wavix_api/v2/messages/attachments/find.rb +59 -0
  69. data/lib/wavix_api/v2/messages/common_vars.rb +50 -0
  70. data/lib/wavix_api/v2/messages/create.rb +24 -0
  71. data/lib/wavix_api/v2/messages/find.rb +19 -0
  72. data/lib/wavix_api/v2/messages/opt_outs/create.rb +34 -0
  73. data/lib/wavix_api/v2/messages/search.rb +23 -0
  74. data/lib/wavix_api/v2/messages/sender_ids/create.rb +40 -0
  75. data/lib/wavix_api/v2/messages/sender_ids/destroy.rb +21 -0
  76. data/lib/wavix_api/v2/messages/sender_ids/find.rb +21 -0
  77. data/lib/wavix_api/v2/messages/sender_ids/restrictions.rb +32 -0
  78. data/lib/wavix_api/v2/messages/sender_ids/search.rb +21 -0
  79. data/lib/wavix_api/v3/messages/sender_ids/create.rb +51 -0
  80. data/lib/wavix_api/v3/messages/sender_ids/find.rb +21 -0
  81. data/lib/wavix_api/v3/messages/sender_ids/search.rb +21 -0
  82. data/lib/wavix_api.rb +155 -0
  83. data/wavix-sdk-ruby.gemspec +40 -0
  84. metadata +204 -0
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Buy
6
+ module Cities
7
+ class Search
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ country_id: { type: 'integer' }.freeze,
14
+ region_id: { type: 'integer' }.freeze,
15
+ type_filter: { type: 'string' }.freeze,
16
+ text_enabled_only: { type: 'boolean' }.freeze
17
+ }.freeze,
18
+ required: %i[country_id].freeze
19
+ }.freeze
20
+
21
+ class << self
22
+ def call(params = {})
23
+ instance = new(params)
24
+
25
+ instance.validate!
26
+
27
+ instance.get(path(instance.params))
28
+ end
29
+
30
+ private
31
+
32
+ def path(params)
33
+ country_id = params[:country_id]
34
+ region_id = params[:region_id]
35
+
36
+ if region_id.nil?
37
+ "v1/buy/countries/#{country_id}/cities"
38
+ else
39
+ "v1/buy/countries/#{country_id}/regions/#{region_id}/cities"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Buy
6
+ module Countries
7
+ class Search
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ type_filter: { type: 'string' }.freeze,
14
+ text_enabled_only: { type: 'boolean' }.freeze
15
+ }.freeze
16
+ }.freeze
17
+
18
+ class << self
19
+ def call(params = {})
20
+ instance = new(params)
21
+
22
+ instance.validate!
23
+
24
+ instance.get('v1/buy/countries')
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Buy
6
+ module Dids
7
+ class Search
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ country_id: { type: 'integer' }.freeze,
14
+ city_id: { type: 'integer' }.freeze,
15
+ type_filter: { type: 'string' }.freeze,
16
+ text_enabled_only: { type: 'boolean' }.freeze,
17
+ **::WavixApi::BaseMethods::PAGINATION_SCHEMA
18
+ }.freeze,
19
+ required: %i[country_id city_id].freeze
20
+ }.freeze
21
+
22
+ class << self
23
+ def call(params = {})
24
+ instance = new(params)
25
+
26
+ instance.validate!
27
+
28
+ instance.get(path(instance.params))
29
+ end
30
+
31
+ private
32
+
33
+ def path(params)
34
+ "v1/buy/countries/#{params[:country_id]}/cities/#{params[:city_id]}/dids"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Buy
6
+ module Regions
7
+ class Search
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ country_id: { type: 'integer' }.freeze,
14
+ type_filter: { type: 'string' }.freeze,
15
+ text_enabled_only: { type: 'boolean' }.freeze
16
+ }.freeze,
17
+ required: %i[country_id].freeze
18
+ }.freeze
19
+
20
+ class << self
21
+ def call(params = {})
22
+ instance = new(params)
23
+
24
+ instance.validate!
25
+
26
+ instance.get("v1/buy/countries/#{instance.params[:country_id]}/regions")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+
5
+ module WavixApi
6
+ module V1
7
+ module Call
8
+ module Recordings
9
+ class Destroy < ::WavixApi::V1::BaseDestroy
10
+ @params_schema = ::WavixApi::BaseMethods::ONLY_ID_SCHEMA
11
+
12
+ class << self
13
+ private
14
+
15
+ def path
16
+ 'v1/recordings'
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+
5
+ module WavixApi
6
+ module V1
7
+ module Call
8
+ module Recordings
9
+ module MonthStatistics
10
+ class Details
11
+ include WavixApi::BaseMethods
12
+
13
+ @params_schema = ::WavixApi::BaseMethods::ONLY_ID_SCHEMA
14
+
15
+ class << self
16
+ def call(id = nil)
17
+ instance = new({ id: id })
18
+
19
+ instance.validate!
20
+
21
+ instance.get(
22
+ ['v1/recording/month-statistics', instance.id, 'details'].join('/')
23
+ )
24
+ end
25
+ end
26
+
27
+ def call
28
+ self.class.call(id)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+
5
+ module WavixApi
6
+ module V1
7
+ module Call
8
+ module Recordings
9
+ module MonthStatistics
10
+ class Search
11
+ include WavixApi::BaseMethods
12
+
13
+ @params_schema = {
14
+ type: 'object',
15
+ properties: {
16
+ year: { type: 'integer' }.freeze,
17
+ month: { type: 'integer' }.freeze
18
+ }.freeze
19
+ }.freeze
20
+
21
+ class << self
22
+ def call(params = {})
23
+ instance = new(params)
24
+
25
+ instance.validate!
26
+
27
+ instance.get('v1/recording/month-statistics')
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Recordings
7
+ class RecordingSettings
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ sip_trunks: {
14
+ type: 'array',
15
+ items: { type: 'string' }.freeze
16
+ }.freeze,
17
+ dids: {
18
+ type: 'array',
19
+ items: {
20
+ type: 'string',
21
+ pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
22
+ }.freeze
23
+ }.freeze
24
+ }.freeze
25
+ }.freeze
26
+
27
+ class << self
28
+ def call(params = {})
29
+ instance = new(params)
30
+
31
+ instance.validate!
32
+
33
+ instance.get('v1/recordings/recording-settings')
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Recordings
7
+ class RetentionPolicy
8
+ include WavixApi::BaseMethods
9
+
10
+ class << self
11
+ def call(params = {})
12
+ instance = new(params)
13
+
14
+ instance.validate!
15
+
16
+ instance.get('v1/recordings/retention-policy')
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Recordings
7
+ class Search
8
+ include WavixApi::BaseMethods
9
+
10
+ DATE_FIELDS = %i[from_date to_date].freeze
11
+ DATETIME_FIELDS = %i[from_time to_time].freeze
12
+ DATE_FORMAT = '%Y.%m.%d'
13
+ DATETIME_FORMAT = '%Y.%m.%dTT%H:%M:%S.000'
14
+
15
+ @params_schema = {
16
+ type: 'object',
17
+ properties: {
18
+ from: { type: 'string', pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP }.freeze,
19
+ to: { type: 'string', pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP }.freeze,
20
+ call_uuid: { type: 'string' }.freeze,
21
+ sip_trunks: {
22
+ type: 'array',
23
+ items: { type: 'string' }.freeze
24
+ }.freeze,
25
+ dids: {
26
+ type: 'array',
27
+ items: {
28
+ type: 'string',
29
+ pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
30
+ }.freeze
31
+ }.freeze
32
+ }.freeze
33
+ }.freeze
34
+
35
+ class << self
36
+ def call(params = {})
37
+ instance = new(params)
38
+
39
+ instance.validate!
40
+ instance.validate_dates!(DATE_FIELDS + DATETIME_FIELDS)
41
+
42
+ instance.stringify_dates!(
43
+ instance.params, fields: DATE_FIELDS, format: DATE_FORMAT
44
+ )
45
+ instance.stringify_dates!(
46
+ instance.params, fields: DATETIME_FIELDS, format: DATETIME_FORMAT
47
+ )
48
+ instance.get('v1/recordings')
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Recordings
7
+ class UpdateRecordingSettings
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ recording: {
14
+ type: 'object',
15
+ properties: {
16
+ new_state: { type: 'boolean' },
17
+ sip_trunks: {
18
+ type: 'array',
19
+ items: { type: 'string' }.freeze
20
+ }.freeze,
21
+ dids: {
22
+ type: 'array',
23
+ items: {
24
+ type: 'string',
25
+ pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
26
+ }.freeze
27
+ }.freeze
28
+ }.freeze,
29
+ required: %i[new_state].freeze
30
+ }.freeze
31
+ }.freeze,
32
+ required: %i[recording].freeze
33
+ }.freeze
34
+
35
+ class << self
36
+ def call(params = {})
37
+ instance = new(params)
38
+
39
+ instance.validate!
40
+
41
+ instance.put('v1/recordings/recording-settings')
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Recordings
7
+ class UpdateRetentionPolicy
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ settings: {
14
+ type: 'object',
15
+ properties: {
16
+ recording_store_months: { type: 'integer' }.freeze
17
+ }.freeze,
18
+ required: %i[recording_store_months].freeze
19
+ }.freeze
20
+ }.freeze,
21
+ required: %i[settings].freeze
22
+ }.freeze
23
+
24
+ class << self
25
+ def call(params = {})
26
+ instance = new(params)
27
+
28
+ instance.validate!
29
+
30
+ instance.patch('v1/recordings/retention-policy')
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Transcriptions
7
+ class Find
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ cdr_id: { type: 'string' }
14
+ }.freeze,
15
+ required: %i[cdr_id].freeze
16
+ }.freeze
17
+
18
+ class << self
19
+ def call(params = {})
20
+ instance = new(params)
21
+
22
+ instance.validate!
23
+
24
+ instance.get("v1/cdr/#{instance.params[:cdr_id]}/transcription")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Call
6
+ module Transcriptions
7
+ class Retranscribe
8
+ include WavixApi::BaseMethods
9
+
10
+ @params_schema = {
11
+ type: 'object',
12
+ properties: {
13
+ cdr_id: { type: 'string' }.freeze,
14
+ language: {
15
+ enum: WavixApi::BaseMethods::AVAILABLE_TRANSCRIPTION_LANGUAGES
16
+ }.freeze,
17
+ webhook_url: { type: 'string' }.freeze
18
+ }.freeze,
19
+ required: %i[cdr_id language webhook_url].freeze
20
+ }.freeze
21
+
22
+ class << self
23
+ def call(params = {})
24
+ instance = new(params)
25
+
26
+ instance.validate!
27
+
28
+ instance.put("v1/cdr/#{instance.params[:cdr_id]}/retranscribe")
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+ require_relative 'common_vars'
5
+
6
+ module WavixApi
7
+ module V1
8
+ module Cdrs
9
+ class AdvancedSearch
10
+ include WavixApi::V1::Cdrs::CommonVars
11
+ include WavixApi::BaseMethods
12
+
13
+ TRANSCRIPTION_SPEAKER_SCHEMA = {
14
+ type: 'object',
15
+ properties: {
16
+ must: {
17
+ type: 'array',
18
+ items: { type: 'string' }.freeze
19
+ }.freeze,
20
+ match: {
21
+ type: 'array',
22
+ items: { type: 'string' }.freeze
23
+ }.freeze,
24
+ exclude: {
25
+ type: 'array',
26
+ items: { type: 'string' }.freeze
27
+ }.freeze
28
+ }.freeze
29
+ }.freeze
30
+
31
+ @params_schema = {
32
+ type: 'object',
33
+ properties: ::WavixApi::V1::Cdrs::CommonVars::CDR_FIELDS_SCHEMA.merge(
34
+ {
35
+ transcription: {
36
+ type: 'object',
37
+ properties: {
38
+ language: { type: 'string' },
39
+ status: { type: 'string' },
40
+ properties: {
41
+ agent: TRANSCRIPTION_SPEAKER_SCHEMA,
42
+ lead: TRANSCRIPTION_SPEAKER_SCHEMA,
43
+ any: TRANSCRIPTION_SPEAKER_SCHEMA
44
+ }.freeze
45
+ }.freeze
46
+ }.freeze
47
+ }
48
+ ),
49
+ required: ::WavixApi::V1::Cdrs::CommonVars::CDR_REQUIRED_FIELDS
50
+ }.freeze
51
+
52
+ class << self
53
+ def call(params = {})
54
+ instance = new(params)
55
+
56
+ instance.validate!
57
+ instance.validate_dates!(::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS)
58
+
59
+ instance.stringify_dates!(instance.params,
60
+ fields: ::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS)
61
+ instance.post('v1/cdr')
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WavixApi
4
+ module V1
5
+ module Cdrs
6
+ module CommonVars
7
+ DATE_FIELDS = %i[from to].freeze
8
+ CDR_REQUIRED_FIELDS = DATE_FIELDS + %i[type]
9
+ CDR_FIELDS_SCHEMA = {
10
+ type: { enum: %w[placed received] }.freeze,
11
+ from_search: { type: 'string' }.freeze,
12
+ to_search: { type: 'string' }.freeze,
13
+ page: { type: 'integer' }.freeze,
14
+ per_page: { type: 'integer' }.freeze,
15
+ disposition: { type: 'string' }.freeze,
16
+ uuid: { type: 'string' }.freeze,
17
+ sip_trunk: { type: 'string' }.freeze
18
+ }.freeze
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+
5
+ module WavixApi
6
+ module V1
7
+ module Cdrs
8
+ class Metrics
9
+ include WavixApi::V1::Cdrs::CommonVars
10
+ include WavixApi::BaseMethods
11
+
12
+ class << self
13
+ def call(params = {})
14
+ instance = new(params)
15
+
16
+ instance.validate!
17
+ instance.validate_dates!(::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS)
18
+
19
+ instance.stringify_dates!(
20
+ instance.params,
21
+ fields: ::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS
22
+ )
23
+ instance.get('v1/cdr/metrics')
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wavix_api'
4
+ require_relative 'common_vars'
5
+
6
+ module WavixApi
7
+ module V1
8
+ module Cdrs
9
+ class Search
10
+ include WavixApi::V1::Cdrs::CommonVars
11
+ include WavixApi::BaseMethods
12
+
13
+ @params_schema = {
14
+ type: 'object',
15
+ properties: ::WavixApi::V1::Cdrs::CommonVars::CDR_FIELDS_SCHEMA,
16
+ required: ::WavixApi::V1::Cdrs::CommonVars::CDR_REQUIRED_FIELDS
17
+ }.freeze
18
+
19
+ class << self
20
+ def call(params = {})
21
+ instance = new(params)
22
+
23
+ instance.validate!
24
+ instance.validate_dates!(::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS)
25
+
26
+ instance.stringify_dates!(
27
+ instance.params, fields: ::WavixApi::V1::Cdrs::CommonVars::DATE_FIELDS
28
+ )
29
+ instance.get('v1/cdr')
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end