Class: Ibancom::Resources::SCAN::Validation
- Defined in:
- lib/ibancom/resources/scan/validation.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#bank ⇒ Object
readonly
Returns the value of attribute bank.
-
#checks ⇒ Object
readonly
Returns the value of attribute checks.
-
#schemes ⇒ Object
readonly
Returns the value of attribute schemes.
Attributes inherited from Base
Instance Method Summary collapse
- #failed_checks ⇒ Object
-
#initialize(response, attributes = {}) ⇒ Validation
constructor
A new instance of Validation.
- #supported_scheme?(code) ⇒ Boolean
- #supported_schemes ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(response, attributes = {}) ⇒ Validation
Returns a new instance of Validation.
12 13 14 15 16 17 18 |
# File 'lib/ibancom/resources/scan/validation.rb', line 12 def initialize(response, attributes = {}) super(response, attributes) @bank = Bank.new(response, attributes[:bank_data]) @account = Account.new(response, attributes[:account_data]) @checks = Checks.new(response, attributes[:validations]) @schemes = Schemes.new(response, attributes[:payment_schemes]) end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
7 8 9 |
# File 'lib/ibancom/resources/scan/validation.rb', line 7 def account @account end |
#bank ⇒ Object (readonly)
Returns the value of attribute bank.
7 8 9 |
# File 'lib/ibancom/resources/scan/validation.rb', line 7 def bank @bank end |
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
7 8 9 |
# File 'lib/ibancom/resources/scan/validation.rb', line 7 def checks @checks end |
#schemes ⇒ Object (readonly)
Returns the value of attribute schemes.
7 8 9 |
# File 'lib/ibancom/resources/scan/validation.rb', line 7 def schemes @schemes end |
Instance Method Details
#failed_checks ⇒ Object
24 25 26 |
# File 'lib/ibancom/resources/scan/validation.rb', line 24 def failed_checks checks.select(&:failed?) end |
#supported_scheme?(code) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/ibancom/resources/scan/validation.rb', line 32 def supported_scheme?(code) scheme = supported_schemes.find { |supported| supported.code == code } return false if scheme.nil? scheme.supported? end |
#supported_schemes ⇒ Object
28 29 30 |
# File 'lib/ibancom/resources/scan/validation.rb', line 28 def supported_schemes schemes.select(&:supported?) end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/ibancom/resources/scan/validation.rb', line 20 def valid? checks.all?(&:passed?) end |