Sha256: 345e2e4c85c098f0381facac8e2eed5b55070dcaaae97739d822ea0e58d3e6b4
Contents?: true
Size: 1000 Bytes
Versions: 1
Compression:
Stored size: 1000 Bytes
Contents
require 'httparty' require 'json' module Mortise class Checker attr_reader :url, :tenon_uri, :key def initialize(url, key, options = {}) options = defaults.merge(options) @url = url @key = key @tenon_uri = options[:tenon_uri] end def raw @raw ||= JSON.parse HTTParty.post(tenon_uri, body: { url: url, key: key }, headers: { 'Content-Type' => 'application/x-www-form-urlencoded', 'Cache-Control' => 'no-cache' }).body end def issues @issues ||= raw['resultSet'].map { |issue| Mortise::Issue.new(issue) } end def errors @errors ||= issues.select { |issue| issue.certainty >= 80 } end def warnings @warnings ||= issues.select { |issue| issue.certainty < 80 } end private def defaults { tenon_uri: 'https://tenon.io/api/' } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mortise-0.1.0 | lib/mortise/checker.rb |