Sha256: 79c8d1ff4dbace5f7b18746d05dbf37a72587b0443e65d8afeeb9c70a061f7c0
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
module Gitrob class Blob include DataMapper::Resource property :id, Serial property :path, String, :length => 1024, :index => true property :filename, String, :length => 255, :index => true property :extension, String, :length => 255, :index => true property :size, Integer, :index => true property :findings_count, Integer, :index => true, :default => 0 property :created_at, DateTime has n, :findings, :constraint => :destroy belongs_to :repo belongs_to :organization def url "https://github.com/#{URI.escape(owner_name)}/#{URI.escape(repo.name)}/blob/master/#{URI.escape(path)}" end def owner_name repo.user.nil? ? repo.organization.login : repo.user.username end def content @content ||= fetch_content end private def fetch_content HTTParty.get("https://raw.githubusercontent.com/#{URI.escape(owner_name)}/#{URI.escape(repo.name)}/master/#{URI.escape(path)}").body end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
gitrob-0.0.6 | models/blob.rb |
gitrob-0.0.5 | models/blob.rb |
gitrob-0.0.4 | models/blob.rb |
gitrob-0.0.3 | models/blob.rb |
gitrob-0.0.2 | models/blob.rb |
gitrob-0.0.1 | models/blob.rb |