class DirtyHarry::Validation

Attributes

csv[RW]

Public Class Methods

new(csv) click to toggle source
# File lib/dirty_harry/validation.rb, line 8
def initialize(csv)
  @csv = csv
end

Public Instance Methods

badge() click to toggle source
# File lib/dirty_harry/validation.rb, line 18
def badge
  "#{url}.svg"
end

Private Instance Methods

package() click to toggle source
# File lib/dirty_harry/validation.rb, line 37
def package
  response = nil
  until !response.nil?
    response = self.class.get(package_url).body
  end
  response
end
package_url() click to toggle source
# File lib/dirty_harry/validation.rb, line 33
def package_url
  response["package"]["url"]
end
response() click to toggle source
# File lib/dirty_harry/validation.rb, line 29
def response
  JSON.parse(self.class.post("/package.json", query: { urls: [@csv] }).body)
end
result() click to toggle source
# File lib/dirty_harry/validation.rb, line 24
def result
  @response ||= JSON.parse(package)
  @response["package"]["validations"].first
end