zaig 1.0.4 → 1.0.5

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
2
  SHA256:
3
- metadata.gz: 445f2312bf3306d59b548373e139522dbea660d2078c7c617837ffbff8429dc7
4
- data.tar.gz: 2dfd8b0ac9f20729abf3df0447a5a3a3d349371bd3558d86e62ff84355f89f20
3
+ metadata.gz: 4d7e5e123adff444d932edaf15cf93f0d56c036e19a12391957736cdb5b3a0f1
4
+ data.tar.gz: 6dff02d64d11a052be1a9dc47f77b6a490d3208b1de8b84d487527259099e546
5
5
  SHA512:
6
- metadata.gz: c055883e1eac329a7249f79542eb10186fd2a508575e90a1e4dfd10f68e95ab2819f05386213ee4a06e37158440245a588f1d3ee260f8790a5759abb856652c7
7
- data.tar.gz: b0ea93f0f3a76a3e7b4a698096e284dc5734c4cfd915f28a2de38cc4882bab5309065854061f07d1004e311c4b20a52ec0d1c034828ff054c7979233ef16c51d
6
+ metadata.gz: 06ea034e23aef7a39e5dd7fe35260746b31d8095ce9f524bb45f60b02b92d6285fe24bd305e43c1f24b49b3d0cb9e61777d6612430741bc49de0f384c88d6f7f
7
+ data.tar.gz: f637d5ab308c48793bda590598a41fdff30d8103f395c03cfaf38e87eba2446b4ef77cfe30d3020d174f397e10990802477865559610d80859d4f14f6382bad8
@@ -7,9 +7,18 @@ module Zaig
7
7
  attr_reader :analysis_status, :credit_proposal_legal_person_key, :message,
8
8
  :raw_data, :reason, :request, :status_code, :zaig_id
9
9
 
10
+ # Collection with all the approval statuses.
11
+ APPROVAL_STATUS = %i[automatically_approved manually_approved].freeze
12
+
13
+ # Collection with all the pending statuses.
14
+ PENDING_STATUS = %i[pending in_manual_analysis in_manual_analysis].freeze
15
+
16
+ # Colllection with all the reproval statuses.
17
+ REPROVAL_STATUS = %i[automatically_reproved manually_reproved].freeze
18
+
10
19
  def initialize(analysis_status: nil, credit_proposal_legal_person_key: nil, message: nil,
11
20
  raw_data: nil, reason: nil, request: nil, status_code: nil, zaig_id: nil)
12
- @analysis_status = analysis_status
21
+ @analysis_status = analysis_status.nil? ? nil : analysis_status.to_s.strip.downcase.to_sym
13
22
  @credit_proposal_legal_person_key = credit_proposal_legal_person_key
14
23
  @message = message
15
24
  @raw_data = raw_data
@@ -19,9 +28,27 @@ module Zaig
19
28
  @zaig_id = zaig_id
20
29
  end
21
30
 
31
+ # Retrieve all the available statuses.
32
+ def self.statuses
33
+ %i[automatically_approved automatically_reproved in_manual_analysis manually_approved manually_reproved waiting_for_data pending]
34
+ end
35
+
36
+ # Check if the registration is approved.
22
37
  def approved?
23
- analysis_status == "automatically_approved"
38
+ APPROVAL_STATUS.include?(analysis_status)
24
39
  end
40
+
41
+ # Check if the registration still not done.
42
+ def pending?
43
+ PENDING_STATUS.include?(analysis_status)
44
+ end
45
+
46
+ # Check if the registration is reproved.
47
+ def rejected?
48
+ REPROVAL_STATUS.include?(analysis_status)
49
+ end
50
+
51
+ alias not_approved? rejected?
25
52
  end
26
53
  end
27
54
  end
data/lib/zaig/version.rb CHANGED
@@ -8,5 +8,5 @@ module Zaig
8
8
  # Major - Incremented for incompatible changes with previous release (or big enough new features)
9
9
  # Minor - Incremented for new backwards-compatible features + deprecations
10
10
  # Patch - Incremented for backwards-compatible bug fixes
11
- VERSION = "1.0.4"
11
+ VERSION = "1.0.5"
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Carolino