Sha256: ed9f05aa07f236197764160e3407bf36eec2ca21feb1e0ef97553942611a26b9

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'rest_client'

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
      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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
i2x-0.1.1 lib/i2x/cashier.rb
i2x-0.1 lib/i2x/cashier.rb
i2x-0.0.7 lib/i2x/cashier.rb