Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Model base API improvements #5

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sardavend
Copy link
Contributor

@sardavend sardavend commented Jul 11, 2023

What does this PR do?

Improve the library interface to a new Resource/Model based API by leveraging the ruby meta-programming capabilities, this way we remove the hardcoded dependencies attributes of any Fintoc's resources and also abstract away the Client object to be implicitly called by the resources/models instead of using it directly by the library users

Details

Quick start usage with the current interface

client = Fintoc::Client.new('sk_test_9c8d8CeyBTx1VcJzuDgpm4H-bywJCeSx')
link = client.get_link('6n12zLmai3lLE9Dq_token_gvEJi8FrBge4fb3cz7Wp856W')
account = link.find(type: 'checking_account')

Quick start usage with the improved interface

Fintoc.api_key = 'sk_test_9c8d8CeyBTx1VcJzuDgpm4H-bywJCeSx'
link = Fintoc::Link.find('6n12zLmai3lLE9Dq_token_gvEJi8FrBge4fb3cz7Wp856W')
account = link.accounts.find(type: 'checking_account')

Get the las 30 movements with the current interface

movements = account.get_movements
movements = account.get_movements(since: '2020-08-15')

Get the las 30 movements with the improved interface

movements = account.movements
movements = account.movements(since: '2020-08-15')

@sardavend sardavend marked this pull request as draft July 11, 2023 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant