Skip to content

Commit a7b6f49

Browse files
authored
Merge pull request #13 from tithely/mv/IN-2466/add-fund-methods-that-we-need
feat: [IN-2466] add status? and active? to funds
2 parents 9542368 + 175a657 commit a7b6f49

File tree

8 files changed

+75
-6
lines changed

8 files changed

+75
-6
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Layout/EmptyLinesAroundModuleBody:
6565
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
6666
Style/HashSyntax:
6767
Enabled: true
68+
EnforcedStyle: ruby19
69+
EnforcedShorthandSyntax: never # Ruby 3.1 allows omission of value name, but we want to support prior Ruby versions
6870

6971
Layout/FirstArgumentIndentation:
7072
Enabled: true

.tool-versions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
ruby 3.0.6
1+
ruby 3.3.5
2+

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ All notable changes to this project will be documented in this file.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

10+
## [Unreleased]
11+
12+
### Added
13+
14+
1. Adds `Entity::Fund` `active?` and `default?` interrogatives
15+
16+
## [4.0.1] - 2024-09-13
17+
18+
This version adds support for Ruby 3.3.5. No real changes were required. We just needed to add some gems to the gemspec
19+
to silence deprecation warnings.
20+
21+
### Added
22+
23+
1. Add dependencies which will be removed from a future version of Ruby. (IN-2512)
24+
25+
## [4.0.0] - 2024-09-11
26+
27+
### Changed
28+
29+
1. Update ActiveSupport Version to support Rails 7. (IN-2109)
30+
1031
## [3.0.1] - 2024-09-09
1132

1233
### Changed

Gemfile.lock

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
PATH
22
remote: .
33
specs:
4-
faithteams-api (3.0.1)
5-
activesupport (>= 6.1.7)
4+
faithteams-api (4.1.1)
5+
activesupport (>= 7.0.8, <= 7.1.5.1)
66
http (~> 5.1)
7+
logger (~> 1.6.1)
8+
ostruct (~> 0.6.0)
79
rexml (~> 3.3.6)
810

911
GEM
@@ -87,6 +89,7 @@ GEM
8789
notiffany (0.1.3)
8890
nenv (~> 0.1)
8991
shellany (~> 0.0)
92+
ostruct (0.6.1)
9093
parallel (1.26.3)
9194
parser (3.3.6.0)
9295
ast (~> 2.4.1)
@@ -136,7 +139,7 @@ GEM
136139
rubocop-rspec (1.42.0)
137140
rubocop (>= 0.87.0)
138141
ruby-progressbar (1.13.0)
139-
securerandom (0.3.2)
142+
securerandom (0.4.1)
140143
shellany (0.0.1)
141144
simplecov (0.22.0)
142145
docile (~> 1.1)

faithteams-api.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ Gem::Specification.new do |spec|
3232
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
3333
spec.require_paths = ["lib"]
3434

35-
spec.add_dependency "activesupport", ">= 6.1.7"
35+
spec.add_dependency "activesupport", ">= 7.0.8", "<= 7.1.5.1"
3636
spec.add_dependency "http", "~> 5.1"
37+
spec.add_dependency "logger", "~> 1.6.1"
38+
spec.add_dependency "ostruct", "~> 0.6.0"
3739
spec.add_dependency "rexml", "~> 3.3.6" # only needs to be specified to address security warning
3840

3941
spec.add_development_dependency "byebug", "~> 11.1"

lib/faithteams/api/v2/entity/fund.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ def default
1111
read_attribute(:isDefault).presence
1212
end
1313

14+
# @return [Boolean]
15+
def default?
16+
default == "Y"
17+
end
18+
1419
# @return [String, nil]
1520
def description
1621
read_attribute(:description).presence
@@ -41,6 +46,11 @@ def status
4146
read_attribute(:status).presence
4247
end
4348

49+
# @return [Boolean]
50+
def active?
51+
status == "A"
52+
end
53+
4454
# @return [String, nil] "T" for true?, "Y" for yes?
4555
def tax_deductible
4656
read_attribute(:taxDeductible).presence

lib/faithteams/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
module FaithTeams
44
# Current version number.
5-
VERSION = "3.0.1"
5+
VERSION = "4.1.1"
66
end

spec/faithteams/api/v2/entity/fund_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
end
2323
end
2424

25+
describe "#default?" do
26+
context "when default is 'Y'" do
27+
it "returns true" do
28+
fund = described_class.new(attributes: { "isDefault" => "Y" })
29+
expect(fund).to be_default
30+
end
31+
end
32+
33+
context "when default isn't 'Y'" do
34+
it "returns false" do
35+
expect(fund).not_to be_default
36+
end
37+
end
38+
end
39+
2540
describe "description" do
2641
it "is a String" do
2742
expect(fund.description).to be_instance_of(String)
@@ -64,6 +79,21 @@
6479
end
6580
end
6681

82+
describe "#active?" do
83+
context "when status is 'A'" do
84+
it "returns true" do
85+
expect(fund).to be_active
86+
end
87+
end
88+
89+
context "when status isn't 'A'" do
90+
it "returns false" do
91+
fund = described_class.new(attributes: { "status" => "I" })
92+
expect(fund).not_to be_active
93+
end
94+
end
95+
end
96+
6797
describe "tax_deductible" do
6898
it "is a String" do
6999
expect(fund.tax_deductible).to be_instance_of(String)

0 commit comments

Comments
 (0)