loan_creator 0.5.0 → 0.6.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ce94717f0c667263653597ea2037844157e6cebe
4
- data.tar.gz: e498fe9069ca0ff9c3d765083a182f28ddc3ca22
2
+ SHA256:
3
+ metadata.gz: af7d0ce0dc0202794a3f37abf13b9f0af74e214a3d5629779d312acb1f5d02f0
4
+ data.tar.gz: c7304d6eb2ecc855702c2e403378860ad029b30180054e7658bfc86980fc7fb0
5
5
  SHA512:
6
- metadata.gz: da8108111a04280719eba3143444bd2ceac35abaade6521c2e9a5a3297266037c7d8e194156c3a373602fe766bbce49c23ebe515a2db1b64e1a35ac67a4aff06
7
- data.tar.gz: 5e49dd7114a25fc67e9230ea0d6120b7a12bb83b6b6c50d28eecbfb7c92cc7bbd68da4ca26d0bf7dffe0b7b1fc2a7ec9acbbbb9369bf2cdfb1eb6837625dd2be
6
+ metadata.gz: a3991a0c94c5445bf179d8c363a56926c9bb8b90bddf23ae1d220dd74eed7d9ec225174fd06c2033a85fde23502af09346d1196f2755ac7cae26a625f6396669
7
+ data.tar.gz: d080c6fe10ad761bc19947edbe701736f80ab38fded009ea2bce40292440878141e4a06e8a6fc4988b956ee8918a058e3b24345f3b39d152d03b543fec18aefc
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.7
1
+ 3.2.5
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ v0.6.1.1
2
+ -------------------------
3
+
4
+ - fix homepage url
5
+
6
+ v0.6.0
7
+ -------------------------
8
+
9
+ - add `LoanCreator::UncapitalizedBullet`
10
+
11
+ v0.5.0
12
+ -------------------------
13
+
14
+ - add `interests_start_date` in `LoanCreator::Common` attributes, replacing `first_term_date`
15
+
16
+ v0.3.0
17
+ -------------------------
18
+
19
+ - add `first_term_date` in `LoanCreator::Common` attributes
20
+
21
+ v0.2.3
22
+ -------------------------
23
+
24
+ - rename `starts_at` -> `starts_on`
25
+
26
+ v0.2.2
27
+ -------------------------
28
+
29
+ - rename `date` -> `due_on`
30
+
31
+ v0.2.1
32
+ -------------------------
33
+
34
+ - convert some options to their expected type by default
35
+
36
+ v0.2.0
37
+ -------------------------
38
+
39
+ - Huge rework : add `period`, rename `amount_in_cents` to `amount` and other breaking changes.
@@ -0,0 +1,73 @@
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, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and 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 development@capsens.eu. 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 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  `loan_creator` gem intends to provide a set of methods to allow automatic generation of loan timetables, for simulation, from a lender point of view and from a borrower point of view, regarding financial rounding differences. As of today, the gem makes the borrower support any rounding issue. In a later work, an option should be provided to decide who supports such issues.
4
4
 
5
- Link to Loan_Creator excel simulator [Click here] (Excel)
6
-
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
@@ -35,6 +33,7 @@ There are four types of loans. All inherit from a `LoanCreator::Common` class.
35
33
  LoanCreator::Linear
36
34
  LoanCreator::InFine
37
35
  LoanCreator::Bullet
36
+ LoanCreator::UncapitalizedBullet
38
37
  ```
39
38
 
40
39
  Each instance of one of the previous classes has the following attributes:
@@ -137,6 +136,9 @@ Capital share shall be repaid in full at loan's end.
137
136
  Interests are capitalized, i.e. added to the borrowed capital on each term.\
138
137
  Capital share shall be repaid in full and all interests paid at loan's end.
139
138
 
139
+ `UncapitalizedBullet` same as bullet, the only difference is the interests\
140
+ are NOT capitalized.
141
+
140
142
  There is no deferred time for `InFine` and `Bullet` loans as it would be equivalent to increasing loan's duration.
141
143
 
142
144
  ### Attributes
@@ -155,10 +157,14 @@ There is no deferred time for `InFine` and `Bullet` loans as it would be equival
155
157
  capital is refunded, only interest. Only relevant for `Standard` and `Linear` loans.
156
158
 
157
159
  `interests_start_date`: Optional. To be used when the loan starts before the first full term date. This then compute an
158
- additional term with only interests for the time difference.
160
+ additional term with only interests for the time difference.
159
161
  For example, with a `start_at` in january 2020 and a `interests_start_date` in october 2019, the timetable will include a
160
162
  first term corresponding to 3 months of interests.
161
163
 
164
+ ## Calculation
165
+
166
+ An excel simulator for standard case can be found [here](CapSens_Loan.xlsx).
167
+
162
168
  ## Development
163
169
 
164
170
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -167,7 +173,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
167
173
 
168
174
  ## Contributing
169
175
 
170
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/loan_creator.
176
+ Bug reports and pull requests are welcome on GitHub at https://github.com/CapSens/loan_creator.
171
177
 
172
178
 
173
179
  ## License
@@ -34,7 +34,7 @@ module LoanCreator
34
34
  term = BORROWER_FINANCIAL_ATTRIBUTES.each_with_object({}) do |k, h|
35
35
  h[k] = arr.inject(bigd('0')) { |sum, tt| sum + tt.send(k) }
36
36
  end
37
- borrower_timetable << LoanCreator::Term.new(all_zero.merge(term))
37
+ borrower_timetable << LoanCreator::Term.new(**all_zero.merge(term))
38
38
  end
39
39
  borrower_timetable
40
40
  end
@@ -4,7 +4,7 @@ module LoanCreator
4
4
  # Thus we're generating a Linear loan instead of rewriting already existing code.
5
5
  def lender_timetable
6
6
  options = @options.merge(deferred_in_periods: duration_in_periods - 1)
7
- LoanCreator::Linear.new(options).lender_timetable
7
+ LoanCreator::Linear.new(**options).lender_timetable
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,34 @@
1
+ module LoanCreator
2
+ class UncapitalizedBullet < LoanCreator::Common
3
+ def lender_timetable
4
+ raise ArgumentError.new(:deferred_in_periods) unless deferred_in_periods == 0
5
+ raise ArgumentError.new(:interests_start_date) unless interests_start_date.nil?
6
+ timetable = new_timetable
7
+ reset_current_term
8
+ @crd_beginning_of_period = amount
9
+ @crd_end_of_period = amount
10
+ (duration_in_periods - 1).times { timetable << current_term }
11
+ compute_last_term
12
+ timetable << current_term
13
+ timetable
14
+ end
15
+
16
+ private
17
+
18
+ def compute_last_term
19
+ @crd_end_of_period = bigd('0')
20
+ @period_interests = total_interests
21
+ @period_capital = @crd_beginning_of_period
22
+ @total_paid_capital_end_of_period = @period_capital
23
+ @total_paid_interests_end_of_period = @period_interests
24
+ @period_amount_to_pay = @period_capital + @period_interests
25
+ end
26
+
27
+ def total_interests
28
+ amount.mult(
29
+ bigd(periodic_interests_rate) * bigd(duration_in_periods),
30
+ BIG_DECIMAL_DIGITS
31
+ )
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module LoanCreator
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.1.1'.freeze
3
3
  end
data/lib/loan_creator.rb CHANGED
@@ -7,13 +7,14 @@ require 'loan_creator/version'
7
7
  module LoanCreator
8
8
  BIG_DECIMAL_DIGITS = 14
9
9
 
10
- autoload :ExcelFormulas, 'loan_creator/excel_formulas'
11
- autoload :BorrowerTimetable, 'loan_creator/borrower_timetable'
12
- autoload :Common, 'loan_creator/common'
13
- autoload :Standard, 'loan_creator/standard'
14
- autoload :Linear, 'loan_creator/linear'
15
- autoload :InFine, 'loan_creator/in_fine'
16
- autoload :Bullet, 'loan_creator/bullet'
17
- autoload :Timetable, 'loan_creator/timetable'
18
- autoload :Term, 'loan_creator/term'
10
+ autoload :ExcelFormulas, 'loan_creator/excel_formulas'
11
+ autoload :BorrowerTimetable, 'loan_creator/borrower_timetable'
12
+ autoload :Common, 'loan_creator/common'
13
+ autoload :Standard, 'loan_creator/standard'
14
+ autoload :Linear, 'loan_creator/linear'
15
+ autoload :InFine, 'loan_creator/in_fine'
16
+ autoload :Bullet, 'loan_creator/bullet'
17
+ autoload :Timetable, 'loan_creator/timetable'
18
+ autoload :Term, 'loan_creator/term'
19
+ autoload :UncapitalizedBullet, 'loan_creator/uncapitalized_bullet'
19
20
  end
data/loan_creator.gemspec CHANGED
@@ -5,11 +5,11 @@ require 'loan_creator/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'loan_creator'
7
7
  spec.version = LoanCreator::VERSION
8
- spec.authors = %w[thibaulth nicob younes.serraj]
9
- spec.email = ['thibault@capsens.eu', 'nicolas.besnard@capsens.eu', 'younes.serraj@gmail.com']
8
+ spec.authors = ["thibaulth", "nicob", "younes.serraj", "Antoine Becquet", "Jerome Drevet"]
9
+ spec.email = ['thibault@capsens.eu', 'nicolas.besnard@capsens.eu', 'younes.serraj@gmail.com', "antoine@capsens.eu", "jerome@capsens.eu"]
10
10
 
11
11
  spec.summary = 'Create and update timetables from input data'
12
- spec.homepage = 'https://capsens.githost.io/capsens/loan-creator'
12
+ spec.homepage = 'https://github.com/CapSens/loan-creator'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.13'
23
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'bundler'
23
+ spec.add_development_dependency 'rake'
24
24
  spec.add_development_dependency 'rspec', '~> 3.0'
25
25
  spec.add_development_dependency 'simplecov', '~> 0.16'
26
26
  spec.add_development_dependency 'byebug', '~> 11.0'
metadata CHANGED
@@ -1,45 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loan_creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thibaulth
8
8
  - nicob
9
9
  - younes.serraj
10
- autorequire:
10
+ - Antoine Becquet
11
+ - Jerome Drevet
12
+ autorequire:
11
13
  bindir: exe
12
14
  cert_chain: []
13
- date: 2020-09-16 00:00:00.000000000 Z
15
+ date: 2024-09-02 00:00:00.000000000 Z
14
16
  dependencies:
15
17
  - !ruby/object:Gem::Dependency
16
18
  name: bundler
17
19
  requirement: !ruby/object:Gem::Requirement
18
20
  requirements:
19
- - - "~>"
21
+ - - ">="
20
22
  - !ruby/object:Gem::Version
21
- version: '1.13'
23
+ version: '0'
22
24
  type: :development
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
25
27
  requirements:
26
- - - "~>"
28
+ - - ">="
27
29
  - !ruby/object:Gem::Version
28
- version: '1.13'
30
+ version: '0'
29
31
  - !ruby/object:Gem::Dependency
30
32
  name: rake
31
33
  requirement: !ruby/object:Gem::Requirement
32
34
  requirements:
33
- - - "~>"
35
+ - - ">="
34
36
  - !ruby/object:Gem::Version
35
- version: '10.0'
37
+ version: '0'
36
38
  type: :development
37
39
  prerelease: false
38
40
  version_requirements: !ruby/object:Gem::Requirement
39
41
  requirements:
40
- - - "~>"
42
+ - - ">="
41
43
  - !ruby/object:Gem::Version
42
- version: '10.0'
44
+ version: '0'
43
45
  - !ruby/object:Gem::Dependency
44
46
  name: rspec
45
47
  requirement: !ruby/object:Gem::Requirement
@@ -110,11 +112,13 @@ dependencies:
110
112
  - - ">="
111
113
  - !ruby/object:Gem::Version
112
114
  version: '0'
113
- description:
115
+ description:
114
116
  email:
115
117
  - thibault@capsens.eu
116
118
  - nicolas.besnard@capsens.eu
117
119
  - younes.serraj@gmail.com
120
+ - antoine@capsens.eu
121
+ - jerome@capsens.eu
118
122
  executables: []
119
123
  extensions: []
120
124
  extra_rdoc_files: []
@@ -126,6 +130,8 @@ files:
126
130
  - ".ruby-gemset"
127
131
  - ".ruby-version"
128
132
  - ".travis.yml"
133
+ - CHANGELOG.md
134
+ - CODE_OF_CONDUCT.md
129
135
  - CapSens_Loan.xlsx
130
136
  - Gemfile
131
137
  - LICENSE.txt
@@ -144,13 +150,14 @@ files:
144
150
  - lib/loan_creator/standard.rb
145
151
  - lib/loan_creator/term.rb
146
152
  - lib/loan_creator/timetable.rb
153
+ - lib/loan_creator/uncapitalized_bullet.rb
147
154
  - lib/loan_creator/version.rb
148
155
  - loan_creator.gemspec
149
- homepage: https://capsens.githost.io/capsens/loan-creator
156
+ homepage: https://github.com/CapSens/loan-creator
150
157
  licenses:
151
158
  - MIT
152
159
  metadata: {}
153
- post_install_message:
160
+ post_install_message:
154
161
  rdoc_options: []
155
162
  require_paths:
156
163
  - lib
@@ -165,9 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
172
  - !ruby/object:Gem::Version
166
173
  version: '0'
167
174
  requirements: []
168
- rubyforge_project:
169
- rubygems_version: 2.5.2.3
170
- signing_key:
175
+ rubygems_version: 3.5.18
176
+ signing_key:
171
177
  specification_version: 4
172
178
  summary: Create and update timetables from input data
173
179
  test_files: []