Class: DocFox::KycApplication::CreateService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/doc_fox/kyc_application/create_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:) ⇒ CreateService

Returns a new instance of CreateService.



12
13
14
# File 'lib/doc_fox/kyc_application/create_service.rb', line 12

def initialize(data:)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/doc_fox/kyc_application/create_service.rb', line 4

def data
  @data
end

Instance Method Details

#callObject

Create a KYC application.

https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications/post

Examples

service = DocFox::KycApplication::CreateService.call(
data: {
  type: 'kyc_application',
  attributes: {
    kyc_entity_template_id: 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb',
    names: {
      first_names: 'Eric Theodore',
      last_names: 'Cartman'
    },
    # ...more fields following the schema definitions.
  }
}
)

service.success? # => true
service.errors # => #<ActiveModel::Errors []>

service.response # => #<Faraday::Response ...>
service.response.status # => 201
service.response.body # => {}

service.facade # => #<DocFox::KycApplication::Facade ...>
service.facade.id
service.id

POST /api/v2/kyc_applications



48
49
50
# File 'lib/doc_fox/kyc_application/create_service.rb', line 48

def call
  connection.post('kyc_applications', **params)
end