Class: Leetchi::User

Inherits:
Ressource show all
Defined in:
lib/leetchi/user.rb

Overview

Use the User class for any operations related to the user

Class Method Summary collapse

Class Method Details

.cards(user_id) ⇒ Object

Get a list of the given user payment cards

  • Args :

    • user_id -> The id of the user you want to retrieve cards from

  • Returns :

    • An array of registered payment cards objects



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

def self.cards(user_id)
  get_request(File.join('users', user_id.to_s, 'cards'))
end

.create(data) ⇒ Object

Create a new user

  • Args :

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      * [Email]
      * [FirstName]
      * [LastName]
      * [CanRegisterMeanOfPayment] true by default
      * IP
      * [Birthday]
      * [Password]
      
  • Returns :

    • A user object



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

def self.create(data)
  post_request('users', data)
end

.create_strong_authentication(user_id, data) ⇒ Object

Create a request of strong user authentication. If a strongAuthentication object already exist for the user, this request returns the existing object.

  • Args :

    • user_id -> The id of the user you want to strongly authenticate

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      
  • Returns :

    • A Strong Authentication object



107
108
109
# File 'lib/leetchi/user.rb', line 107

def self.create_strong_authentication(user_id, data)
  post_request(File.join('users', user_id.to_s, 'strongAuthentication'), data)
end

.details(user_id) ⇒ Object

Get a user

  • Args :

    • user_id -> The id of the user you want to retrieve

  • Returns :

    • A user object



31
32
33
# File 'lib/leetchi/user.rb', line 31

def self.details(user_id)
  get_request(File.join('users', user_id.to_s))
end

.expense_sites(user_id, wallet_id) ⇒ Object

Get the expense sites for a given user

  • Args :

    • user_id -> The id of the user you want to retrieve the expense sites from

    • wallet_id -> The id of the wallet you want to retrieve the expense sites from

  • Returns :

    • An array of expense site objects



144
145
146
# File 'lib/leetchi/user.rb', line 144

def self.expense_sites(user_id, wallet_id)
  get_request(File.join('expense-sites'), "userID=#{user_id.to_s}&walletID=#{wallet_id.to_s}")
end

.get_strong_authentication(user_id) ⇒ Object

Get a Strong Authentication object

  • Args :

    • user_id -> The id of the user you want to retrieve the strong authentication object from

  • Returns :

    • A Strong Authentication object



118
119
120
# File 'lib/leetchi/user.rb', line 118

def self.get_strong_authentication(user_id)
  get_request(File.join('users', user_id.to_s, 'strongAuthentication'))
end

.get_wallets(user_id) ⇒ Object

Get a list of the given user wallets

  • Args :

    • user_id -> The id of the user you want to retrieve wallets from

  • Returns :

    • An array of wallets objects



60
61
62
# File 'lib/leetchi/user.rb', line 60

def self.get_wallets(user_id)
  get_request(File.join('users', user_id.to_s, 'wallets'))
end

.operations(user_id) ⇒ Object

Get operations associated with a user

  • Args :

    • user_id -> The id of the user you want to retrieve operations from

  • Returns :

    • An array of operations objects



82
83
84
# File 'lib/leetchi/user.rb', line 82

def self.operations(user_id)
  get_request(File.join('users', user_id.to_s, 'operations'))
end

.personal_operations(user_id) ⇒ Object

Get operations from the given user personal account

  • Args :

    • user_id -> The id of the user you want to retrieve operations from

  • Returns :

    • An array of operations objects



93
94
95
# File 'lib/leetchi/user.rb', line 93

def self.personal_operations(user_id)
  get_request(File.join('users', user_id.to_s, 'operations', 'personal'))
end

.update(user_id, data) ⇒ Object

Update a given user

  • Args :

    • user_id -> The id of the user you want to update

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      * [Email]
      * [FirstName]
      * [LastName]
      * [CanRegisterMeanOfPayment]
      * [Password]
      
  • Returns :

    • A user object



49
50
51
# File 'lib/leetchi/user.rb', line 49

def self.update(user_id, data)
  put_request(File.join('users', user_id.to_s), data)
end

.update_strong_authentication(user_id, data) ⇒ Object

Update a Strong Authentication object

  • Args :

    • user_id -> The id of the user you want to update the strong authentication object from

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      * [IsDocumentsTransmitted]
      
  • Returns :

    • A Strong Authentication object



132
133
134
# File 'lib/leetchi/user.rb', line 132

def self.update_strong_authentication(user_id, data)
  put_request(File.join('users', user_id.to_s, 'strongAuthentication'), data)
end