creditario-client 0.0.7.alpha → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +38 -0
- data/.gitignore +0 -1
- data/Gemfile.lock +64 -0
- data/README.md +7 -2
- data/creditario-client.gemspec +2 -0
- data/lib/creditario/api/create.rb +1 -1
- data/lib/creditario/api/exists.rb +31 -0
- data/lib/creditario/api/multipart.rb +1 -1
- data/lib/creditario/client/version.rb +1 -1
- data/lib/creditario/client.rb +3 -0
- data/lib/creditario/repositories/customers.rb +6 -0
- data/lib/creditario/repositories/investors.rb +45 -0
- data/lib/creditario/resources/investor.rb +7 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f41e9c8e79d01bc247e637f4b823859cc5382b2eb7b3dad905a575cb6a110101
|
4
|
+
data.tar.gz: 4ce09eb658e9c4e5dc0a77f95eb5b7dcb4a484c973dbb18b886766cb88285844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5dba2eb7858828e57765506245bf239ab61c9c86fa0e145f13ba66fac6dc11ff8e3db70f3317ab4f11d97b0503553eb1f813690fc08de742c77d53647ad577
|
7
|
+
data.tar.gz: 63d6c1e04f8c78c8525791318828a031362ee34fa3e3f7ca17ce373a8cb4f0bec8317440b6de2eaad87d0b1da09a16ba3602d0a5d146951eca3fd3b3edd6ca48
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: "Release"
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*.*.*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Release
|
11
|
+
runs-on: ubuntu-18.04
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
with:
|
15
|
+
fetch-depth: 3
|
16
|
+
|
17
|
+
- name: Set up Ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.7.2
|
21
|
+
bundler-cache: true
|
22
|
+
cache-version: 1
|
23
|
+
|
24
|
+
- name: Get tag version
|
25
|
+
id: tag_version
|
26
|
+
run: |
|
27
|
+
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
28
|
+
|
29
|
+
- name: Print tag version
|
30
|
+
run: echo ${{ steps.tag_version.outputs.VERSION }}
|
31
|
+
|
32
|
+
- name: Build gem
|
33
|
+
run: gem build creditario-client.gemspec
|
34
|
+
|
35
|
+
- name: Push gem
|
36
|
+
env:
|
37
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
38
|
+
run: gem push creditario-client-${{ steps.tag_version.outputs.VERSION}}.gem
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
creditario-client (1.0.0)
|
5
|
+
multipart-post (= 2.0.0)
|
6
|
+
oj (~> 3.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
ast (2.4.2)
|
14
|
+
crack (0.4.5)
|
15
|
+
rexml
|
16
|
+
hashdiff (1.0.1)
|
17
|
+
jaro_winkler (1.5.4)
|
18
|
+
minitest (5.15.0)
|
19
|
+
multipart-post (2.0.0)
|
20
|
+
oj (3.0.11)
|
21
|
+
parallel (1.21.0)
|
22
|
+
parser (3.1.0.0)
|
23
|
+
ast (~> 2.4.1)
|
24
|
+
powerpack (0.1.3)
|
25
|
+
psych (4.0.3)
|
26
|
+
stringio
|
27
|
+
public_suffix (4.0.6)
|
28
|
+
rainbow (3.1.1)
|
29
|
+
rake (10.5.0)
|
30
|
+
rdoc (6.4.0)
|
31
|
+
psych (>= 4.0.0)
|
32
|
+
rexml (3.2.5)
|
33
|
+
rubocop (0.57.2)
|
34
|
+
jaro_winkler (~> 1.5.1)
|
35
|
+
parallel (~> 1.10)
|
36
|
+
parser (>= 2.5)
|
37
|
+
powerpack (~> 0.1)
|
38
|
+
rainbow (>= 2.2.2, < 4.0)
|
39
|
+
ruby-progressbar (~> 1.7)
|
40
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
41
|
+
ruby-progressbar (1.11.0)
|
42
|
+
sdoc (1.1.0)
|
43
|
+
rdoc (>= 5.0)
|
44
|
+
stringio (3.0.1)
|
45
|
+
unicode-display_width (1.8.0)
|
46
|
+
webmock (3.4.2)
|
47
|
+
addressable (>= 2.3.6)
|
48
|
+
crack (>= 0.3.2)
|
49
|
+
hashdiff
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
ruby
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
bundler (~> 2.1.4)
|
56
|
+
creditario-client!
|
57
|
+
minitest (~> 5.0)
|
58
|
+
rake (~> 10.0)
|
59
|
+
rubocop (~> 0.57.2)
|
60
|
+
sdoc (~> 1.0)
|
61
|
+
webmock (~> 3.4.2)
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.2.16
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Solo añade a tu Gemfile:
|
6
6
|
|
7
|
-
gem "creditario-client", git: "git@
|
7
|
+
gem "creditario-client", git: "git@github.com:creditario/creditario-client.git"
|
8
8
|
|
9
9
|
## Uso
|
10
10
|
|
@@ -88,7 +88,7 @@ Las operaciones que puedes realizar sobre Productos son: listar y obtener.
|
|
88
88
|
|
89
89
|
### Clientes
|
90
90
|
|
91
|
-
Las operaciones que puedes realizar sobre Clientes son: listar, obtener, crear y actualizar.
|
91
|
+
Las operaciones que puedes realizar sobre Clientes son: listar, obtener, verificar, crear y actualizar.
|
92
92
|
|
93
93
|
#### Listar todos los Clientes
|
94
94
|
|
@@ -103,6 +103,11 @@ Las operaciones que puedes realizar sobre Clientes son: listar, obtener, crear y
|
|
103
103
|
Creditario::Customers.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
104
104
|
=> Creditario::Customer
|
105
105
|
|
106
|
+
#### Verificar un Cliente
|
107
|
+
|
108
|
+
Creditario::Customers.exists(email: "usuario@needsmoney.com")
|
109
|
+
=> Hash
|
110
|
+
|
106
111
|
#### Crear un Cliente
|
107
112
|
|
108
113
|
result = Creditario::Customers.create(email: "karla@quieredinero.com", product_id: "c005b7f7-a44a-4ec0-bf7f-73d15d806fd9")
|
data/creditario-client.gemspec
CHANGED
@@ -23,6 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
+
spec.required_ruby_version = ">= 2.7.0"
|
27
|
+
|
26
28
|
spec.add_dependency "oj", "~> 3.0.0"
|
27
29
|
spec.add_dependency "multipart-post", "2.0.0"
|
28
30
|
|
@@ -14,7 +14,7 @@ module Creditario # :nodoc:
|
|
14
14
|
# Si todo sale bien devuelve una instancia del Recurso específico que el
|
15
15
|
# Repositorio maneja.
|
16
16
|
# De lo contrario, regresa un Hash con los errores arrojados por el servidor de creditar.io
|
17
|
-
def create(
|
17
|
+
def create(*params)
|
18
18
|
response = API.request(:post, self.resource_path, params)
|
19
19
|
|
20
20
|
attributes = response.dig("data").first
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
module Creditario # :nodoc:
|
5
|
+
module API
|
6
|
+
###
|
7
|
+
# == Creditario::API::Exists
|
8
|
+
#
|
9
|
+
# Modulo encargado de obtener si un recurso existe en la API de creditar.io
|
10
|
+
module Exists
|
11
|
+
###
|
12
|
+
# Realiza una llamada GET al path del Repositorio que este haciendo uso
|
13
|
+
# de este modulo.
|
14
|
+
#
|
15
|
+
# Si todo sale bien devuelve una instancia del Recurso específico que el Repositorio maneja.
|
16
|
+
# De lo contrario, regresa un Hash con los errores arrojados por el servidor de creditar.io
|
17
|
+
def exists(query_params = {})
|
18
|
+
parts = [self.exists_resource_path]
|
19
|
+
path = parts.compact.join("/")
|
20
|
+
query_params[:cache] = true
|
21
|
+
query_params[:email] = Base64.encode64(query_params[:email])[0..-2]
|
22
|
+
response = API.request(:get, path, query_params)
|
23
|
+
|
24
|
+
rescue Creditario::Exceptions::ResourceNotFoundError => exception
|
25
|
+
exception.server_response
|
26
|
+
rescue Creditario::Exceptions::UnprocessableEntityError => exception
|
27
|
+
exception.server_response
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -14,7 +14,7 @@ module Creditario # :nodoc:
|
|
14
14
|
# Si todo sale bien devuelve una instancia del Recurso específico que el
|
15
15
|
# Repositorio maneja.
|
16
16
|
# De lo contrario, regresa un Hash con los errores arrojados por el servidor de creditar.io
|
17
|
-
def create(
|
17
|
+
def create(*params)
|
18
18
|
response = API.request(:multipart, self.resource_path, params)
|
19
19
|
|
20
20
|
attributes = response.dig("data").first
|
data/lib/creditario/client.rb
CHANGED
@@ -13,6 +13,7 @@ require "creditario/api/multipart"
|
|
13
13
|
require "creditario/api/delete"
|
14
14
|
require "creditario/api/list"
|
15
15
|
require "creditario/api/retrieve"
|
16
|
+
require "creditario/api/exists"
|
16
17
|
require "creditario/api/update"
|
17
18
|
|
18
19
|
require "creditario/utils/paginated_collection"
|
@@ -33,6 +34,7 @@ require "creditario/resources/credit"
|
|
33
34
|
require "creditario/resources/payment"
|
34
35
|
require "creditario/resources/movement"
|
35
36
|
require "creditario/resources/qualify_score_flow"
|
37
|
+
require "creditario/resources/investor"
|
36
38
|
|
37
39
|
require "creditario/repositories/applications"
|
38
40
|
require "creditario/repositories/customers"
|
@@ -49,6 +51,7 @@ require "creditario/repositories/payments"
|
|
49
51
|
require "creditario/repositories/movements"
|
50
52
|
require "creditario/repositories/qualify_score_flows"
|
51
53
|
require "creditario/repositories/convert_application_to_credits"
|
54
|
+
require "creditario/repositories/investors"
|
52
55
|
|
53
56
|
module Creditario # :nodoc:
|
54
57
|
###
|
@@ -32,6 +32,7 @@ module Creditario # :nodoc:
|
|
32
32
|
module Customers
|
33
33
|
extend Creditario::API::List
|
34
34
|
extend Creditario::API::Retrieve
|
35
|
+
extend Creditario::API::Exists
|
35
36
|
extend Creditario::API::Create
|
36
37
|
extend Creditario::API::Update
|
37
38
|
|
@@ -41,6 +42,11 @@ module Creditario # :nodoc:
|
|
41
42
|
"/customers"
|
42
43
|
end
|
43
44
|
|
45
|
+
# Path de la API donde se ejecutan las peticiones para Clientes, especificamente para existss.
|
46
|
+
def self.exists_resource_path
|
47
|
+
"/exists/customer"
|
48
|
+
end
|
49
|
+
|
44
50
|
###
|
45
51
|
# Clase a utilizar para transformar las respuestas de la API
|
46
52
|
def self.resource_class
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
###
|
5
|
+
# == Creditario::Investors
|
6
|
+
#
|
7
|
+
# Repositorio de Inversionistas, permite realizar las siguientes operaciones
|
8
|
+
# sobre Inversionistas de creditar.io
|
9
|
+
#
|
10
|
+
# - Obtener todos los Inversionistas:
|
11
|
+
#
|
12
|
+
# result = Creditario::Investors.list
|
13
|
+
# => Creditario::PaginatedCollection
|
14
|
+
#
|
15
|
+
# result.items
|
16
|
+
# => [Creditario::Investor, Creditario::Investor, ...]
|
17
|
+
#
|
18
|
+
# - Obtener un Inversionista en especifico:
|
19
|
+
#
|
20
|
+
# Creditario::Investors.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
21
|
+
# => Creditario::Investor
|
22
|
+
#
|
23
|
+
# - Crear un Inversionista:
|
24
|
+
#
|
25
|
+
# result = Creditario::Investors.create(email: "karla@quiereinvertir.com")
|
26
|
+
# => Creditario::Investor
|
27
|
+
#
|
28
|
+
module Investors
|
29
|
+
extend Creditario::API::List
|
30
|
+
extend Creditario::API::Retrieve
|
31
|
+
extend Creditario::API::Create
|
32
|
+
|
33
|
+
###
|
34
|
+
# Path de la API donde se ejecutan las peticiones para Inversionistas.
|
35
|
+
def self.resource_path
|
36
|
+
"/crowdfunding/investors"
|
37
|
+
end
|
38
|
+
|
39
|
+
###
|
40
|
+
# Clase a utilizar para transformar las respuestas de la API
|
41
|
+
def self.resource_class
|
42
|
+
Creditario::Investor
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creditario-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- michelada.io
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -130,6 +130,7 @@ extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- ".DS_Store"
|
133
|
+
- ".github/workflows/release.yml"
|
133
134
|
- ".gitignore"
|
134
135
|
- ".gitlab-ci.yml"
|
135
136
|
- ".rubocop.yml"
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- CODE_OF_CONDUCT.md
|
139
140
|
- Dockerfile
|
140
141
|
- Gemfile
|
142
|
+
- Gemfile.lock
|
141
143
|
- LICENSE.txt
|
142
144
|
- README.md
|
143
145
|
- Rakefile
|
@@ -146,6 +148,7 @@ files:
|
|
146
148
|
- creditario-client.gemspec
|
147
149
|
- lib/creditario/api/create.rb
|
148
150
|
- lib/creditario/api/delete.rb
|
151
|
+
- lib/creditario/api/exists.rb
|
149
152
|
- lib/creditario/api/list.rb
|
150
153
|
- lib/creditario/api/multipart.rb
|
151
154
|
- lib/creditario/api/request.rb
|
@@ -165,6 +168,7 @@ files:
|
|
165
168
|
- lib/creditario/repositories/customers.rb
|
166
169
|
- lib/creditario/repositories/expenses.rb
|
167
170
|
- lib/creditario/repositories/incomes.rb
|
171
|
+
- lib/creditario/repositories/investors.rb
|
168
172
|
- lib/creditario/repositories/movements.rb
|
169
173
|
- lib/creditario/repositories/payments.rb
|
170
174
|
- lib/creditario/repositories/products.rb
|
@@ -179,6 +183,7 @@ files:
|
|
179
183
|
- lib/creditario/resources/customer.rb
|
180
184
|
- lib/creditario/resources/expense.rb
|
181
185
|
- lib/creditario/resources/income.rb
|
186
|
+
- lib/creditario/resources/investor.rb
|
182
187
|
- lib/creditario/resources/movement.rb
|
183
188
|
- lib/creditario/resources/payment.rb
|
184
189
|
- lib/creditario/resources/product.rb
|
@@ -205,14 +210,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
210
|
requirements:
|
206
211
|
- - ">="
|
207
212
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
213
|
+
version: 2.7.0
|
209
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
215
|
requirements:
|
211
|
-
- - "
|
216
|
+
- - ">="
|
212
217
|
- !ruby/object:Gem::Version
|
213
|
-
version:
|
218
|
+
version: '0'
|
214
219
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
220
|
+
rubygems_version: 3.1.4
|
216
221
|
signing_key:
|
217
222
|
specification_version: 4
|
218
223
|
summary: Ruby Client for the creditar.io API
|