Class: OPFile

Inherits:
Object
  • Object
show all
Defined in:
lib/file_sentry/op_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ OPFile

Returns a new instance of OPFile.



5
6
7
8
9
# File 'lib/file_sentry/op_file.rb', line 5

def initialize(attributes)
  attributes.each {|attribute, value| self.send("#{attribute}=", value)}
  self.file_hash ||= FileHash.new({op_file: self})
  self.api_wrapper ||= APIWrapper.new({op_file: self})
end

Instance Attribute Details

#api_wrapperObject

Returns the value of attribute api_wrapper.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def api_wrapper
  @api_wrapper
end

#data_idObject

Returns the value of attribute data_id.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def data_id
  @data_id
end

#file_hashObject

Returns the value of attribute file_hash.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def file_hash
  @file_hash
end

#filepathObject

Returns the value of attribute filepath.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def filepath
  @filepath
end

#hashObject

Returns the value of attribute hash.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def hash
  @hash
end

#scan_resultsObject

Returns the value of attribute scan_results.



3
4
5
# File 'lib/file_sentry/op_file.rb', line 3

def scan_results
  @scan_results
end

Instance Method Details

#process_file(encrypt) ⇒ Object



11
12
13
14
15
# File 'lib/file_sentry/op_file.rb', line 11

def process_file(encrypt)
  check_file
  file_hash.hash_file(encrypt)
  api_wrapper.scan_file
end