Class: APIWrapper

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

Constant Summary collapse

BASE_URL =
'https://api.metadefender.com/v2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ APIWrapper

Returns a new instance of APIWrapper.



7
8
9
# File 'lib/file_sentry/api_wrapper.rb', line 7

def initialize(attributes)
  attributes.each {|attribute, value| self.send("#{attribute}=", value)}
end

Instance Attribute Details

#op_fileObject

Returns the value of attribute op_file.



5
6
7
# File 'lib/file_sentry/api_wrapper.rb', line 5

def op_file
  @op_file
end

Instance Method Details

#scan_fileObject



11
12
13
14
15
16
17
18
19
# File 'lib/file_sentry/api_wrapper.rb', line 11

def scan_file
  hash_response = get_hash
  if does_hash_exist?(hash_response, op_file.hash)
    set_data_id(hash_response)
  else
    set_data_id(post_file)
  end
  monitor_scan
end