Module: MangoApi::Clients

Extended by:
UriProvider
Defined in:
lib/mangopay/api/service/clients.rb

Overview

Provides API method delegates concerning the Client entity

Class Method Summary collapse

Methods included from UriProvider

provide_uri

Class Method Details

.getClient

Retrieves the current environment’s client entity.

Returns:

  • (Client)

    current Client entity object



50
51
52
53
54
# File 'lib/mangopay/api/service/clients.rb', line 50

def get
  uri = provide_uri(:get_client)
  response = HttpClient.get(uri)
  parse response
end

.update(client) ⇒ Client

Updates the current environment’s client entity.

Client optional properties:

  • primary_button_colour

  • primary_theme_colour

  • admin_emails

  • tech_emails

  • billing_emails

  • fraud_emails

  • headquarters_address

  • tax_number

  • platform_type

  • platform_description

  • platform_url

and updated dat

Parameters:

  • +client+ (Client)

    client object with corresponding ID

Returns:

  • (Client)

    updated Client entity object



30
31
32
33
34
# File 'lib/mangopay/api/service/clients.rb', line 30

def update(client)
  uri = provide_uri(:update_client)
  response = HttpClient.put(uri, client)
  parse response
end

.upload_logo(path) ⇒ Object

Uploads the image file specified as the current environment’s client’s logo.

Parameters:

  • +path+ (String)

    path of the logo image



40
41
42
43
44
45
# File 'lib/mangopay/api/service/clients.rb', line 40

def (path)
  uri = provide_uri(:upload_client_logo)
  body = UploadFileRequest.new
  body.file = FileEncoder.encode_base64 path
  HttpClient.put(uri, body)
end