Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'ezcrypto'
- require 'json'
- require 'cgi'
- require 'base64'
- module Uservoice
- class Token
- attr_accessor :data
- def initialize(options = {})
- options.merge!(:expires => (Time.now.utc + (5 * 60)).strftime("%Y/%m/%d %H:%M:%S +0000"))
- puts options.to_json
- key = EzCrypto::Key.with_password(USERVOICE_ACCOUNT_KEY, USERVOICE_API_KEY)
- encrypted = key.encrypt(options.to_json)
- puts key.decrypt(encrypted)
- @data = Base64.encode64(encrypted).gsub(/\n/, '') # Remove line returns where are annoyingly placed every 60 characters
- #puts @data
- puts @data
- puts key.decrypt(Base64.decode64(@data))
- end
- def to_s
- @data
- end
- end
- end
Add Comment
Please, Sign In to add comment