Class: Ibancom::Resources::IBAN::Validation
- Defined in:
- lib/ibancom/resources/iban/validation.rb
Instance Attribute Summary collapse
-
#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.
11 12 13 14 15 16 |
# File 'lib/ibancom/resources/iban/validation.rb', line 11 def initialize(response, attributes = {}) super(response, attributes) @bank = Bank.new(response, attributes[:bank_data]) @checks = Checks.new(response, attributes[:validations]) @schemes = Schemes.new(response, attributes[:sepa_data]) end |
Instance Attribute Details
#bank ⇒ Object (readonly)
Returns the value of attribute bank.
7 8 9 |
# File 'lib/ibancom/resources/iban/validation.rb', line 7 def bank @bank end |
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
7 8 9 |
# File 'lib/ibancom/resources/iban/validation.rb', line 7 def checks @checks end |
#schemes ⇒ Object (readonly)
Returns the value of attribute schemes.
7 8 9 |
# File 'lib/ibancom/resources/iban/validation.rb', line 7 def schemes @schemes end |
Instance Method Details
#failed_checks ⇒ Object
22 23 24 |
# File 'lib/ibancom/resources/iban/validation.rb', line 22 def failed_checks checks.select(&:failed?) end |
#supported_scheme?(code) ⇒ Boolean
30 31 32 33 34 35 36 |
# File 'lib/ibancom/resources/iban/validation.rb', line 30 def supported_scheme?(code) scheme = supported_schemes.find { |supported| supported.code == code } return false if scheme.nil? scheme.supported? end |
#supported_schemes ⇒ Object
26 27 28 |
# File 'lib/ibancom/resources/iban/validation.rb', line 26 def supported_schemes schemes.select(&:supported?) end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/ibancom/resources/iban/validation.rb', line 18 def valid? checks.all?(&:passed?) end |