Class: I2X::Cashier

Inherits:
Object
  • Object
show all
Defined in:
lib/i2x/cashier.rb

Class Method Summary collapse

Class Method Details

.verify(cache, agent, payload, seed) ⇒ Object

Verify

> Verify if items have already been seen in the past (on the cache).

Params

  • cache: the key identifier to be verified

  • payload: the value for matching/verification

  • agent: the agent performing the verification

  • seed: seed data (if available)



17
18
19
20
21
22
23
24
25
26
# File 'lib/i2x/cashier.rb', line 17

def self.verify cache, agent, payload, seed
  I2X::Config.log.info(self.class.name) {"Verifying\n\taccess token: #{I2X::Config.access_token}\n\thost: #{I2X::Config.host}\n\tcache: #{cache}\n\tagent: #{agent}\n\tpayload: #{payload}\tseed: #{seed}"}
  begin
    response = RestClient.post "#{I2X::Config.host}fluxcapacitor/verify.json", {:access_token => I2X::Config.access_token, :agent => agent[:identifier], :cache => cache, :payload => payload, :seed => seed}
  rescue Exception => e
    I2X::Config.log.error(self.class.name) {"#{e}"}
    response = {:status => 400, :error => e}
  end
  response
end