module Prtscr::V3

Version 2:

Public Instance Methods

v3(data) click to toggle source
# File lib/prtscr/v3.rb, line 6
def v3(data)
  "https://prtscr.ru/v3/screenshot.#{data[:format]}?#{v3_query(data)}"
end
v3_query(data) click to toggle source
# File lib/prtscr/v3.rb, line 19
def v3_query(data)
  ::URI.encode_www_form(
    {
      url: data[:url],
      key: data[:key],
      sign: v3_sign(data),
      width: data[:width],
      height: data[:height],
      scale: data[:scale]
    }.compact
  )
end
v3_sign(data) click to toggle source
# File lib/prtscr/v3.rb, line 10
def v3_sign(data)
  ::Digest::MD5.hexdigest(
    [
      data[:url], data[:format], data[:key], data[:width],
      data[:height], data[:scale], data[:secret]
    ].map(&:to_s).join
  )
end