Class: ActiveFedora::FixityService
- Inherits:
-
Object
- Object
- ActiveFedora::FixityService
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_fedora/fixity_service.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#check ⇒ Object
Executes a fixity check on Fedora and saves the Faraday::Response.
-
#initialize(target) ⇒ FixityService
constructor
A new instance of FixityService.
- #status ⇒ Object
Constructor Details
#initialize(target) ⇒ FixityService
Returns a new instance of FixityService.
8 9 10 11 |
# File 'lib/active_fedora/fixity_service.rb', line 8 def initialize(target) raise ArgumentError, 'You must provide a uri' unless target @target = target.to_s end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/active_fedora/fixity_service.rb', line 5 def response @response end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/active_fedora/fixity_service.rb', line 5 def target @target end |
Instance Method Details
#check ⇒ Object
Executes a fixity check on Fedora and saves the Faraday::Response.
15 16 17 18 |
# File 'lib/active_fedora/fixity_service.rb', line 15 def check @response = fixity_response_from_fedora status.include?(success) end |
#status ⇒ Object
20 21 22 23 |
# File 'lib/active_fedora/fixity_service.rb', line 20 def status fixity_graph.query(predicate: premis_status_predicate).map(&:object) + fixity_graph.query(predicate: fedora_status_predicate).map(&:object) end |