wavix-sdk-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +124 -0
- data/lib/middleware/follow_redirects_middleware.rb +15 -0
- data/lib/services/fields_validator.rb +26 -0
- data/lib/wavix-sdk-ruby.rb +5 -0
- data/lib/wavix_api/base_methods.rb +180 -0
- data/lib/wavix_api/v1/base_destroy.rb +31 -0
- data/lib/wavix_api/v1/base_find.rb +31 -0
- data/lib/wavix_api/v1/base_search.rb +31 -0
- data/lib/wavix_api/v1/billing/invoices/find.rb +44 -0
- data/lib/wavix_api/v1/billing/invoices/search.rb +21 -0
- data/lib/wavix_api/v1/billing/transactions/search.rb +39 -0
- data/lib/wavix_api/v1/buy/carts/checkout.rb +23 -0
- data/lib/wavix_api/v1/buy/carts/find.rb +23 -0
- data/lib/wavix_api/v1/buy/carts/update.rb +34 -0
- data/lib/wavix_api/v1/buy/cities/search.rb +47 -0
- data/lib/wavix_api/v1/buy/countries/search.rb +31 -0
- data/lib/wavix_api/v1/buy/dids/search.rb +41 -0
- data/lib/wavix_api/v1/buy/regions/search.rb +33 -0
- data/lib/wavix_api/v1/call/recordings/destroy.rb +23 -0
- data/lib/wavix_api/v1/call/recordings/month_statistics/details.rb +35 -0
- data/lib/wavix_api/v1/call/recordings/month_statistics/search.rb +35 -0
- data/lib/wavix_api/v1/call/recordings/recording_settings.rb +40 -0
- data/lib/wavix_api/v1/call/recordings/retention_policy.rb +23 -0
- data/lib/wavix_api/v1/call/recordings/search.rb +55 -0
- data/lib/wavix_api/v1/call/recordings/update_recording_settings.rb +48 -0
- data/lib/wavix_api/v1/call/recordings/update_retention_policy.rb +37 -0
- data/lib/wavix_api/v1/call/transcriptions/find.rb +31 -0
- data/lib/wavix_api/v1/call/transcriptions/retranscribe.rb +35 -0
- data/lib/wavix_api/v1/cdrs/advanced_search.rb +67 -0
- data/lib/wavix_api/v1/cdrs/common_vars.rb +22 -0
- data/lib/wavix_api/v1/cdrs/metrics.rb +29 -0
- data/lib/wavix_api/v1/cdrs/search.rb +35 -0
- data/lib/wavix_api/v1/e911_records/create.rb +47 -0
- data/lib/wavix_api/v1/e911_records/destroy.rb +31 -0
- data/lib/wavix_api/v1/e911_records/search.rb +33 -0
- data/lib/wavix_api/v1/e911_records/validate_address.rb +44 -0
- data/lib/wavix_api/v1/mydids/cities.rb +32 -0
- data/lib/wavix_api/v1/mydids/destroy.rb +55 -0
- data/lib/wavix_api/v1/mydids/find.rb +21 -0
- data/lib/wavix_api/v1/mydids/search.rb +35 -0
- data/lib/wavix_api/v1/mydids/update.rb +40 -0
- data/lib/wavix_api/v1/mydids/update_destinations.rb +73 -0
- data/lib/wavix_api/v1/mydids/update_sms_enabled.rb +32 -0
- data/lib/wavix_api/v1/papers/create.rb +65 -0
- data/lib/wavix_api/v1/papers/find.rb +42 -0
- data/lib/wavix_api/v1/profile/account_config.rb +21 -0
- data/lib/wavix_api/v1/profile/find.rb +21 -0
- data/lib/wavix_api/v1/profile/update.rb +58 -0
- data/lib/wavix_api/v1/sub_organizations/create.rb +36 -0
- data/lib/wavix_api/v1/sub_organizations/find.rb +19 -0
- data/lib/wavix_api/v1/sub_organizations/search.rb +31 -0
- data/lib/wavix_api/v1/sub_organizations/transactions.rb +39 -0
- data/lib/wavix_api/v1/sub_organizations/update.rb +40 -0
- data/lib/wavix_api/v1/trunks/create.rb +76 -0
- data/lib/wavix_api/v1/trunks/destroy.rb +19 -0
- data/lib/wavix_api/v1/trunks/find.rb +19 -0
- data/lib/wavix_api/v1/trunks/search.rb +30 -0
- data/lib/wavix_api/v1/trunks/update.rb +85 -0
- data/lib/wavix_api/v1/voice_campaigns/create.rb +39 -0
- data/lib/wavix_api/v1/voice_campaigns/find.rb +21 -0
- data/lib/wavix_api/v2/base_destroy.rb +10 -0
- data/lib/wavix_api/v2/base_find.rb +10 -0
- data/lib/wavix_api/v2/base_search.rb +10 -0
- data/lib/wavix_api/v2/messages/all.rb +23 -0
- data/lib/wavix_api/v2/messages/async_create.rb +23 -0
- data/lib/wavix_api/v2/messages/attachments/find.rb +59 -0
- data/lib/wavix_api/v2/messages/common_vars.rb +50 -0
- data/lib/wavix_api/v2/messages/create.rb +24 -0
- data/lib/wavix_api/v2/messages/find.rb +19 -0
- data/lib/wavix_api/v2/messages/opt_outs/create.rb +34 -0
- data/lib/wavix_api/v2/messages/search.rb +23 -0
- data/lib/wavix_api/v2/messages/sender_ids/create.rb +40 -0
- data/lib/wavix_api/v2/messages/sender_ids/destroy.rb +21 -0
- data/lib/wavix_api/v2/messages/sender_ids/find.rb +21 -0
- data/lib/wavix_api/v2/messages/sender_ids/restrictions.rb +32 -0
- data/lib/wavix_api/v2/messages/sender_ids/search.rb +21 -0
- data/lib/wavix_api/v3/messages/sender_ids/create.rb +51 -0
- data/lib/wavix_api/v3/messages/sender_ids/find.rb +21 -0
- data/lib/wavix_api/v3/messages/sender_ids/search.rb +21 -0
- data/lib/wavix_api.rb +155 -0
- data/wavix-sdk-ruby.gemspec +40 -0
- metadata +204 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module E911Records
|
8
|
+
class Create
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
name: { type: 'string' }.freeze,
|
15
|
+
phone_number: { type: 'string' }.freeze,
|
16
|
+
address: {
|
17
|
+
type: 'object',
|
18
|
+
properties: {
|
19
|
+
street_number: { type: 'string' }.freeze,
|
20
|
+
street: { type: 'string' }.freeze,
|
21
|
+
location: { type: 'string' }.freeze,
|
22
|
+
city: { type: 'string' }.freeze,
|
23
|
+
state: { type: 'string' }.freeze,
|
24
|
+
zip_code: { type: 'string' }.freeze,
|
25
|
+
zip_plus_four: { type: 'string' }.freeze
|
26
|
+
}.freeze,
|
27
|
+
required: %i[
|
28
|
+
street_number street location city state zip_code zip_plus_four
|
29
|
+
].freeze
|
30
|
+
}.freeze
|
31
|
+
}.freeze,
|
32
|
+
required: %i[name phone_number address].freeze
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
class << self
|
36
|
+
def call(params)
|
37
|
+
instance = new(params)
|
38
|
+
|
39
|
+
instance.validate!
|
40
|
+
|
41
|
+
instance.post('v1/e911-records')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module E911Records
|
8
|
+
class Destroy
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
phone_number: { type: 'string' }.freeze
|
15
|
+
}.freeze,
|
16
|
+
required: %i[phone_number].freeze
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def call(params = {})
|
21
|
+
instance = new(params)
|
22
|
+
|
23
|
+
instance.validate!
|
24
|
+
|
25
|
+
instance.delete('v1/e911-records')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module E911Records
|
8
|
+
class Search
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
phone_number: {
|
15
|
+
type: 'string',
|
16
|
+
pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
|
17
|
+
}.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/e911-records')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module E911Records
|
8
|
+
class ValidateAddress
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
name: { type: 'string' }.freeze,
|
15
|
+
phone_number: { type: 'string' }.freeze,
|
16
|
+
address: {
|
17
|
+
type: 'object',
|
18
|
+
properties: {
|
19
|
+
street_number: { type: 'string' }.freeze,
|
20
|
+
street: { type: 'string' }.freeze,
|
21
|
+
location: { type: 'string' }.freeze,
|
22
|
+
city: { type: 'string' }.freeze,
|
23
|
+
state: { type: 'string' }.freeze,
|
24
|
+
zip_code: { type: 'string' }.freeze
|
25
|
+
}.freeze,
|
26
|
+
required: %i[street_number street location city state zip_code].freeze
|
27
|
+
}.freeze
|
28
|
+
}.freeze,
|
29
|
+
required: %i[name phone_number address].freeze
|
30
|
+
}.freeze
|
31
|
+
|
32
|
+
class << self
|
33
|
+
def call(params)
|
34
|
+
instance = new(params)
|
35
|
+
|
36
|
+
instance.validate!
|
37
|
+
|
38
|
+
instance.post('v1/e911-records/validate-address')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class Cities
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
name: { type: 'string' }.freeze,
|
15
|
+
**::WavixApi::BaseMethods::PAGINATION_SCHEMA
|
16
|
+
}.freeze,
|
17
|
+
required: %i[name].freeze
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def call(params = {})
|
22
|
+
instance = new(params)
|
23
|
+
|
24
|
+
instance.validate!
|
25
|
+
|
26
|
+
instance.get('v1/mydids/cities')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class Destroy
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
ids: {
|
15
|
+
anyOf: [
|
16
|
+
{ type: 'array', items: { type: 'integer' }.freeze }.freeze,
|
17
|
+
{ type: 'string', pattern: ::WavixApi::BaseMethods::LIST_OF_DIGITS_REGEXP }.freeze
|
18
|
+
].freeze
|
19
|
+
},
|
20
|
+
dids: {
|
21
|
+
anyOf: [
|
22
|
+
{
|
23
|
+
type: 'array',
|
24
|
+
items: {
|
25
|
+
type: 'string',
|
26
|
+
pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
|
27
|
+
}.freeze
|
28
|
+
}.freeze,
|
29
|
+
{ type: 'string', pattern: ::WavixApi::BaseMethods::LIST_OF_DIGITS_REGEXP }.freeze
|
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
|
+
|
41
|
+
if instance.params[:ids].nil? && instance.params[:dids].nil?
|
42
|
+
instance.raise_error('Either dids or ids is required')
|
43
|
+
end
|
44
|
+
|
45
|
+
if !instance.params[:ids].nil? && !instance.params[:dids].nil?
|
46
|
+
instance.raise_error('Either dids or ids is supported')
|
47
|
+
end
|
48
|
+
|
49
|
+
instance.delete('v1/mydids')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class Find < ::WavixApi::V1::BaseFind
|
9
|
+
@params_schema = ::WavixApi::BaseMethods::ONLY_ID_SCHEMA
|
10
|
+
|
11
|
+
class << self
|
12
|
+
private
|
13
|
+
|
14
|
+
def path
|
15
|
+
'v1/mydids'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class Search
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
name: { type: 'string' }.freeze,
|
15
|
+
search: { type: 'string' }.freeze,
|
16
|
+
city_id: { type: 'integer' }.freeze,
|
17
|
+
label_present: { type: 'boolean' }.freeze,
|
18
|
+
label: { type: 'string' }.freeze,
|
19
|
+
**::WavixApi::BaseMethods::PAGINATION_SCHEMA
|
20
|
+
}.freeze
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
class << self
|
24
|
+
def call(params = {})
|
25
|
+
instance = new(params)
|
26
|
+
|
27
|
+
instance.validate!
|
28
|
+
|
29
|
+
instance.get('v1/mydids')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class Update
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
call_recording_enabled: { type: 'boolean' }.freeze,
|
15
|
+
transcription_enabled: { type: 'boolean' }.freeze,
|
16
|
+
transcription_threshold: { type: 'integer' }.freeze,
|
17
|
+
sms_relay_url: { type: 'string' }.freeze,
|
18
|
+
id: { type: 'integer' }.freeze
|
19
|
+
}.freeze,
|
20
|
+
required: %i[
|
21
|
+
call_recording_enabled
|
22
|
+
transcription_enabled
|
23
|
+
transcription_threshold
|
24
|
+
id
|
25
|
+
].freeze
|
26
|
+
}.freeze
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def call(params = {})
|
30
|
+
instance = new(params)
|
31
|
+
|
32
|
+
instance.validate!
|
33
|
+
|
34
|
+
instance.patch(['v1/mydids', instance.id].join('/'))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class UpdateDestinations
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
ids: {
|
15
|
+
anyOf: [
|
16
|
+
{ type: 'array', items: { type: 'integer' }.freeze }.freeze,
|
17
|
+
{ type: 'string', pattern: ::WavixApi::BaseMethods::LIST_OF_DIGITS_REGEXP }.freeze
|
18
|
+
].freeze
|
19
|
+
},
|
20
|
+
dids: {
|
21
|
+
anyOf: [
|
22
|
+
{ type: 'array',
|
23
|
+
items: {
|
24
|
+
type: 'string',
|
25
|
+
pattern: ::WavixApi::BaseMethods::ONLY_DIGITS_REGEXP
|
26
|
+
}.freeze }.freeze,
|
27
|
+
{ type: 'string', pattern: ::WavixApi::BaseMethods::LIST_OF_DIGITS_REGEXP }.freeze
|
28
|
+
].freeze
|
29
|
+
}.freeze,
|
30
|
+
sms_relay_url: { type: 'string' }.freeze,
|
31
|
+
destinations: {
|
32
|
+
type: 'array',
|
33
|
+
items: {
|
34
|
+
type: 'object',
|
35
|
+
properties: {
|
36
|
+
transport: { enum: [1, 4, 5].freeze }.freeze,
|
37
|
+
destination: { type: 'string' }.freeze,
|
38
|
+
priority: { type: 'integer' }.freeze,
|
39
|
+
trunk_id: { type: 'integer' }.freeze
|
40
|
+
}.freeze,
|
41
|
+
required: %i[transport destination priority].freeze
|
42
|
+
}.freeze
|
43
|
+
}.freeze
|
44
|
+
}.freeze
|
45
|
+
}.freeze
|
46
|
+
|
47
|
+
class << self
|
48
|
+
def call(params = {})
|
49
|
+
instance = new(params)
|
50
|
+
|
51
|
+
instance.validate!
|
52
|
+
|
53
|
+
if instance.params[:ids].nil? && instance.params[:dids].nil?
|
54
|
+
instance.raise_error('Either dids or ids is required')
|
55
|
+
end
|
56
|
+
|
57
|
+
if !instance.params[:ids].nil? && !instance.params[:dids].nil?
|
58
|
+
instance.raise_error('Either dids or ids is supported')
|
59
|
+
end
|
60
|
+
|
61
|
+
if instance.params[:destinations].nil? && instance.params[:sms_relay_url].nil?
|
62
|
+
instance.raise_error(
|
63
|
+
"Either 'destinations' or 'sms_relay_url' or both must be specified"
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
instance.post('v1/mydids/update-destinations')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Mydids
|
8
|
+
class UpdateSmsEnabled
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
sms_enabled: { type: 'boolean' }.freeze,
|
15
|
+
id: { type: 'integer' }.freeze
|
16
|
+
}.freeze,
|
17
|
+
required: %i[sms_enabled id].freeze
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def call(params = {})
|
22
|
+
instance = new(params)
|
23
|
+
|
24
|
+
instance.validate!
|
25
|
+
|
26
|
+
instance.put('v1/mydids/update-sms-enabled')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WavixApi
|
4
|
+
module V1
|
5
|
+
module Papers
|
6
|
+
class Create
|
7
|
+
include WavixApi::BaseMethods
|
8
|
+
|
9
|
+
CONTENT_TYPES = {
|
10
|
+
'jpeg' => 'image/jpeg',
|
11
|
+
'jpg' => 'image/jpeg',
|
12
|
+
'gif' => 'image/gif',
|
13
|
+
'png' => 'image/png',
|
14
|
+
'pdf' => 'application/pdf',
|
15
|
+
'bmp' => 'image/bmp',
|
16
|
+
'tiff' => 'image/tiff',
|
17
|
+
'doc' => 'application/msword',
|
18
|
+
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
19
|
+
'dib' => 'image/dib'
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
@params_schema = {
|
23
|
+
type: 'object',
|
24
|
+
properties: {
|
25
|
+
did_ids: {
|
26
|
+
type: 'string',
|
27
|
+
pattern: ::WavixApi::BaseMethods::LIST_OF_DIGITS_REGEXP
|
28
|
+
}.freeze,
|
29
|
+
doc_id: { type: 'integer' }.freeze
|
30
|
+
}.freeze,
|
31
|
+
required: %i[did_ids doc_id doc_attachment].freeze
|
32
|
+
}.freeze
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def call(params = {})
|
36
|
+
instance = new(params)
|
37
|
+
instance.validate!
|
38
|
+
|
39
|
+
doc_attachment = instance.params[:doc_attachment]
|
40
|
+
unless doc_attachment.respond_to?(:path)
|
41
|
+
instance.raise_error('doc_attachment must respond to method "path"')
|
42
|
+
end
|
43
|
+
|
44
|
+
extention = instance.file_extention(doc_attachment)
|
45
|
+
unless CONTENT_TYPES.keys.include?(extention)
|
46
|
+
instance.raise_error(
|
47
|
+
"doc_attachment have invalid extention. Valid are #{CONTENT_TYPES.keys}"
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
instance.params[:doc_attachment] = instance.format_file(
|
52
|
+
doc_attachment,
|
53
|
+
content_type: CONTENT_TYPES[extention]
|
54
|
+
)
|
55
|
+
instance.post(
|
56
|
+
'v1/mydids/papers',
|
57
|
+
with_file: true,
|
58
|
+
headers: { 'Content-Disposition' => 'form-data', 'Content-Type' => '' }
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WavixApi
|
4
|
+
module V1
|
5
|
+
module Papers
|
6
|
+
class Find
|
7
|
+
include WavixApi::BaseMethods
|
8
|
+
|
9
|
+
@params_schema = {
|
10
|
+
type: 'object',
|
11
|
+
properties: {
|
12
|
+
mydid_id: { type: 'integer' }.freeze,
|
13
|
+
doc_type_id: { type: 'integer' }.freeze
|
14
|
+
}.freeze,
|
15
|
+
required: %i[mydid_id doc_type_id].freeze
|
16
|
+
}.freeze
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def call(params = {}, save_path: nil)
|
20
|
+
instance = new(params)
|
21
|
+
|
22
|
+
instance.validate!
|
23
|
+
|
24
|
+
instance.download(
|
25
|
+
"v1/mydids/#{instance.params[:mydid_id]}/papers/#{instance.params[:doc_type_id]}",
|
26
|
+
save_path: save_path
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(params = nil)
|
32
|
+
super
|
33
|
+
@save_path = params[:save_path]
|
34
|
+
end
|
35
|
+
|
36
|
+
def call
|
37
|
+
self.class.call(params, save_path: @save_path)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WavixApi
|
4
|
+
module V1
|
5
|
+
module Profile
|
6
|
+
class AccountConfig
|
7
|
+
include WavixApi::BaseMethods
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def call(params = {})
|
11
|
+
instance = new(params)
|
12
|
+
|
13
|
+
instance.validate!
|
14
|
+
|
15
|
+
instance.get('v1/profile/config')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WavixApi
|
4
|
+
module V1
|
5
|
+
module Profile
|
6
|
+
class Find
|
7
|
+
include WavixApi::BaseMethods
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def call(params = {})
|
11
|
+
instance = new(params)
|
12
|
+
|
13
|
+
instance.validate!
|
14
|
+
|
15
|
+
instance.get('v1/profile')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wavix_api'
|
4
|
+
|
5
|
+
module WavixApi
|
6
|
+
module V1
|
7
|
+
module Profile
|
8
|
+
class Update
|
9
|
+
include WavixApi::BaseMethods
|
10
|
+
|
11
|
+
@params_schema = {
|
12
|
+
type: 'object',
|
13
|
+
properties: {
|
14
|
+
additional_info: { type: 'string' }.freeze,
|
15
|
+
attn_contact_name: { type: 'string' }.freeze,
|
16
|
+
billing_address: { type: 'string' }.freeze,
|
17
|
+
contact_email: { type: 'string' }.freeze,
|
18
|
+
default_short_link_endpoint: { type: 'string' }.freeze,
|
19
|
+
first_name: { type: 'string' }.freeze,
|
20
|
+
last_name: { type: 'string' }.freeze,
|
21
|
+
phone: { type: 'string' }.freeze,
|
22
|
+
sms_relay_url: { type: 'string' }.freeze,
|
23
|
+
dlr_relay_url: { type: 'string' }.freeze,
|
24
|
+
timezone: { type: 'string' }.freeze,
|
25
|
+
job_title: { type: 'string' }.freeze,
|
26
|
+
company_name: { type: 'string' }.freeze,
|
27
|
+
company_address: { type: 'string' }.freeze,
|
28
|
+
company_industry: { type: 'string' }.freeze,
|
29
|
+
company_vat_number: { type: 'string' }.freeze,
|
30
|
+
company_country_code: { type: 'string' }.freeze
|
31
|
+
}.freeze,
|
32
|
+
required: %i[
|
33
|
+
additional_info
|
34
|
+
attn_contact_name
|
35
|
+
billing_address
|
36
|
+
company_name
|
37
|
+
contact_email
|
38
|
+
first_name
|
39
|
+
last_name
|
40
|
+
phone
|
41
|
+
timezone
|
42
|
+
].freeze,
|
43
|
+
additionalProperties: false
|
44
|
+
}.freeze
|
45
|
+
|
46
|
+
class << self
|
47
|
+
def call(params = {})
|
48
|
+
instance = new(params)
|
49
|
+
|
50
|
+
instance.validate!
|
51
|
+
|
52
|
+
instance.patch('v1/profile')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|