Sha256: a8b3b1838ea55236125a1840c31bcdcf16c1a503b8b4cbfa6598e90aafc707fb

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module MangoPay
  # Provides API methods for the UBO declaration entity.
  class UboDeclaration < Resource
    class << self
      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

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

      # Fetches the Ubo declaration belonging to the given +user_id+ if given, with the given +id+.
      def fetch(user_id, id, idempotency_key)
        url = (user_id) ? url(user_id, id) : "#{MangoPay.api_path}/kyc/ubodeclarations/#{CGI.escape(id.to_s)}"
        MangoPay.request(:get, url, {}, {}, idempotency_key)
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mangopay-3.6.0 lib/mangopay/ubo_declaration.rb
mangopay-3.5.0 lib/mangopay/ubo_declaration.rb