didww-v3 1.3.0 → 2.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 +27 -0
- data/.rubocop.yml +22 -19
- data/CHANGELOG.md +53 -0
- data/Gemfile +20 -0
- data/README.md +7 -1
- data/Rakefile +6 -1
- data/bin/console +1 -0
- data/didww-v3.gemspec +3 -18
- data/lib/didww/{middleware.rb → base_middleware.rb} +5 -4
- data/lib/didww/callback/request_validator.rb +68 -0
- data/lib/didww/client.rb +61 -3
- data/lib/didww/complex_objects/base.rb +5 -1
- data/lib/didww/complex_objects/capacity_order_item.rb +1 -0
- data/lib/didww/complex_objects/cdr_export_filter.rb +1 -0
- data/lib/didww/complex_objects/configurations/base.rb +1 -0
- data/lib/didww/complex_objects/configurations/const.rb +1 -0
- data/lib/didww/complex_objects/configurations/h323_configuration.rb +1 -0
- data/lib/didww/complex_objects/configurations/iax2_configuration.rb +1 -0
- data/lib/didww/complex_objects/configurations/pstn_configuration.rb +1 -0
- data/lib/didww/complex_objects/configurations/sip_configuration.rb +1 -0
- data/lib/didww/complex_objects/configurations.rb +1 -0
- data/lib/didww/complex_objects/did_order_item.rb +14 -12
- data/lib/didww/encrypt.rb +101 -0
- data/lib/didww/jsonapi_middleware.rb +21 -0
- data/lib/didww/resources/address.rb +37 -0
- data/lib/didww/resources/address_verification.rb +56 -0
- data/lib/didww/resources/area.rb +12 -0
- data/lib/didww/resources/available_did.rb +1 -0
- data/lib/didww/resources/balance.rb +1 -0
- data/lib/didww/resources/base.rb +2 -1
- data/lib/didww/resources/capacity_pool.rb +1 -0
- data/lib/didww/resources/cdr_export.rb +12 -1
- data/lib/didww/resources/city.rb +5 -0
- data/lib/didww/resources/country.rb +1 -0
- data/lib/didww/resources/did.rb +3 -1
- data/lib/didww/resources/did_group.rb +1 -4
- data/lib/didww/resources/did_group_type.rb +1 -0
- data/lib/didww/resources/did_reservation.rb +1 -0
- data/lib/didww/resources/encrypted_file.rb +58 -0
- data/lib/didww/resources/identity.rb +78 -0
- data/lib/didww/resources/order.rb +9 -0
- data/lib/didww/resources/permanent_supporting_document.rb +15 -0
- data/lib/didww/resources/pop.rb +1 -0
- data/lib/didww/resources/proof.rb +19 -0
- data/lib/didww/resources/proof_type.rb +14 -0
- data/lib/didww/resources/public_key.rb +12 -0
- data/lib/didww/resources/qty_based_pricing.rb +1 -0
- data/lib/didww/resources/region.rb +1 -0
- data/lib/didww/resources/requirement.rb +61 -0
- data/lib/didww/resources/requirement_validation.rb +10 -0
- data/lib/didww/resources/shared_capacity_group.rb +1 -0
- data/lib/didww/resources/stock_keeping_unit.rb +1 -0
- data/lib/didww/resources/supporting_document_template.rb +14 -0
- data/lib/didww/resources/trunk/const.rb +1 -0
- data/lib/didww/resources/trunk.rb +1 -0
- data/lib/didww/resources/trunk_group.rb +1 -0
- data/lib/didww/version.rb +2 -1
- data/lib/didww.rb +5 -1
- metadata +32 -157
- data/.travis.yml +0 -5
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'openssl'
|
3
|
+
require 'openssl/oaep'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
module DIDWW
|
7
|
+
# Allows to encrypt file on Ruby-side before uploading to `/v3/encrypted_files`.
|
8
|
+
# @example
|
9
|
+
# file_content_1 = File.read('file_to_send_1.jpg', mode: 'rb')
|
10
|
+
# file_content_2 = File.read('file_to_send_1.pdf', mode: 'rb')
|
11
|
+
# enc = DIDWW::Encrypt.new
|
12
|
+
# enc_data_1 = enc.encrypt(file_content_1)
|
13
|
+
# enc_data_2 = enc.encrypt(file_content_2)
|
14
|
+
# enc_io_1 = Faraday::UploadIO.new(StringIO.new(enc_data_1), 'application/octet-stream')
|
15
|
+
# enc_io_2 = Faraday::UploadIO.new(StringIO.new(enc_data_2), 'application/octet-stream')
|
16
|
+
# DIDWW::Resource::EncryptedFile.upload(
|
17
|
+
# encryption_fingerprint: enc.encryption_fingerprint,
|
18
|
+
# items: [
|
19
|
+
# { file: enc_io_1, description: 'file_to_send_1.jpg' },
|
20
|
+
# { file: enc_io_2, description: 'file_to_send_2.pdf' }
|
21
|
+
# ]
|
22
|
+
# ) # => Array if IDs
|
23
|
+
#
|
24
|
+
class Encrypt
|
25
|
+
AES_ALGO = [256, :CBC]
|
26
|
+
AES_KEY_LEN = 32
|
27
|
+
AES_IV_LEN = 16
|
28
|
+
LABEL = ''
|
29
|
+
SEPARATOR = ':::'
|
30
|
+
|
31
|
+
class << self
|
32
|
+
# @param binary [String]
|
33
|
+
# @return [String]
|
34
|
+
def encrypt(binary)
|
35
|
+
new.encrypt(binary)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
attr_reader :public_keys, :encryption_fingerprint
|
40
|
+
|
41
|
+
def initialize
|
42
|
+
reset!
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param binary [String] binary content of a file.
|
46
|
+
# @return [String] binary content of an encrypted file.
|
47
|
+
def encrypt(binary)
|
48
|
+
aes_key, aes_iv, encrypted_aes = encrypt_aes(binary)
|
49
|
+
aes_credentials = aes_key + aes_iv
|
50
|
+
encrypted_rsa_a = encrypt_rsa_oaep(public_keys[0], aes_credentials)
|
51
|
+
encrypted_rsa_b = encrypt_rsa_oaep(public_keys[1], aes_credentials)
|
52
|
+
encrypted_rsa_a + encrypted_rsa_b + encrypted_aes
|
53
|
+
end
|
54
|
+
|
55
|
+
# Resets public keys and fingerprint.
|
56
|
+
def reset!
|
57
|
+
@public_keys = fetch_public_keys
|
58
|
+
@encryption_fingerprint = calculate_fingerprint
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
# @return [Array(String,String)] public keys.
|
64
|
+
def fetch_public_keys
|
65
|
+
DIDWW::Resource::PublicKey.find.map(&:key)
|
66
|
+
end
|
67
|
+
|
68
|
+
def calculate_fingerprint
|
69
|
+
public_keys.map { |pub_key| fingerprint_for(pub_key) }.join(SEPARATOR)
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param public_key [String] PEM public key.
|
73
|
+
# @return [String] hexstring digest SHA1 for public key binary.
|
74
|
+
def fingerprint_for(public_key)
|
75
|
+
public_key += "\n" unless public_key[-1] == "\n"
|
76
|
+
public_key_base64 = public_key.split("\n")[1..-2].join
|
77
|
+
public_key_bin = Base64.decode64(public_key_base64)
|
78
|
+
OpenSSL::Digest::SHA1.hexdigest(public_key_bin)
|
79
|
+
end
|
80
|
+
|
81
|
+
# @param public_key [String]
|
82
|
+
# @param text [String]
|
83
|
+
def encrypt_rsa_oaep(public_key, text)
|
84
|
+
rsa = OpenSSL::PKey::RSA.new(public_key)
|
85
|
+
rsa.public_encrypt_oaep(text, LABEL, OpenSSL::Digest::SHA256)
|
86
|
+
end
|
87
|
+
|
88
|
+
# @param binary [String]
|
89
|
+
# @return [Array(String,String,String)] binaries key, vector, encrypted data.
|
90
|
+
def encrypt_aes(binary)
|
91
|
+
key = SecureRandom.random_bytes(AES_KEY_LEN)
|
92
|
+
iv = SecureRandom.random_bytes(AES_IV_LEN)
|
93
|
+
cipher = OpenSSL::Cipher::AES.new(*AES_ALGO)
|
94
|
+
cipher.encrypt
|
95
|
+
cipher.key = key
|
96
|
+
cipher.iv = iv
|
97
|
+
encrypted = cipher.update(binary) + cipher.final
|
98
|
+
[key, iv, encrypted]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module DIDWW
|
3
|
+
# :nodoc:
|
4
|
+
class JsonapiMiddleware < Faraday::Middleware
|
5
|
+
def call(request_env)
|
6
|
+
headers = {}
|
7
|
+
headers['Content-Type'] = 'application/vnd.api+json'
|
8
|
+
headers['Api-Key'] = DIDWW::Client.api_key
|
9
|
+
headers['User-Agent'] = "didww-v3 Ruby gem v#{VERSION}"
|
10
|
+
headers['x-didww-api-version'] = DIDWW::Client.api_version unless DIDWW::Client.api_version.blank?
|
11
|
+
|
12
|
+
request_env[:request_headers].merge!(headers)
|
13
|
+
request_env.url.host = URI(DIDWW::Client.api_base_url).host
|
14
|
+
|
15
|
+
@app.call(request_env).on_complete do |response_env|
|
16
|
+
# do something with the response
|
17
|
+
# response_env[:response_headers].merge!(...)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module DIDWW
|
3
|
+
module Resource
|
4
|
+
class Address < Base
|
5
|
+
|
6
|
+
has_one :identity, class_name: 'Identity'
|
7
|
+
has_one :country, class_name: 'Country'
|
8
|
+
has_many :proofs, class_name: 'Proof'
|
9
|
+
has_many :city, class_name: 'City'
|
10
|
+
has_many :area, class_name: 'Area'
|
11
|
+
|
12
|
+
property :city_name, type: :string
|
13
|
+
# Type: String
|
14
|
+
# Description:
|
15
|
+
|
16
|
+
property :postal_code, type: :string
|
17
|
+
# Type: String
|
18
|
+
# Description:
|
19
|
+
|
20
|
+
property :address, type: :string
|
21
|
+
# Type: String
|
22
|
+
# Description:
|
23
|
+
|
24
|
+
property :description, type: :string
|
25
|
+
# Type: String
|
26
|
+
# Description:
|
27
|
+
|
28
|
+
property :created_at, type: :date
|
29
|
+
# Type: Date
|
30
|
+
# Description:
|
31
|
+
|
32
|
+
property :verified, type: :boolean
|
33
|
+
# Type: Boolean
|
34
|
+
# Description:
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module DIDWW
|
3
|
+
module Resource
|
4
|
+
class AddressVerification < Base
|
5
|
+
STATUS_PENDING = 'Pending'
|
6
|
+
STATUS_APPROVED = 'Approved'
|
7
|
+
STATUS_REJECTED = 'Rejected'
|
8
|
+
STATUSES = [
|
9
|
+
STATUS_PENDING,
|
10
|
+
STATUS_APPROVED,
|
11
|
+
STATUS_REJECTED
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
has_one :address, class_name: 'Address'
|
15
|
+
has_many :dids, class_name: 'Did'
|
16
|
+
has_many :onetime_files, class_name: 'EncryptedFile'
|
17
|
+
|
18
|
+
property :service_description, type: :string
|
19
|
+
# Type: String
|
20
|
+
# Description:
|
21
|
+
|
22
|
+
property :status, type: :string
|
23
|
+
# Type: String
|
24
|
+
# Description:
|
25
|
+
|
26
|
+
property :reject_reasons, type: :string
|
27
|
+
# Type: String
|
28
|
+
# Description:
|
29
|
+
|
30
|
+
property :created_at, type: :date
|
31
|
+
# Type: Date
|
32
|
+
# Description:
|
33
|
+
|
34
|
+
property :callback_url, type: :string
|
35
|
+
# Type: String
|
36
|
+
# Description: valid URI for callbacks
|
37
|
+
|
38
|
+
property :callback_method, type: :string
|
39
|
+
# Type: String
|
40
|
+
# Description: GET or POST
|
41
|
+
|
42
|
+
def pending?
|
43
|
+
status == STATUS_PENDING
|
44
|
+
end
|
45
|
+
|
46
|
+
def approved?
|
47
|
+
status == STATUS_APPROVED
|
48
|
+
end
|
49
|
+
|
50
|
+
def rejected?
|
51
|
+
status == STATUS_REJECTED
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/didww/resources/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'forwardable'
|
2
3
|
require 'didww/complex_objects/cdr_export_filter'
|
3
4
|
require 'down/http'
|
@@ -7,6 +8,8 @@ module DIDWW
|
|
7
8
|
class CdrExport < Base
|
8
9
|
extend Forwardable
|
9
10
|
|
11
|
+
STATUS_COMPLETED = 'Completed'
|
12
|
+
|
10
13
|
property :filters, type: :cdr_export_filter
|
11
14
|
# Type: CDR Export Filters Object
|
12
15
|
# Nullable: No
|
@@ -27,6 +30,14 @@ module DIDWW
|
|
27
30
|
# Nullable: true
|
28
31
|
# Description: url of csv file for downloading. available only when status is "Completed"
|
29
32
|
|
33
|
+
property :callback_url, type: :string
|
34
|
+
# Type: String
|
35
|
+
# Description: valid URI for callbacks
|
36
|
+
|
37
|
+
property :callback_method, type: :string
|
38
|
+
# Type: String
|
39
|
+
# Description: GET or POST
|
40
|
+
|
30
41
|
def_delegators :filters, :year, :month, :did_number, :year=, :month=, :did_number=
|
31
42
|
|
32
43
|
def initialize(params = {})
|
@@ -39,7 +50,7 @@ module DIDWW
|
|
39
50
|
end
|
40
51
|
|
41
52
|
def complete?
|
42
|
-
status ==
|
53
|
+
status == STATUS_COMPLETED
|
43
54
|
end
|
44
55
|
alias_method :completed?, :complete?
|
45
56
|
end
|
data/lib/didww/resources/city.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module DIDWW
|
2
3
|
module Resource
|
3
4
|
class City < Base
|
5
|
+
has_one :country, class_name: 'Country'
|
6
|
+
has_one :region, class_name: 'Region'
|
7
|
+
has_one :area, class_name: 'Area'
|
8
|
+
|
4
9
|
property :name, type: :string
|
5
10
|
# Type: String
|
6
11
|
# Description: City name
|
data/lib/didww/resources/did.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module DIDWW
|
2
3
|
module Resource
|
3
4
|
class Did < Base
|
@@ -5,6 +6,7 @@ module DIDWW
|
|
5
6
|
has_one :trunk_group
|
6
7
|
has_one :capacity_pool
|
7
8
|
has_one :shared_capacity_group
|
9
|
+
has_one :address_verification
|
8
10
|
|
9
11
|
property :blocked, type: :boolean
|
10
12
|
# Type: Boolean
|
@@ -18,7 +20,7 @@ module DIDWW
|
|
18
20
|
# Type: Boolean
|
19
21
|
# Description: Identifier for terminated DIDs that will be removed from service at the end of the billing cycle.
|
20
22
|
|
21
|
-
property :
|
23
|
+
property :billing_cycles_count, type: :integer
|
22
24
|
# Type: Boolean
|
23
25
|
# Description: Identifier for DIDs that are pending removal from your account.
|
24
26
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module DIDWW
|
2
3
|
module Resource
|
3
4
|
class DidGroup < Base
|
@@ -60,10 +61,6 @@ module DIDWW
|
|
60
61
|
# is_available
|
61
62
|
# Type: Boolean
|
62
63
|
# 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
64
|
|
68
65
|
end
|
69
66
|
end
|
@@ -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
|
@@ -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,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'didww/complex_objects/did_order_item'
|
2
3
|
require 'didww/complex_objects/capacity_order_item'
|
3
4
|
|
@@ -46,6 +47,14 @@ module DIDWW
|
|
46
47
|
# Type: Boolean
|
47
48
|
# Description: Allowing back ordering
|
48
49
|
|
50
|
+
property :callback_url, type: :string
|
51
|
+
# Type: String
|
52
|
+
# Description: valid URI for callbacks
|
53
|
+
|
54
|
+
property :callback_method, type: :string
|
55
|
+
# Type: String
|
56
|
+
# Description: GET or POST
|
57
|
+
|
49
58
|
def initialize(*args)
|
50
59
|
super
|
51
60
|
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
|
data/lib/didww/resources/pop.rb
CHANGED
@@ -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,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
|