Sha256: da866a284c370cdf163503434c6cc4b16c97796a2f1401e9c28f1cda2a7611e9

Contents?: true

Size: 310 Bytes

Versions: 1

Compression:

Stored size: 310 Bytes

Contents

require 'openssl'
require 'base64'
require 'cgi'

module OAuth
  module Helper
    extend self

    def escape(value)
      CGI.escape(value.to_s).gsub("%7E", '~').gsub("+", "%20")
    end

    def generate_key(size=32)
      Base64.encode64(OpenSSL::Random.random_bytes(size)).gsub(/\W/, '')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mojodna-oauth-0.3.1.1 lib/oauth/helper.rb