Class: MangoPay::UboDeclaration

Inherits:
Resource
  • Object
show all
Defined in:
lib/mangopay/ubo_declaration.rb

Overview

Provides API methods for the UBO declaration entity.

Class Method Summary collapse

Methods inherited from Resource

class_name

Class Method Details

.create(user_id, idempotency_key = nil) ⇒ Object



13
14
15
# File 'lib/mangopay/ubo_declaration.rb', line 13

def create(user_id, idempotency_key = nil)
  MangoPay.request(:post, url(user_id), {}, {}, idempotency_key)
end

.fetch(user_id, id, idempotency_key = nil) ⇒ Object

Fetches the Ubo declaration belonging to the given user_id if given, with the given id.



18
19
20
21
# File 'lib/mangopay/ubo_declaration.rb', line 18

def fetch(user_id, id, idempotency_key = nil)
  url = (user_id) ? url(user_id, id) : "#{MangoPay.api_path}/kyc/ubodeclarations/#{CGI.escape(id.to_s)}"
  MangoPay.request(:get, url, {}, {}, idempotency_key)
end

.update(user_id, id, params = {}, idempotency_key = nil) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/mangopay/ubo_declaration.rb', line 23

def update(user_id, id, params = {}, idempotency_key = nil)
  request_params = {
      Status: params['Status'],
      Ubos: params['Ubos']
  }
  MangoPay.request(:put, url(user_id, id), request_params, {}, idempotency_key)
end

.url(user_id, id = nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/mangopay/ubo_declaration.rb', line 5

def url(user_id, id = nil)
  if id
    "#{MangoPay.api_path}/users/#{user_id}/kyc/ubodeclarations/#{id}"
  else
    "#{MangoPay.api_path}/users/#{user_id}/kyc/ubodeclarations"
  end
end