bridge_bankin 0.1.0 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # Item resource (bank connector)
6
+ #
4
7
  class Item < BridgeObject
5
8
  RESOURCE_TYPE = "item"
6
9
 
@@ -9,38 +12,82 @@ module BridgeBankin
9
12
  class << self
10
13
  include API::Resource
11
14
 
15
+ #
16
+ # List all logged in user items
17
+ #
18
+ # @param [String] access_token the access token provided during the user authentication
19
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
20
+ #
21
+ # @return [Array<Item>] the user items
22
+ #
12
23
  def list(access_token:, **params)
13
24
  protected_resource(access_token) do
14
- data = api_client.get("/v2/items", params)
15
- convert_to_bridge_object(data)
25
+ data = api_client.get("/v2/items", **params)
26
+ convert_to_bridge_object(**data)
16
27
  end
17
28
  end
18
29
 
30
+ #
31
+ # Retrieve a single item for logged in user
32
+ #
33
+ # @param [Integer] id the id of the requested resource
34
+ # @param [String] access_token the access token provided during the user authentication
35
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
36
+ #
37
+ # @return [Account] the requested user item
38
+ #
19
39
  def find(id:, access_token:, **params)
20
40
  protected_resource(access_token) do
21
- data = api_client.get("/v2/items/#{id}", params)
22
- convert_to_bridge_object(data)
41
+ data = api_client.get("/v2/items/#{id}", **params)
42
+ convert_to_bridge_object(**data)
23
43
  end
24
44
  end
25
45
 
46
+ #
47
+ # Trigger a refresh for a specific item
48
+ #
49
+ # @param [Integer] id the id of the requested resource
50
+ # @param [String] access_token the access token provided during the user authentication
51
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
52
+ #
53
+ # @return [BridgeObject] the item refresh status path
54
+ #
26
55
  def refresh(id:, access_token:, **params)
27
56
  protected_resource(access_token) do
28
- data = api_client.post("/v2/items/#{id}/refresh", params)
29
- convert_to_bridge_object(data)
57
+ data = api_client.post("/v2/items/#{id}/refresh", **params)
58
+ convert_to_bridge_object(**data)
30
59
  end
31
60
  end
32
61
 
62
+ #
63
+ # Request the refresh status of a specific item
64
+ #
65
+ # @param [Integer] id the id of the requested resource
66
+ # @param [String] access_token the access token provided during the user authentication
67
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
68
+ #
69
+ # @return [BridgeObject] the user item refresh status
70
+ #
33
71
  def refresh_status(id:, access_token:, **params)
34
72
  protected_resource(access_token) do
35
- data = api_client.get("/v2/items/#{id}/refresh/status", params)
36
- convert_to_bridge_object(data)
73
+ data = api_client.get("/v2/items/#{id}/refresh/status", **params)
74
+ convert_to_bridge_object(**data)
37
75
  end
38
76
  end
39
77
 
78
+ #
79
+ # Delete a specific item
80
+ #
81
+ # @param [Integer] id the id of the requested resource
82
+ # @param [String] access_token the access token provided during the user authentication
83
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
84
+ #
85
+ # @return [Boolean] the request success status
86
+ #
40
87
  def delete(id:, access_token:, **params)
41
88
  protected_resource(access_token) do
42
- data = api_client.delete("/v2/items/#{id}", params)
43
- convert_to_bridge_object(data)
89
+ api_client.delete("/v2/items/#{id}", **params)
90
+ true
44
91
  end
45
92
  end
46
93
  end
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # Supported resources types
6
+ #
4
7
  module ObjectTypes
8
+ #
9
+ # Matches API resources with corresponding gem classes
10
+ #
11
+ # @return [Account, Bank, Category, Item, Stock, Transaction, Transfer, User, nil] the matched resource or nil
12
+ #
5
13
  def self.resource_types_to_classes
6
14
  {
7
15
  Account::RESOURCE_TYPE => Account,
@@ -1,25 +1,59 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # Stock resource
6
+ #
4
7
  class Stock < BridgeObject
5
8
  RESOURCE_TYPE = "stock"
6
9
 
7
10
  class << self
8
11
  include API::Resource
9
12
 
10
- def list(**params)
11
- data = api_client.get("/v2/stocks", params)
12
- convert_to_bridge_object(data)
13
+ #
14
+ # List all logged in user stocks
15
+ #
16
+ # @param [String] access_token the access token provided during the user authentication
17
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
18
+ #
19
+ # @return [Array<Stock>] the user accounts
20
+ #
21
+ def list(access_token:, **params)
22
+ protected_resource(access_token) do
23
+ data = api_client.get("/v2/stocks", **params)
24
+ convert_to_bridge_object(**data)
25
+ end
13
26
  end
14
27
 
15
- def list_updated(**params)
16
- data = api_client.get("/v2/stocks/updated", params)
17
- convert_to_bridge_object(data)
28
+ #
29
+ # List all logged in user updated stocks
30
+ #
31
+ # @param [String] access_token the access token provided during the user authentication
32
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
33
+ #
34
+ # @return [Array<Stock>] the user accounts
35
+ #
36
+ def list_updated(access_token:, **params)
37
+ protected_resource(access_token) do
38
+ data = api_client.get("/v2/stocks/updated", **params)
39
+ convert_to_bridge_object(**data)
40
+ end
18
41
  end
19
42
 
20
- def find(id:, **params)
21
- data = api_client.get("/v2/stocks/#{id}", params)
22
- convert_to_bridge_object(data)
43
+ #
44
+ # Retrieve a single stock for logged in user
45
+ #
46
+ # @param [Integer] id the id of the requested resource
47
+ # @param [String] access_token the access token provided during the user authentication
48
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
49
+ #
50
+ # @return [Account] the user accounts
51
+ #
52
+ def find(id:, access_token:, **params)
53
+ protected_resource(access_token) do
54
+ data = api_client.get("/v2/stocks/#{id}", **params)
55
+ convert_to_bridge_object(**data)
56
+ end
23
57
  end
24
58
  end
25
59
  end
@@ -1,51 +1,103 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # Transaction resource
6
+ #
4
7
  class Transaction < BridgeObject
5
8
  RESOURCE_TYPE = "transaction"
6
9
 
7
10
  class << self
8
11
  include API::Resource
9
12
 
13
+ #
14
+ # List all logged in user transactions
15
+ #
16
+ # @param [String] access_token the access token provided during the user authentication
17
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
18
+ #
19
+ # @return [Array<Transaction>] the user transactions
20
+ #
10
21
  def list(access_token:, **params)
11
22
  protected_resource(access_token) do
12
- data = api_client.get("/v2/transactions", params)
13
- convert_to_bridge_object(data)
23
+ data = api_client.get("/v2/transactions", **params)
24
+ convert_to_bridge_object(**data)
14
25
  end
15
26
  end
16
27
 
28
+ #
29
+ # List all logged in user updated transactions
30
+ #
31
+ # @param [String] access_token the access token provided during the user authentication
32
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
33
+ #
34
+ # @return [Array<Transaction>] the user accounts
35
+ #
17
36
  def list_updated(access_token:, **params)
18
37
  protected_resource(access_token) do
19
- data = api_client.get("/v2/transactions/updated", params)
20
- convert_to_bridge_object(data)
38
+ data = api_client.get("/v2/transactions/updated", **params)
39
+ convert_to_bridge_object(**data)
21
40
  end
22
41
  end
23
42
 
43
+ #
44
+ # Retrieve a single transaction for logged in user
45
+ #
46
+ # @param [Integer] id the id of the requested resource
47
+ # @param [String] access_token the access token provided during the user authentication
48
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
49
+ #
50
+ # @return [Transaction] the user accounts
51
+ #
24
52
  def find(id:, access_token:, **params)
25
53
  protected_resource(access_token) do
26
- data = api_client.get("/v2/transactions/#{id}", params)
27
- convert_to_bridge_object(data)
54
+ data = api_client.get("/v2/transactions/#{id}", **params)
55
+ convert_to_bridge_object(**data)
28
56
  end
29
57
  end
30
58
 
59
+ #
60
+ # List all logged in user transactions for a specific account
61
+ #
62
+ # @param [String] access_token the access token provided during the user authentication
63
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
64
+ #
65
+ # @return [Array<Transaction>] the user accounts
66
+ #
31
67
  def list_by_account(account_id:, access_token:, **params)
32
68
  protected_resource(access_token) do
33
- data = api_client.get("/v2/accounts/#{account_id}/transactions", params)
34
- convert_to_bridge_object(data)
69
+ data = api_client.get("/v2/accounts/#{account_id}/transactions", **params)
70
+ convert_to_bridge_object(**data)
35
71
  end
36
72
  end
37
73
 
74
+ #
75
+ # List all logged in user updated transactions for a specific account
76
+ #
77
+ # @param [String] access_token the access token provided during the user authentication
78
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
79
+ #
80
+ # @return [Array<Transaction>] the user accounts
81
+ #
38
82
  def list_updated_by_account(account_id:, access_token:, **params)
39
83
  protected_resource(access_token) do
40
- data = api_client.get("/v2/accounts/#{account_id}/transactions/updated", params)
41
- convert_to_bridge_object(data)
84
+ data = api_client.get("/v2/accounts/#{account_id}/transactions/updated", **params)
85
+ convert_to_bridge_object(**data)
42
86
  end
43
87
  end
44
88
 
89
+ #
90
+ # List all logged in user transactions with a specific IBAN
91
+ #
92
+ # @param [String] access_token the access token provided during the user authentication
93
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
94
+ #
95
+ # @return [Array<Transaction>] the user accounts
96
+ #
45
97
  def list_by_iban(access_token:, **params)
46
98
  protected_resource(access_token) do
47
- data = api_client.post("/v2/transactions/search", params)
48
- convert_to_bridge_object(data)
99
+ data = api_client.post("/v2/transactions/search", **params)
100
+ convert_to_bridge_object(**data)
49
101
  end
50
102
  end
51
103
  end
@@ -1,51 +1,104 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # Transfer resource
6
+ #
4
7
  class Transfer < BridgeObject
5
8
  RESOURCE_TYPE = "transfert"
6
9
 
7
10
  class << self
8
11
  include API::Resource
9
12
 
13
+ #
14
+ # Request the URL to Bridge's Pay funnel to make a transfer
15
+ #
16
+ # @param [String] access_token the access token provided during the user authentication
17
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
18
+ #
19
+ # @return [BridgeObject] the URL to Bridge's Pay funnel
20
+ #
10
21
  def send(access_token:, **params)
11
22
  protected_resource(access_token) do
12
- data = api_client.post("/v2/pay/transfer/url", params)
13
- convert_to_bridge_object(data)
23
+ data = api_client.post("/v2/pay/transfer/url", **params)
24
+ convert_to_bridge_object(**data)
14
25
  end
15
26
  end
16
27
 
28
+ #
29
+ # List all logged in user transfers
30
+ #
31
+ # @param [String] access_token the access token provided during the user authentication
32
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
33
+ #
34
+ # @return [Array<Transfer>] the user's transfers
35
+ #
17
36
  def list(access_token:, **params)
18
37
  protected_resource(access_token) do
19
- data = api_client.get("/v2/transfers", params)
20
- convert_to_bridge_object(data)
38
+ data = api_client.get("/v2/transfers", **params)
39
+ convert_to_bridge_object(**data)
21
40
  end
22
41
  end
23
42
 
43
+ #
44
+ # Retrieve a single transfer for the logged in user
45
+ #
46
+ # @param [UUID] uuid the uuid of the requested resource
47
+ # @param [String] access_token the access token provided during the user authentication
48
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
49
+ #
50
+ # @return [Transfer] the requested transfer
51
+ #
24
52
  def find(uuid:, access_token:, **params)
25
53
  protected_resource(access_token) do
26
- data = api_client.get("/v2/transfers/#{uuid}", params)
27
- convert_to_bridge_object(data)
54
+ data = api_client.get("/v2/transfers/#{uuid}", **params)
55
+ convert_to_bridge_object(**data)
28
56
  end
29
57
  end
30
58
 
59
+ #
60
+ # List all sender transfer accounts
61
+ #
62
+ # @param [String] access_token the access token provided during the user authentication
63
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
64
+ #
65
+ # @return [Array<BridgeObject>] the user accounts
66
+ #
31
67
  def list_all_sender_accounts(access_token:, **params)
32
68
  protected_resource(access_token) do
33
- data = api_client.get("/v2/transfers/accounts/senders", params)
34
- convert_to_bridge_object(data)
69
+ data = api_client.get("/v2/transfers/accounts/senders", **params)
70
+ convert_to_bridge_object(**data)
35
71
  end
36
72
  end
37
73
 
74
+ #
75
+ # List all receiver transfer accounts
76
+ #
77
+ # @param [String] access_token the access token provided during the user authentication
78
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
79
+ #
80
+ # @return [Array<BridgeObject>] the user accounts
81
+ #
38
82
  def list_all_receiver_accounts(access_token:, **params)
39
83
  protected_resource(access_token) do
40
- data = api_client.get("/v2/transfers/accounts/receivers", params)
41
- convert_to_bridge_object(data)
84
+ data = api_client.get("/v2/transfers/accounts/receivers", **params)
85
+ convert_to_bridge_object(**data)
42
86
  end
43
87
  end
44
88
 
89
+ #
90
+ # List all receiver transfer accounts for a specific sender account
91
+ #
92
+ # @param [Integer] sender_account_id the sender_account_id of the requested resource
93
+ # @param [String] access_token the access token provided during the user authentication
94
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
95
+ #
96
+ # @return [Array<BridgeObject>] the user accounts
97
+ #
45
98
  def list_receiver_accounts_for_sender(sender_account_id:, access_token:, **params)
46
99
  protected_resource(access_token) do
47
- data = api_client.get("/v2/transfers/accounts/#{sender_account_id}/receivers", params)
48
- convert_to_bridge_object(data)
100
+ data = api_client.get("/v2/transfers/accounts/#{sender_account_id}/receivers", **params)
101
+ convert_to_bridge_object(**data)
49
102
  end
50
103
  end
51
104
  end
@@ -1,58 +1,130 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgeBankin
4
+ #
5
+ # User resource
6
+ #
4
7
  class User < BridgeObject
5
8
  RESOURCE_TYPE = "user"
6
9
 
7
10
  class << self
8
11
  include API::Resource
9
12
 
13
+ #
14
+ # List all registered users
15
+ #
16
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
17
+ #
18
+ # @return [Array<User>] the registered users list
19
+ #
10
20
  def list(**params)
11
- data = api_client.get("/v2/users", params)
12
- convert_to_bridge_object(data)
21
+ data = api_client.get("/v2/users", **params)
22
+ convert_to_bridge_object(**data)
13
23
  end
14
24
 
25
+ #
26
+ # Retrieve a specific user
27
+ #
28
+ # @param [UUID] uuid the uuid of the requested resource
29
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
30
+ #
31
+ # @return [User] the requested user
32
+ #
15
33
  def find(uuid:, **params)
16
- data = api_client.get("/v2/users/#{uuid}", params)
17
- convert_to_bridge_object(data)
34
+ data = api_client.get("/v2/users/#{uuid}", **params)
35
+ convert_to_bridge_object(**data)
18
36
  end
19
37
 
38
+ #
39
+ # Create a new user
40
+ #
41
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
42
+ #
43
+ # @return [User] the newly created user
44
+ #
20
45
  def create(**params)
21
- data = api_client.post("/v2/users", params)
22
- convert_to_bridge_object(data)
46
+ data = api_client.post("/v2/users", **params)
47
+ convert_to_bridge_object(**data)
23
48
  end
24
49
 
50
+ #
51
+ # Update user email
52
+ #
53
+ # @param [UUID] uuid the uuid of the requested resource
54
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
55
+ #
56
+ # @return [User] the updated user
57
+ #
25
58
  def update_email(uuid:, **params)
26
- data = api_client.put("/v2/users/#{uuid}/email", params)
27
- convert_to_bridge_object(data)
59
+ data = api_client.put("/v2/users/#{uuid}/email", **params)
60
+ convert_to_bridge_object(**data)
28
61
  end
29
62
 
63
+ #
64
+ # Update user password
65
+ #
66
+ # @param [UUID] uuid the uuid of the requested resource
67
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
68
+ #
69
+ # @return [User] the updated user
70
+ #
30
71
  def update_password(uuid:, **params)
31
- data = api_client.put("/v2/users/#{uuid}/password", params)
32
- convert_to_bridge_object(data)
72
+ data = api_client.put("/v2/users/#{uuid}/password", **params)
73
+ convert_to_bridge_object(**data)
33
74
  end
34
75
 
76
+ #
77
+ # Delete a specific user
78
+ #
79
+ # @param [UUID] uuid the uuid of the requested resource
80
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
81
+ #
82
+ # @return [Boolean] the request success status
83
+ #
35
84
  def delete_user(uuid:, **params)
36
- data = api_client.delete("/v2/users/#{uuid}", params)
37
- convert_to_bridge_object(data)
85
+ api_client.delete("/v2/users/#{uuid}", **params)
86
+ true
38
87
  end
39
88
 
89
+ #
90
+ # Delete all registered users
91
+ #
92
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
93
+ #
94
+ # @return [Boolean] the request success status
95
+ #
40
96
  def delete_all_users(**params)
41
- data = api_client.delete("/v2/users", params)
42
- convert_to_bridge_object(data)
97
+ api_client.delete("/v2/users", **params)
98
+ true
43
99
  end
44
100
 
101
+ #
102
+ # Check the logged in user email confirmation status
103
+ #
104
+ # @param [String] access_token the access token provided during the user authentication
105
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
106
+ #
107
+ # @return [BridgeObject] the user email confirmation status
108
+ #
45
109
  def check_email_confirmation(access_token:, **params)
46
110
  protected_resource(access_token) do
47
- data = api_client.get("/v2/users/me/email/confirmation", params)
48
- convert_to_bridge_object(data)
111
+ data = api_client.get("/v2/users/me/email/confirmation", **params)
112
+ convert_to_bridge_object(**data)
49
113
  end
50
114
  end
51
115
 
116
+ #
117
+ # Request the URL to access to an interface to manage the logged in user accounts' IBAN
118
+ #
119
+ # @param [String] access_token the access token provided during the user authentication
120
+ # @param [Hash] params any params that might be required (or optional) to communicate with the API
121
+ #
122
+ # @return [BridgeObject] an URL to access to the interface to manage accounts' IBAN
123
+ #
52
124
  def manage_accounts(access_token:, **params)
53
125
  protected_resource(access_token) do
54
- data = api_client.get("/v2/users/manage/accounts/iban", params)
55
- convert_to_bridge_object(data)
126
+ data = api_client.get("/v2/users/manage/accounts/iban", **params)
127
+ convert_to_bridge_object(**data)
56
128
  end
57
129
  end
58
130
  end