class ScreenshotsCloud

Public Class Methods

new(apiKey, apiSecret) click to toggle source
# File lib/screenshotscloud.rb, line 5
    def initialize(apiKey, apiSecret)
      @apiKey = apiKey
      @apiSecret = apiSecret
end

Public Instance Methods

screenshotUrl(options={}) click to toggle source
# File lib/screenshotscloud.rb, line 10
def screenshotUrl(options={})
  parameters = options.map {|option| option.map {|value| URI.escape(value.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) }.join('=') }.join('&')

  token = OpenSSL::HMAC.hexdigest('sha1', @apiSecret, parameters)

  "https://api.screenshots.cloud/v1/screenshot/#{@apiKey}/#{token}?#{parameters}"
end