Class: BridgeBankin::User

Inherits:
BridgeObject show all
Extended by:
API::Resource
Defined in:
lib/bridge_bankin/user.rb

Overview

User resource

Constant Summary collapse

RESOURCE_TYPE =
"user"

Constants inherited from BridgeObject

BridgeObject::HIDDEN_ATTRIBUTES

Class Method Summary collapse

Methods inherited from BridgeObject

#==, convert_to_bridge_object, #initialize, #to_hash, #to_json

Constructor Details

This class inherits a constructor from BridgeBankin::BridgeObject

Class Method Details

.check_email_confirmation(access_token:, **params) ⇒ BridgeObject

Check the logged in user email confirmation status

Parameters:

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:


109
110
111
112
113
114
# File 'lib/bridge_bankin/user.rb', line 109

def check_email_confirmation(access_token:, **params)
  protected_resource(access_token) do
    data = api_client.get("/v2/users/me/email/confirmation", params)
    convert_to_bridge_object(data)
  end
end

.create(**params) ⇒ User

Create a new user

Parameters:

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (User)

    the newly created user


45
46
47
48
# File 'lib/bridge_bankin/user.rb', line 45

def create(**params)
  data = api_client.post("/v2/users", params)
  convert_to_bridge_object(data)
end

.delete_all_users(**params) ⇒ Boolean

Delete all registered users

Parameters:

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Boolean)

    the request success status


96
97
98
99
# File 'lib/bridge_bankin/user.rb', line 96

def delete_all_users(**params)
  api_client.delete("/v2/users", params)
  true
end

.delete_user(uuid:, **params) ⇒ Boolean

Delete a specific user

Parameters:

  • uuid (UUID)

    the uuid of the requested resource

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Boolean)

    the request success status


84
85
86
87
# File 'lib/bridge_bankin/user.rb', line 84

def delete_user(uuid:, **params)
  api_client.delete("/v2/users/#{uuid}", params)
  true
end

.find(uuid:, **params) ⇒ User

Retrieve a specific user

Parameters:

  • uuid (UUID)

    the uuid of the requested resource

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (User)

    the requested user


33
34
35
36
# File 'lib/bridge_bankin/user.rb', line 33

def find(uuid:, **params)
  data = api_client.get("/v2/users/#{uuid}", params)
  convert_to_bridge_object(data)
end

.list(**params) ⇒ Array<User>

List all registered users

Parameters:

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (Array<User>)

    the registered users list


20
21
22
23
# File 'lib/bridge_bankin/user.rb', line 20

def list(**params)
  data = api_client.get("/v2/users", params)
  convert_to_bridge_object(data)
end

.manage_accounts(access_token:, **params) ⇒ BridgeObject

Request the URL to access to an interface to manage the logged in user accounts' IBAN

Parameters:

  • access_token (String)

    the access token provided during the user authentication

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (BridgeObject)

    an URL to access to the interface to manage accounts' IBAN


124
125
126
127
128
129
# File 'lib/bridge_bankin/user.rb', line 124

def manage_accounts(access_token:, **params)
  protected_resource(access_token) do
    data = api_client.get("/v2/users/manage/accounts/iban", params)
    convert_to_bridge_object(data)
  end
end

.update_email(uuid:, **params) ⇒ User

Update user email

Parameters:

  • uuid (UUID)

    the uuid of the requested resource

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (User)

    the updated user


58
59
60
61
# File 'lib/bridge_bankin/user.rb', line 58

def update_email(uuid:, **params)
  data = api_client.put("/v2/users/#{uuid}/email", params)
  convert_to_bridge_object(data)
end

.update_password(uuid:, **params) ⇒ User

Update user password

Parameters:

  • uuid (UUID)

    the uuid of the requested resource

  • params (Hash)

    any params that might be required (or optional) to communicate with the API

Returns:

  • (User)

    the updated user


71
72
73
74
# File 'lib/bridge_bankin/user.rb', line 71

def update_password(uuid:, **params)
  data = api_client.put("/v2/users/#{uuid}/password", params)
  convert_to_bridge_object(data)
end