creditario-client 1.0.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG +19 -0
- data/Gemfile.lock +8 -8
- data/creditario-client.gemspec +1 -2
- data/lib/creditario/api/create.rb +10 -2
- data/lib/creditario/api/multipart.rb +2 -2
- data/lib/creditario/api/request.rb +6 -3
- data/lib/creditario/api/update.rb +9 -1
- data/lib/creditario/client/version.rb +1 -1
- data/lib/creditario/client.rb +13 -2
- data/lib/creditario/repositories/crowdfunding/contracts.rb +32 -0
- data/lib/creditario/repositories/crowdfunding/crowdfunds.rb +47 -0
- data/lib/creditario/repositories/crowdfunding/funds.rb +47 -0
- data/lib/creditario/repositories/crowdfunding/investors.rb +48 -0
- data/lib/creditario/repositories/crowdfunding/movements.rb +47 -0
- data/lib/creditario/resources/crowdfunding/contract.rb +9 -0
- data/lib/creditario/resources/crowdfunding/crowdfund.rb +13 -0
- data/lib/creditario/resources/crowdfunding/fund.rb +12 -0
- data/lib/creditario/resources/crowdfunding/investor.rb +14 -0
- data/lib/creditario/resources/crowdfunding/movement.rb +16 -0
- data/lib/creditario/resources/resource.rb +5 -1
- metadata +16 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b450f825957ef5b550f453f2ab1cdcfd8abf1813cf5ad7c063d5922011498168
|
4
|
+
data.tar.gz: 5513a8630e36dc9b0499b14ddd286999eaec7dcfd551d86a7aa438d41c837418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d178b5ba0750bace58ac00928c020135e85fc832880e981e2a05f6e5e5b2009cae74c6144eda615024f2878de1cd7bff7c70cfb1ee2f04dbea0e09615035dd1d
|
7
|
+
data.tar.gz: e094ded2b9b11c5fc7bc079df4f851d4d8c10a1f1daef481391254b3c487eb673da2cc13dcd9ff4d733e5c2ec0c917322cd9580f8064c84d1362cedb8d6eabb9
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
VERSION 1.1.2
|
2
|
+
|
3
|
+
Release notes:
|
4
|
+
|
5
|
+
- HOTFIX: Inverstors repository on update action can't upload documents using multipart/form-data.
|
6
|
+
|
7
|
+
VERSION 1.1.0
|
8
|
+
|
9
|
+
Release notes:
|
10
|
+
|
11
|
+
- Add repositories crowfunding investors, crowdfunds, funds, movements and contracts.
|
12
|
+
|
13
|
+
VERSION 1.0.1
|
14
|
+
|
15
|
+
Release notes:
|
16
|
+
|
17
|
+
- Upgrade for some gems
|
18
|
+
- HOTFIX: Creditario::API::Customers#create and Creditario::API::Multipart#create
|
19
|
+
|
1
20
|
Version 0.0.7.alpha
|
2
21
|
|
3
22
|
Release notes:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
creditario-client (1.
|
4
|
+
creditario-client (1.1.2)
|
5
5
|
multipart-post (= 2.0.0)
|
6
6
|
oj (~> 3.0.0)
|
7
7
|
|
@@ -15,16 +15,16 @@ GEM
|
|
15
15
|
rexml
|
16
16
|
hashdiff (1.0.1)
|
17
17
|
jaro_winkler (1.5.4)
|
18
|
-
minitest (5.
|
18
|
+
minitest (5.16.3)
|
19
19
|
multipart-post (2.0.0)
|
20
20
|
oj (3.0.11)
|
21
|
-
parallel (1.
|
22
|
-
parser (3.1.
|
21
|
+
parallel (1.22.1)
|
22
|
+
parser (3.1.2.1)
|
23
23
|
ast (~> 2.4.1)
|
24
24
|
powerpack (0.1.3)
|
25
|
-
psych (4.0.
|
25
|
+
psych (4.0.4)
|
26
26
|
stringio
|
27
|
-
public_suffix (4.0.
|
27
|
+
public_suffix (4.0.7)
|
28
28
|
rainbow (3.1.1)
|
29
29
|
rake (10.5.0)
|
30
30
|
rdoc (6.4.0)
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
ruby-progressbar (1.11.0)
|
42
42
|
sdoc (1.1.0)
|
43
43
|
rdoc (>= 5.0)
|
44
|
-
stringio (3.0.
|
44
|
+
stringio (3.0.2)
|
45
45
|
unicode-display_width (1.8.0)
|
46
46
|
webmock (3.4.2)
|
47
47
|
addressable (>= 2.3.6)
|
@@ -52,7 +52,7 @@ PLATFORMS
|
|
52
52
|
ruby
|
53
53
|
|
54
54
|
DEPENDENCIES
|
55
|
-
bundler
|
55
|
+
bundler
|
56
56
|
creditario-client!
|
57
57
|
minitest (~> 5.0)
|
58
58
|
rake (~> 10.0)
|
data/creditario-client.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
4
|
lib = File.expand_path("../lib", __FILE__)
|
6
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
6
|
require "creditario/client/version"
|
@@ -28,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
28
27
|
spec.add_dependency "oj", "~> 3.0.0"
|
29
28
|
spec.add_dependency "multipart-post", "2.0.0"
|
30
29
|
|
31
|
-
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "bundler"
|
32
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
32
|
spec.add_development_dependency "minitest", "~> 5.0"
|
34
33
|
spec.add_development_dependency "sdoc", "~> 1.0"
|
@@ -14,8 +14,16 @@ 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
|
-
|
18
|
-
|
17
|
+
#
|
18
|
+
# Nota: Si desea hacer uso de *multipart/form-data* es necesario pasar un parametro enctype con valor true
|
19
|
+
# para habilitarlo, por ejemplo:
|
20
|
+
#
|
21
|
+
# result = Creditario::Crowdfunding::Investors.create(email: "karla@quiereinvertir.com", encypte: true)
|
22
|
+
#
|
23
|
+
def create(params = {})
|
24
|
+
enctype = params.delete(:enctype) || false
|
25
|
+
request_method = enctype ? :multipart_post : :post
|
26
|
+
response = API.request(request_method, self.resource_path, params)
|
19
27
|
|
20
28
|
attributes = response.dig("data").first
|
21
29
|
links = response.dig("links")
|
@@ -14,8 +14,8 @@ 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(
|
18
|
-
response = API.request(:
|
17
|
+
def create(params = {})
|
18
|
+
response = API.request(:multipart_post, self.resource_path, params)
|
19
19
|
|
20
20
|
attributes = response.dig("data").first
|
21
21
|
links = response.dig("links")
|
@@ -32,6 +32,9 @@ module Creditario # :nodoc:
|
|
32
32
|
uri = URI(Creditario::Client.api_base + path)
|
33
33
|
request = request_from_method(method, uri, params)
|
34
34
|
|
35
|
+
request["User-Agent"] = "creditario-client gem v#{Creditario::Client::VERSION}"
|
36
|
+
request["Accept"] = "application/vnd.creditar.v#{Creditario::Client.api_version}+json"
|
37
|
+
|
35
38
|
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
36
39
|
http.request(request)
|
37
40
|
end
|
@@ -63,8 +66,10 @@ module Creditario # :nodoc:
|
|
63
66
|
request
|
64
67
|
when :post
|
65
68
|
set_request_body(set_request_headers(Net::HTTP::Post.new(uri)), params)
|
66
|
-
when :
|
69
|
+
when :multipart_post
|
67
70
|
set_authorization_headers(Net::HTTP::Post::Multipart.new(uri, params))
|
71
|
+
when :multipart_patch
|
72
|
+
set_authorization_headers(Net::HTTP::Put::Multipart.new(uri, params))
|
68
73
|
when :delete
|
69
74
|
set_request_headers(Net::HTTP::Delete.new(uri))
|
70
75
|
when :patch
|
@@ -75,8 +80,6 @@ module Creditario # :nodoc:
|
|
75
80
|
def set_request_headers(request)
|
76
81
|
request = set_authorization_headers(request)
|
77
82
|
|
78
|
-
request["User-Agent"] = "creditario-client gem v#{Creditario::Client::VERSION}"
|
79
|
-
request["Accept"] = "application/vnd.creditar.v#{Creditario::Client.api_version}+json"
|
80
83
|
request["Content-Type"] = "application/json"
|
81
84
|
|
82
85
|
request
|
@@ -13,10 +13,18 @@ module Creditario # :nodoc:
|
|
13
13
|
#
|
14
14
|
# Si todo sale bien devuelve una instancia del Recurso específico que el Repositorio maneja.
|
15
15
|
# De lo contrario, regresa un Hash con los errores arrojados por el servidor de creditar.io
|
16
|
+
#
|
17
|
+
# Nota: Si desea hacer uso de *multipart/form-data* es necesario pasar un parametro enctype con valor true
|
18
|
+
# para habilitarlo, por ejemplo:
|
19
|
+
#
|
20
|
+
# result = Creditario::Crowdfunding::Investors.update("97d58a6c-e943-46bf-b8ec-2db7b397bc17", full_name: "Steve Rogers", encypte: true)
|
21
|
+
#
|
16
22
|
def update(id, params = {}, include_param = nil)
|
23
|
+
enctype = params.delete(:enctype) || false
|
17
24
|
path = "#{self.resource_path}/#{id}"
|
18
25
|
path = include_param.nil? ? path : path + "?include=#{include_param}"
|
19
|
-
|
26
|
+
request_method = enctype ? :multipart_patch : :patch
|
27
|
+
response = API.request(request_method, path, params)
|
20
28
|
|
21
29
|
attributes = response.dig("data").first
|
22
30
|
links = response.dig("links")
|
data/lib/creditario/client.rb
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
|
3
3
|
require "oj"
|
4
4
|
|
5
|
+
require "creditario/exceptions"
|
5
6
|
require "creditario/client/version"
|
6
7
|
require "creditario/client/railtie" if defined?(Rails)
|
7
8
|
|
8
|
-
require "creditario/exceptions"
|
9
|
-
|
10
9
|
require "creditario/api/request"
|
11
10
|
require "creditario/api/create"
|
12
11
|
require "creditario/api/multipart"
|
@@ -36,6 +35,12 @@ require "creditario/resources/movement"
|
|
36
35
|
require "creditario/resources/qualify_score_flow"
|
37
36
|
require "creditario/resources/investor"
|
38
37
|
|
38
|
+
require "creditario/resources/crowdfunding/fund"
|
39
|
+
require "creditario/resources/crowdfunding/investor"
|
40
|
+
require "creditario/resources/crowdfunding/movement"
|
41
|
+
require "creditario/resources/crowdfunding/contract"
|
42
|
+
require "creditario/resources/crowdfunding/crowdfund"
|
43
|
+
|
39
44
|
require "creditario/repositories/applications"
|
40
45
|
require "creditario/repositories/customers"
|
41
46
|
require "creditario/repositories/products"
|
@@ -53,6 +58,12 @@ require "creditario/repositories/qualify_score_flows"
|
|
53
58
|
require "creditario/repositories/convert_application_to_credits"
|
54
59
|
require "creditario/repositories/investors"
|
55
60
|
|
61
|
+
require "creditario/repositories/crowdfunding/investors"
|
62
|
+
require "creditario/repositories/crowdfunding/crowdfunds"
|
63
|
+
require "creditario/repositories/crowdfunding/funds"
|
64
|
+
require "creditario/repositories/crowdfunding/movements"
|
65
|
+
require "creditario/repositories/crowdfunding/contracts"
|
66
|
+
|
56
67
|
module Creditario # :nodoc:
|
57
68
|
###
|
58
69
|
# == Creditario::Client
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
###
|
6
|
+
# == Creditario::Crowdfunding::Contracts
|
7
|
+
#
|
8
|
+
# Repositorio de Contracto del Inversionistas, permite realizar las siguientes operaciones
|
9
|
+
# sobre Contracto del Inversionistas de creditar.io
|
10
|
+
#
|
11
|
+
# - Obtener un Contracto del Inversionista en especifico:
|
12
|
+
#
|
13
|
+
# Creditario::Crowdfunding::Contracts.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
14
|
+
# => Creditario::Crowdfunding::Contract
|
15
|
+
#
|
16
|
+
module Contracts
|
17
|
+
extend Creditario::API::Retrieve
|
18
|
+
|
19
|
+
###
|
20
|
+
# Path de la API donde se ejecutan las peticiones para Contracto del Inversionistas.
|
21
|
+
def self.resource_path
|
22
|
+
"/crowdfunding/investor_contracts"
|
23
|
+
end
|
24
|
+
|
25
|
+
###
|
26
|
+
# Clase a utilizar para transformar las respuestas de la API
|
27
|
+
def self.resource_class
|
28
|
+
Creditario::Crowdfunding::Contract
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
###
|
6
|
+
# == Creditario::Crowdfunding::Crowdfunds
|
7
|
+
#
|
8
|
+
# Repositorio de Campañas de fondos, permite realizar las siguientes operaciones
|
9
|
+
# sobre Campañas de fondos de creditar.io
|
10
|
+
#
|
11
|
+
# - Obtener todas las Campañas de fondos:
|
12
|
+
#
|
13
|
+
# result = Creditario::Crowdfunding::Crowdfunds.list
|
14
|
+
# => Creditario::PaginatedCollection
|
15
|
+
#
|
16
|
+
# result.items
|
17
|
+
# => [Creditario::Crowdfunding::Crowdfund, Creditario::Crowdfunding::Crowdfund, ...]
|
18
|
+
#
|
19
|
+
# - Obtener una Campaña de fondos en especifico:
|
20
|
+
#
|
21
|
+
# Creditario::Crowdfunding::Crowdfunds.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
22
|
+
# => Creditario::Crowdfunding::Crowdfund
|
23
|
+
#
|
24
|
+
# - Crear una Campaña de fondos:
|
25
|
+
#
|
26
|
+
# result = Creditario::Crowdfunding::Crowdfunds.create(amount_cents: 100000000, ... ,campaing_days: 30)
|
27
|
+
# => Creditario::Crowdfunding::Crowdfund
|
28
|
+
#
|
29
|
+
module Crowdfunds
|
30
|
+
extend Creditario::API::List
|
31
|
+
extend Creditario::API::Retrieve
|
32
|
+
extend Creditario::API::Create
|
33
|
+
|
34
|
+
###
|
35
|
+
# Path de la API donde se ejecutan las peticiones para campañas de fondos.
|
36
|
+
def self.resource_path
|
37
|
+
"/crowdfunding/crowdfunds"
|
38
|
+
end
|
39
|
+
|
40
|
+
###
|
41
|
+
# Clase a utilizar para transformar las respuestas de la API
|
42
|
+
def self.resource_class
|
43
|
+
Creditario::Crowdfunding::Crowdfund
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
###
|
6
|
+
# == Creditario::Crowdfunding::Funds
|
7
|
+
#
|
8
|
+
# Repositorio de Fondos, permite realizar las siguientes operaciones
|
9
|
+
# sobre Fondos de creditar.io
|
10
|
+
#
|
11
|
+
# - Obtener todos los Fondos:
|
12
|
+
#
|
13
|
+
# result = Creditario::Crowdfunding::Funds.list
|
14
|
+
# => Creditario::PaginatedCollection
|
15
|
+
#
|
16
|
+
# result.items
|
17
|
+
# => [Creditario::Crowdfunding::Fund, Creditario::Crowdfunding::Fund, ...]
|
18
|
+
#
|
19
|
+
# - Obtener un Fondo en especifico:
|
20
|
+
#
|
21
|
+
# Creditario::Crowdfunding::Funds.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
22
|
+
# => Creditario::Crowdfunding::Fund
|
23
|
+
#
|
24
|
+
# - Crear un Fondo:
|
25
|
+
#
|
26
|
+
# result = Creditario::Crowdfunding::Funds.create(amount_cents: 1000000, ..., crowdfund_id: "fef6ced1-a462-4d78-af50-70528eb2986b")
|
27
|
+
# => Creditario::Crowdfunding::Fund
|
28
|
+
#
|
29
|
+
module Funds
|
30
|
+
extend Creditario::API::List
|
31
|
+
extend Creditario::API::Retrieve
|
32
|
+
extend Creditario::API::Create
|
33
|
+
|
34
|
+
###
|
35
|
+
# Path de la API donde se ejecutan las peticiones para Fondos.
|
36
|
+
def self.resource_path
|
37
|
+
"/crowdfunding/funds"
|
38
|
+
end
|
39
|
+
|
40
|
+
###
|
41
|
+
# Clase a utilizar para transformar las respuestas de la API
|
42
|
+
def self.resource_class
|
43
|
+
Creditario::Crowdfunding::Fund
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
###
|
6
|
+
# == Creditario::Crowdfunding::Investors
|
7
|
+
#
|
8
|
+
# Repositorio de Inversionistas, permite realizar las siguientes operaciones
|
9
|
+
# sobre Inversionistas de creditar.io
|
10
|
+
#
|
11
|
+
# - Obtener todos los Inversionistas:
|
12
|
+
#
|
13
|
+
# result = Creditario::Crowdfunding::Investors.list
|
14
|
+
# => Creditario::PaginatedCollection
|
15
|
+
#
|
16
|
+
# result.items
|
17
|
+
# => [Creditario::Crowdfunding::Investor, Creditario::Crowdfunding::Investor, ...]
|
18
|
+
#
|
19
|
+
# - Obtener un Inversionista en especifico:
|
20
|
+
#
|
21
|
+
# Creditario::Crowdfunding::Investors.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
22
|
+
# => Creditario::Crowdfunding::Investor
|
23
|
+
#
|
24
|
+
# - Crear un Inversionista:
|
25
|
+
#
|
26
|
+
# result = Creditario::Crowdfunding::Investors.create(email: "karla@quiereinvertir.com")
|
27
|
+
# => Creditario::Crowdfunding::Investor
|
28
|
+
#
|
29
|
+
module Investors
|
30
|
+
extend Creditario::API::List
|
31
|
+
extend Creditario::API::Retrieve
|
32
|
+
extend Creditario::API::Create
|
33
|
+
extend Creditario::API::Update
|
34
|
+
|
35
|
+
###
|
36
|
+
# Path de la API donde se ejecutan las peticiones para Inversionistas.
|
37
|
+
def self.resource_path
|
38
|
+
"/crowdfunding/investors"
|
39
|
+
end
|
40
|
+
|
41
|
+
###
|
42
|
+
# Clase a utilizar para transformar las respuestas de la API
|
43
|
+
def self.resource_class
|
44
|
+
Creditario::Crowdfunding::Investor
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
###
|
6
|
+
# == Creditario::Crowdfunding::Movements
|
7
|
+
#
|
8
|
+
# Repositorio de Movimientos del Inversionistas, permite realizar las siguientes operaciones
|
9
|
+
# sobre Movimientos del Inversionistas de creditar.io
|
10
|
+
#
|
11
|
+
# - Obtener todos los Movimientos del Inversionistas:
|
12
|
+
#
|
13
|
+
# result = Creditario::Crowdfunding::Movements.list
|
14
|
+
# => Creditario::PaginatedCollection
|
15
|
+
#
|
16
|
+
# result.items
|
17
|
+
# => [Creditario::Crowdfunding::Movement, Creditario::Crowdfunding::Movement, ...]
|
18
|
+
#
|
19
|
+
# - Obtener un Movimientos del Inversionista en especifico:
|
20
|
+
#
|
21
|
+
# Creditario::Crowdfunding::Movements.retrieve("2e9d05b8-2180-4779-bab6-bdfd41d1569f")
|
22
|
+
# => Creditario::Crowdfunding::Movement
|
23
|
+
#
|
24
|
+
# - Crear un Movimientos del Inversionista:
|
25
|
+
#
|
26
|
+
# result = Creditario::Crowdfunding::Movements.create(amount_cents: 100000, ..., investor_id: "a7454cdb-c695-4db0-9df7-edf87944404d")
|
27
|
+
# => Creditario::Crowdfunding::Movement
|
28
|
+
#
|
29
|
+
module Movements
|
30
|
+
extend Creditario::API::List
|
31
|
+
extend Creditario::API::Retrieve
|
32
|
+
extend Creditario::API::Create
|
33
|
+
|
34
|
+
###
|
35
|
+
# Path de la API donde se ejecutan las peticiones para Movimientos del Inversionistas.
|
36
|
+
def self.resource_path
|
37
|
+
"/crowdfunding/movements"
|
38
|
+
end
|
39
|
+
|
40
|
+
###
|
41
|
+
# Clase a utilizar para transformar las respuestas de la API
|
42
|
+
def self.resource_class
|
43
|
+
Creditario::Crowdfunding::Movement
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
class Crowdfund # :nodoc:
|
6
|
+
include Creditario::Resource
|
7
|
+
|
8
|
+
has_one :credit_application, class: "Creditario::Application"
|
9
|
+
has_one :credit, class: "Creditario::Credit"
|
10
|
+
has_many :funds, class: "Creditario::Crowdfunding::Fund"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
class Fund # :nodoc:
|
6
|
+
include Resource
|
7
|
+
|
8
|
+
has_one :investor, class: "Creditario::Crowdfunding::Investor"
|
9
|
+
has_one :crowdfund, class: "Creditario::Crowdfunding::Crowdfund"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Creditario # :nodoc:
|
4
|
+
module Crowdfunding # :nodoc:
|
5
|
+
class Investor # :nodoc:
|
6
|
+
include Resource
|
7
|
+
|
8
|
+
has_one :customer, class: "Creditario::Customer"
|
9
|
+
has_many :funds, class: "Creditario::Crowdfunding::Fund"
|
10
|
+
has_many :movements, class: "Creditario::Crowdfunding::Movement"
|
11
|
+
has_one :contract, class: "Creditario::Crowdfunding::Contract"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "investor"
|
4
|
+
require_relative "fund"
|
5
|
+
|
6
|
+
module Creditario # :nodoc:
|
7
|
+
module Crowdfunding # :nodoc:
|
8
|
+
class Movement # :nodoc:
|
9
|
+
include Resource
|
10
|
+
|
11
|
+
has_one :investor, class: "Creditario::Crowdfunding::Investor"
|
12
|
+
has_one :fund, class: "Creditario::Crowdfunding::Fund"
|
13
|
+
has_one :payment, class: "Creditario::Payment"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -62,7 +62,7 @@ module Creditario # :nodoc:
|
|
62
62
|
if self.class.class_variable_defined?(:@@associations)
|
63
63
|
association = self.class.class_variable_get(:@@associations).find { |association| association[:name] == attribute.to_sym }
|
64
64
|
unless association.nil?
|
65
|
-
attributes[attribute] = build_associations(association[:class], value)
|
65
|
+
attributes[attribute] = build_associations(constantize(association[:class].to_s), value)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -70,6 +70,10 @@ module Creditario # :nodoc:
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def constantize(camel_cased_word)
|
74
|
+
Object.const_get(camel_cased_word)
|
75
|
+
end
|
76
|
+
|
73
77
|
def define_attribute_setter_and_getter(attribute, value)
|
74
78
|
self.class.define_method(attribute) do
|
75
79
|
attributes[attribute]
|
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: 1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- michelada.io
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,11 @@ files:
|
|
165
165
|
- lib/creditario/repositories/convert_application_to_credits.rb
|
166
166
|
- lib/creditario/repositories/credit_estimates.rb
|
167
167
|
- lib/creditario/repositories/credits.rb
|
168
|
+
- lib/creditario/repositories/crowdfunding/contracts.rb
|
169
|
+
- lib/creditario/repositories/crowdfunding/crowdfunds.rb
|
170
|
+
- lib/creditario/repositories/crowdfunding/funds.rb
|
171
|
+
- lib/creditario/repositories/crowdfunding/investors.rb
|
172
|
+
- lib/creditario/repositories/crowdfunding/movements.rb
|
168
173
|
- lib/creditario/repositories/customers.rb
|
169
174
|
- lib/creditario/repositories/expenses.rb
|
170
175
|
- lib/creditario/repositories/incomes.rb
|
@@ -180,6 +185,11 @@ files:
|
|
180
185
|
- lib/creditario/resources/contract.rb
|
181
186
|
- lib/creditario/resources/credit.rb
|
182
187
|
- lib/creditario/resources/credit_estimate.rb
|
188
|
+
- lib/creditario/resources/crowdfunding/contract.rb
|
189
|
+
- lib/creditario/resources/crowdfunding/crowdfund.rb
|
190
|
+
- lib/creditario/resources/crowdfunding/fund.rb
|
191
|
+
- lib/creditario/resources/crowdfunding/investor.rb
|
192
|
+
- lib/creditario/resources/crowdfunding/movement.rb
|
183
193
|
- lib/creditario/resources/customer.rb
|
184
194
|
- lib/creditario/resources/expense.rb
|
185
195
|
- lib/creditario/resources/income.rb
|