module HtmlCssToImage

Constants

API_HOST
API_ORIGIN
API_SCHEME
API_VERSION
VERSION

Attributes

api_key[W]
user_id[W]

Public Class Methods

connection() click to toggle source
# File lib/html_css_to_image.rb, line 22
def connection
  raise "API key not set" if @api_key.nil?
  raise "User id not set" if @user_id.nil?

  Faraday.new(API_ORIGIN) do |connection|
    connection.adapter Faraday.default_adapter
    connection.headers["Content-Type"] = "application/json"
    connection.headers["Accept"]       = "application/json"
    connection.basic_auth @user_id, @api_key
  end
end