creditario-client 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +14 -0
- data/.gitlab-ci.yml +23 -0
- data/.rubocop.yml +155 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Dockerfile +3 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +241 -0
- data/Rakefile +21 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/creditario-client.gemspec +35 -0
- data/lib/creditario/api/create.rb +29 -0
- data/lib/creditario/api/delete.rb +25 -0
- data/lib/creditario/api/list.rb +27 -0
- data/lib/creditario/api/multipart.rb +29 -0
- data/lib/creditario/api/request.rb +101 -0
- data/lib/creditario/api/retrieve.rb +32 -0
- data/lib/creditario/api/update.rb +32 -0
- data/lib/creditario/client.rb +183 -0
- data/lib/creditario/client/railtie.rb +14 -0
- data/lib/creditario/client/version.rb +9 -0
- data/lib/creditario/exceptions.rb +121 -0
- data/lib/creditario/repositories/applications.rb +50 -0
- data/lib/creditario/repositories/attachments.rb +50 -0
- data/lib/creditario/repositories/catalogs.rb +59 -0
- data/lib/creditario/repositories/contracts.rb +29 -0
- data/lib/creditario/repositories/credit_estimates.rb +29 -0
- data/lib/creditario/repositories/credits.rb +35 -0
- data/lib/creditario/repositories/customers.rb +50 -0
- data/lib/creditario/repositories/expenses.rb +41 -0
- data/lib/creditario/repositories/incomes.rb +41 -0
- data/lib/creditario/repositories/payments.rb +34 -0
- data/lib/creditario/repositories/products.rb +38 -0
- data/lib/creditario/repositories/references.rb +41 -0
- data/lib/creditario/resources/application.rb +27 -0
- data/lib/creditario/resources/attachment.rb +19 -0
- data/lib/creditario/resources/catalog.rb +35 -0
- data/lib/creditario/resources/contract.rb +21 -0
- data/lib/creditario/resources/credit.rb +19 -0
- data/lib/creditario/resources/credit_estimate.rb +19 -0
- data/lib/creditario/resources/customer.rb +25 -0
- data/lib/creditario/resources/expense.rb +19 -0
- data/lib/creditario/resources/income.rb +19 -0
- data/lib/creditario/resources/payment.rb +21 -0
- data/lib/creditario/resources/product.rb +21 -0
- data/lib/creditario/resources/reference.rb +19 -0
- data/lib/creditario/resources/resource.rb +96 -0
- data/lib/creditario/utils/paginated_collection.rb +45 -0
- data/lib/creditario/utils/resources_collection.rb +35 -0
- data/lib/generators/creditario/USAGE +13 -0
- data/lib/generators/creditario/install_generator.rb +17 -0
- data/lib/generators/creditario/templates/creditario.yml +12 -0
- data/lib/generators/creditario/templates/initializer.rb +4 -0
- data/rakelib/fixture_api_response.rake +10 -0
- data/rakelib/fixture_api_response.rb +114 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e3f134863c3b8a41b1aa6a04ab85ecdea2f8351a
|
4
|
+
data.tar.gz: 3ad89b47f7616b79e9a9749b9e14fbffdd95f234
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36fcf9b0ff2df07227c8e2f36990be0bc4ac065395694cb3b288fca90434826c016a9ad7c9419f63cb7913600c8e5b44a29484ccdb793ae6f36fe9e3b8146430
|
7
|
+
data.tar.gz: 478866bd223b0f8b66f780574a11d152bfc166c0f207c2effa0ac30312aed4ad7a0db309d743ef352f88a6d31a150bcc956fe9266ac76ec35dfc46e7385d93c9
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
image: registry.michelada.io/financial/creditario-client/ci
|
2
|
+
|
3
|
+
cache:
|
4
|
+
key: ${CI_COMMIT_REF_SLUG}
|
5
|
+
paths:
|
6
|
+
- vendor/ruby
|
7
|
+
|
8
|
+
before_script:
|
9
|
+
- gem install bundler
|
10
|
+
- bundle install -j $(nproc) --path vendor
|
11
|
+
|
12
|
+
# the 'pages' job will deploy and build your site to the 'public' path
|
13
|
+
pages:
|
14
|
+
stage: deploy
|
15
|
+
script:
|
16
|
+
- bundle exec sdoc . -T rails --exclude="vendor/|test/"
|
17
|
+
- mv doc public
|
18
|
+
artifacts:
|
19
|
+
paths:
|
20
|
+
- public
|
21
|
+
only:
|
22
|
+
- master # this job will affect only the 'master' branch
|
23
|
+
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
4
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
5
|
+
DisabledByDefault: true
|
6
|
+
|
7
|
+
# Prefer &&/|| over and/or.
|
8
|
+
Style/AndOr:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# Do not use braces for hash literals when they are the last argument of a
|
12
|
+
# method call.
|
13
|
+
Style/BracesAroundHashParameters:
|
14
|
+
Enabled: true
|
15
|
+
EnforcedStyle: context_dependent
|
16
|
+
|
17
|
+
# Align `when` with `case`.
|
18
|
+
Layout/CaseIndentation:
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
# Align comments with method definitions.
|
22
|
+
Layout/CommentIndentation:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
Layout/ElseAlignment:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# Align `end` with the matching keyword or starting expression except for
|
29
|
+
# assignments, where it should be aligned with the LHS.
|
30
|
+
Layout/EndAlignment:
|
31
|
+
Enabled: true
|
32
|
+
EnforcedStyleAlignWith: variable
|
33
|
+
AutoCorrect: true
|
34
|
+
|
35
|
+
Layout/EmptyLineAfterMagicComment:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# In a regular class definition, no empty lines around the body.
|
39
|
+
Layout/EmptyLinesAroundClassBody:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
# In a regular method definition, no empty lines around the body.
|
43
|
+
Layout/EmptyLinesAroundMethodBody:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# In a regular module definition, no empty lines around the body.
|
47
|
+
Layout/EmptyLinesAroundModuleBody:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Layout/FirstParameterIndentation:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
54
|
+
Style/HashSyntax:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
58
|
+
# extra level of indentation.
|
59
|
+
Layout/IndentationConsistency:
|
60
|
+
Enabled: true
|
61
|
+
EnforcedStyle: rails
|
62
|
+
|
63
|
+
# Two spaces, no tabs (for indentation).
|
64
|
+
Layout/IndentationWidth:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Layout/LeadingCommentSpace:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Layout/SpaceAfterColon:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Layout/SpaceAfterComma:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
Layout/SpaceAroundKeyword:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Layout/SpaceAroundOperators:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
Layout/SpaceBeforeComma:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
Layout/SpaceBeforeFirstArg:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Style/DefWithParentheses:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
# Defining a method with parameters needs parentheses.
|
95
|
+
Style/MethodDefParentheses:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Style/FrozenStringLiteralComment:
|
99
|
+
Enabled: true
|
100
|
+
EnforcedStyle: always
|
101
|
+
|
102
|
+
# Use `foo {}` not `foo{}`.
|
103
|
+
Layout/SpaceBeforeBlockBraces:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
# Use `foo { bar }` not `foo {bar}`.
|
107
|
+
Layout/SpaceInsideBlockBraces:
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
111
|
+
Layout/SpaceInsideHashLiteralBraces:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Layout/SpaceInsideParens:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
# Check quotes usage according to lint rule below.
|
118
|
+
Style/StringLiterals:
|
119
|
+
Enabled: true
|
120
|
+
EnforcedStyle: double_quotes
|
121
|
+
|
122
|
+
# Detect hard tabs, no hard tabs.
|
123
|
+
Layout/Tab:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
# Blank lines should not have any spaces.
|
127
|
+
Layout/TrailingBlankLines:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
# No trailing whitespace.
|
131
|
+
Layout/TrailingWhitespace:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
# Use quotes for string literals when they are enough.
|
135
|
+
Style/UnneededPercentQ:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
139
|
+
Lint/RequireParentheses:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
Lint/StringConversionInInterpolation:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
Style/RedundantReturn:
|
146
|
+
Enabled: true
|
147
|
+
AllowMultipleReturnValues: true
|
148
|
+
|
149
|
+
Style/Semicolon:
|
150
|
+
Enabled: true
|
151
|
+
AllowAsExpressionSeparator: true
|
152
|
+
|
153
|
+
# Prefer Foo.method over Foo::method
|
154
|
+
Style/ColonMethodCall:
|
155
|
+
Enabled: true
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at eduardofigarola@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 michelada.io
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
# Creditario::Client
|
2
|
+
|
3
|
+
## Instalación
|
4
|
+
|
5
|
+
Solo añade a tu Gemfile:
|
6
|
+
|
7
|
+
gem "creditario-client", git: "git@git.michelada.io:financial/creditario-client.git"
|
8
|
+
|
9
|
+
## Uso
|
10
|
+
|
11
|
+
### Ruby on Rails
|
12
|
+
|
13
|
+
#### 5.2+
|
14
|
+
|
15
|
+
Si utilizas Ruby on Rails en su versión 5.2, hay 2 cosas que debes hacer, la primera es:
|
16
|
+
|
17
|
+
$ bundle exec rails g creditario:install
|
18
|
+
|
19
|
+
Y la segunda es editar tu archivo de credenciales, para añadir el *api_key* de tu Organización:
|
20
|
+
|
21
|
+
$ EDITOR=vim bundle exec rails credentials:edit
|
22
|
+
|
23
|
+
Dentro de tu archivo de credenciales, debes agregar lo siguiente:
|
24
|
+
|
25
|
+
creditario:
|
26
|
+
development:
|
27
|
+
api_key: BMBE96Wva8NaYMmVx4RavpXSy6Y6HKFe
|
28
|
+
production:
|
29
|
+
api_key: v48mbFLupTLWGvYnLVjDqaeEUJEYHmAM # Your production api_key
|
30
|
+
|
31
|
+
¡Listo! Ya tienes el cliente para la API de creditar.io totalmente configurado.
|
32
|
+
|
33
|
+
#### \< 5.2
|
34
|
+
|
35
|
+
En caso de que tu aplicación de Rails no utilice el archivo de credenciales, tal vez prefieras
|
36
|
+
utilizar **variables de entorno** para configurar el `api_key` y el `api_base` del cliente para
|
37
|
+
la API de creditar.io
|
38
|
+
|
39
|
+
Todo lo que tienes que hacer es ejecutar:
|
40
|
+
|
41
|
+
$ bundle exec rails g creditario:install
|
42
|
+
|
43
|
+
Y actualizar el archivo `config/creditario.yml` que fue generado previamente:
|
44
|
+
|
45
|
+
default: &default
|
46
|
+
api_base: <%= ENV["CREDITARIO_API_URL"] || "http://localhost:3000" %>
|
47
|
+
api_key: <%= ENV["CREDITARIO_API_KEY"] %>
|
48
|
+
|
49
|
+
Listo, ahora solamente deberás inicializar las variables de entorno para que el cliente sea configurado correctamente.
|
50
|
+
|
51
|
+
### Fuera de Rails
|
52
|
+
|
53
|
+
Si deseas usar la gema fuera de una aplicación de Rails. Justo después de requerirla en tu código debes configurar la `api_key` y la `api_base` a utilizar.
|
54
|
+
|
55
|
+
Esto lo puedes lograr con lo siguiente:
|
56
|
+
|
57
|
+
Creditario::Client.api_key = "BMBE96Wva8NaYMmVx4RavpXSy6Y6HKFe"
|
58
|
+
Creditario::Client.api_base = "http://localhost:3000"
|
59
|
+
|
60
|
+
## Desarrollo
|
61
|
+
|
62
|
+
Recuerda que si necesitas hacer pruebas, deberás tener la API de creditar.io corriendo en tu máquina local o conectarte a la URL de staging.
|
63
|
+
|
64
|
+
Si estás haciendo pruebas locales, puedes especificar la URL y el puerto, gracias a la variable de entorno llamada: `CREDITARIO_API_URL`, usala antes de iniciar tus pruebas/desarrollo, ejemplo:
|
65
|
+
|
66
|
+
$ CREDITARIO_API_URL=http://localhost:9000 bundle exec rails server
|
67
|
+
|
68
|
+
Por defecto, siempre intentará conectarse a `http://localhost:3000` si no se pasa la variable de entorno.
|
69
|
+
|
70
|
+
## Ejemplos
|
71
|
+
|
72
|
+
### Productos
|
73
|
+
|
74
|
+
Las operaciones que puedes realizar sobre Productos son: listar y obtener.
|
75
|
+
|
76
|
+
#### Listar todos los Productos activos
|
77
|
+
|
78
|
+
result = Creditario::Products.list
|
79
|
+
=> Creditario::PaginatedCollection
|
80
|
+
|
81
|
+
result.items
|
82
|
+
=> [Creditario::Product, Creditario::Product, ...]
|
83
|
+
|
84
|
+
#### Obtener un Producto
|
85
|
+
|
86
|
+
Creditario::Products.retrieve("c005b7f7-a44a-4ec0-bf7f-73d15d806fd9")
|
87
|
+
=> Creditario::Product
|
88
|
+
|
89
|
+
### Clientes
|
90
|
+
|
91
|
+
Las operaciones que puedes realizar sobre Clientes son: listar, obtener, crear y actualizar.
|
92
|
+
|
93
|
+
#### Listar todos los Clientes
|
94
|
+
|
95
|
+
result = Creditario::Customers.list
|
96
|
+
=> Creditario::PaginatedCollection
|
97
|
+
|
98
|
+
result.items
|
99
|
+
=> [Creditario::Customer, Creditario::Customer, ...]
|
100
|
+
|
101
|
+
#### Obtener un Cliente
|
102
|
+
|
103
|
+
Creditario::Customers.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
104
|
+
=> Creditario::Customer
|
105
|
+
|
106
|
+
#### Crear un Cliente
|
107
|
+
|
108
|
+
result = Creditario::Customers.create(email: "karla@quieredinero.com", product_id: "c005b7f7-a44a-4ec0-bf7f-73d15d806fd9")
|
109
|
+
=> Creditario::Customer
|
110
|
+
|
111
|
+
#### Actualizar un Cliente
|
112
|
+
|
113
|
+
result = Creditario::Customers.update("2e9d05b8-2180-4779-bab6-bdfd41d1569f", { email: "karina@necesitadinero.com" })
|
114
|
+
=> Creditario::Customer
|
115
|
+
|
116
|
+
### Solicitudes
|
117
|
+
|
118
|
+
Las operaciones que puedes realizar sobre Solicitudes son: listar, obtener, crear y actualizar.
|
119
|
+
|
120
|
+
#### Listar todas las Solicitudes
|
121
|
+
|
122
|
+
result = Creditario::Applications.list
|
123
|
+
=> Creditario::PaginatedCollection
|
124
|
+
|
125
|
+
result.items
|
126
|
+
=> [Creditario::Application, Creditario::Application, ...]
|
127
|
+
|
128
|
+
#### Obtener una Solicitud
|
129
|
+
|
130
|
+
Creditario::Applications.retrieve("0b19e3b6-9fae-40e1-a7c2-f2db1cae8a5a")
|
131
|
+
=> Creditario::Application
|
132
|
+
|
133
|
+
#### Crear una Solicitud
|
134
|
+
|
135
|
+
result = Creditario::Applications.create(customer_id: "2e9d05b8-2180-4779-bab6-bdfd41d1569f", product_id: "c005b7f7-a44a-4ec0-bf7f-73d15d806fd9")
|
136
|
+
=> Creditario::Application
|
137
|
+
|
138
|
+
#### Actualizar una Solicitud
|
139
|
+
|
140
|
+
result = Creditario::Applications.update("c0324939-0802-41b2-b81e-04e8982270ec", { street: "Avenida Siempre Viva", exterior_number: "742" })
|
141
|
+
=> Creditario::Application
|
142
|
+
|
143
|
+
### Ingresos
|
144
|
+
|
145
|
+
Las operaciones que puedes realizar sobre Ingresos son: obtener, crear y eliminar.
|
146
|
+
|
147
|
+
#### Obtener un Ingreso
|
148
|
+
|
149
|
+
Creditario::Incomes.retrieve("0b19e3b6-9fae-40e1-a7c2-f2db1cae8a5a")
|
150
|
+
=> Creditario::Income
|
151
|
+
|
152
|
+
#### Crear un Ingreso
|
153
|
+
|
154
|
+
result = Creditario::Incomes.create(classification: "Trabajo", amount_cents: 45000, credit_application_id: "636264b1-77a2-45ef-b643-e44cfbc84d40")
|
155
|
+
=> Creditario::Income
|
156
|
+
|
157
|
+
#### Eliminar un Ingreso
|
158
|
+
|
159
|
+
result = Creditario::Incomes.delete("0b19e3b6-9fae-40e1-a7c2-f2db1cae8a5a")
|
160
|
+
=> true
|
161
|
+
|
162
|
+
### Egresos
|
163
|
+
|
164
|
+
Las operaciones que puedes realizar sobre Egresos son: obtener, crear y eliminar.
|
165
|
+
|
166
|
+
#### Obtener un Egreso
|
167
|
+
|
168
|
+
Creditario::Expenses.retrieve("eeedba2e-fc96-4f96-bd2e-bd046b256f96")
|
169
|
+
=> Creditario::Expense
|
170
|
+
|
171
|
+
#### Crear un Egreso
|
172
|
+
|
173
|
+
result = Creditario::Expenses.create(classification: "Renta", amount_cents: 25000, credit_application_id: "636264b1-77a2-45ef-b643-e44cfbc84d40")
|
174
|
+
=> Creditario::Expense
|
175
|
+
|
176
|
+
#### Eliminar un Egreso
|
177
|
+
|
178
|
+
result = Creditario::Expenses.delete("eeedba2e-fc96-4f96-bd2e-bd046b256f96")
|
179
|
+
=> true
|
180
|
+
|
181
|
+
### Referencias
|
182
|
+
|
183
|
+
Las operaciones que puedes realizar sobre Referencias son: obtener, crear y eliminar.
|
184
|
+
|
185
|
+
#### Obtener una Referencia
|
186
|
+
|
187
|
+
Creditario::References.retrieve("0b19e3b6-9fae-40e1-a7c2-f2db1cae8a5a")
|
188
|
+
=> Creditario::Reference
|
189
|
+
|
190
|
+
#### Crear una Referencia
|
191
|
+
|
192
|
+
result = Creditario::References.create(classification: "Amistad", name: "Diane Nguyen", phone: "3129743789", credit_application_id: "636264b1-77a2-45ef-b643-e44cfbc84d40")
|
193
|
+
=> Creditario::Reference
|
194
|
+
|
195
|
+
#### Eliminar una Referencia
|
196
|
+
|
197
|
+
result = Creditario::References.delete("0b19e3b6-9fae-40e1-a7c2-f2db1cae8a5a")
|
198
|
+
=> true
|
199
|
+
|
200
|
+
### Catálogos
|
201
|
+
|
202
|
+
Las operaciones que puedes realizar sobre Catálogos son: listar y obtener.
|
203
|
+
|
204
|
+
#### Listar Catálogos disponibles
|
205
|
+
|
206
|
+
result = Creditario::Catalogs.list
|
207
|
+
=> Creditario::ResourcesCollection
|
208
|
+
|
209
|
+
result.items
|
210
|
+
=> [Creditario::Catalog, Creditario::Catalog, ...]
|
211
|
+
|
212
|
+
#### Obtener valores de un Catálogo
|
213
|
+
|
214
|
+
Creditario::Catalog.retrieve(resource: "customer", field: "source")
|
215
|
+
=> Creditario::ResourcesCollection
|
216
|
+
|
217
|
+
### Estimaciones de Crédito
|
218
|
+
|
219
|
+
La operación que puedes realizar sobre Estimaciones de Crédito es: obtener.
|
220
|
+
|
221
|
+
#### Obtener una Estimación de Crédito
|
222
|
+
|
223
|
+
result = Creditario::CreditEstimates.retrieve(nil, product_id: "c005b7f7-a44a-4ec0-bf7f-73d15d806fd9", amount_cents: "5000000", installments_number: "12")
|
224
|
+
=> Creditario::CreditEstimate
|
225
|
+
|
226
|
+
### Créditos
|
227
|
+
|
228
|
+
Las operaciones que puedes realizar sobre Créditos son: listar y obtener.
|
229
|
+
|
230
|
+
#### Listar Créditos de un Cliente
|
231
|
+
|
232
|
+
result = Creditario::Credits.list(customer_id: "f916636d-e045-43e4-898d-14e6dddf13f9")
|
233
|
+
=> Creditario::ResourcesCollection
|
234
|
+
|
235
|
+
result.items
|
236
|
+
=> [Creditario::Credit, Creditario::Credit, ...]
|
237
|
+
|
238
|
+
#### Obtener un Crédito
|
239
|
+
|
240
|
+
result = Creditario::Credits.retrieve("33ca13b7-9910-430c-b5d7-7ba12a9b18a5")
|
241
|
+
=> Creditario::Credit
|