Sha256: 046d6edc0790b75b9d65121e4f1a803902563d2e2c101b705082c51b3c194131

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

require 'rest_client'
require 'open-uri'


module I2X
  class Cashier


    public
    
    ##
    # = 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)
    #
    def self.verify cache, agent, payload, seed
      #puts "[i2x][Cashier] verifying\n\taccess token: #{I2X::Config.access_token}\n\thost: #{I2X::Config.host}\n\tcache: #{cache}\n\tagent: #{agent}\n\tpayload: #{payload}\n\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
        response = {:status => 400}
      end
      p response
      response
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i2x-0.0.5 lib/i2x/cashier.rb