class Sanity::Client

Public Class Methods

new(label=nil) click to toggle source
# File lib/sanity.rb, line 21
def initialize(label=nil)
  @label = label
  @logs = []
  @success = true
end

Public Instance Methods

broken(obj) click to toggle source
# File lib/sanity.rb, line 27
def broken(obj)
  # obj can be string or hash
  # reports args back to HQ
  @logs << obj
  @success = false
end
report!() click to toggle source
# File lib/sanity.rb, line 41
def report!
  Typhoeus::Request.new(
    Sanity.config[:url],
    method: :post,
    body: { data: @logs.to_json },
    params: { token: Sanity.token,
              email: Sanity.config[:email],
              label: @label,
              success: @success }
  ).run
end
success(obj) click to toggle source
# File lib/sanity.rb, line 34
def success(obj)
  # obj can be string or hash
  # reports args back to HQ
  @logs << obj
  @success = true
end