module Qiniu::Kit

Constants

VERSION

Public Instance Methods

base64_url_decode(str) click to toggle source
# File lib/qiniu/kit.rb, line 14
def base64_url_decode(str)
  Base64.decode64(str.tr("-_", "+/"))
end
base64_url_encode(str) click to toggle source
# File lib/qiniu/kit.rb, line 10
def base64_url_encode(str)
  Base64.encode64(str).tr("+/", "-_").gsub(/[\n\r]?/, "")
end
decode_json(encoded) click to toggle source
# File lib/qiniu/kit.rb, line 23
def decode_json(encoded)
  JSON.parse(encoded)
rescue JSON::ParserError
  raise Qiniu::Errors::JSONDecodeError.new("Invalid segment encoding")
end
encode_json(raw) click to toggle source
# File lib/qiniu/kit.rb, line 29
def encode_json(raw)
  JSON.generate(raw)
end
entry_uri_encode(bucket, key) click to toggle source
# File lib/qiniu/kit.rb, line 18
def entry_uri_encode(bucket, key)
  entry_uri = bucket + ':' + key
  base64_url_encode(entry_uri)
end