Sha256: 78a092c8ca8feafa649064905015c97f93368cff1a68b8bd8dc5c8df659182b8

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

module Toolhound

  # Class to parse GitHub repository owner and name from
  # URLs and to generate URLs
  class Project < Base
    attr_accessor :owner, :name, :id

    self.table_name   = "tblLocation"
    self.primary_key  = "intLocationID"

    def default_selects
      #{ }"SELECT tblEntity.intEntityID, tblEntity.varEntityID AS job_no, tblLocation.intLocationID, tblLocationText.varLocationName  FROM tblEntity INNER JOIN tblLocation ON tblLocation.intEntityID = tblEntity.intEntityID INNER JOIN tblLocationText ON tblLocationText.intLocationID = tblLocation.intLocationID WHERE varEntityID LIKE '%10526.00%'"
      {
        location:       [:int_location_id, :dte_created_date, :dte_modified_date],
        location_text:  [:var_location_name],
        entity:         [:int_entity_id, var_entity_id: :job_no ]
      }
    end

    def default_joins
      arr = []
      arr << "INNER JOIN tblEntity ON (tblEntity.intEntityID = tblLocation.intEntityID)"
      arr << "INNER JOIN tblLocationText ON (tblLocationText.intLocationID = tblLocation.intLocationID)"

      arr
    end

    def find_by_entity_id(id)
      all(limit: 1, where: [{int_entity_id: id}]).first
    end

    def find_by_job_no(job_no)
      all(limit: 1, where: [{"entity.var_entity_id" => {value: "%#{job_no}%", op: :like} }]).first

    end

    # rename_attributes intLocationID: 'location_id'

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
toolhound-ruby-1.0.8 lib/toolhound-ruby/project.rb
toolhound-ruby-1.0.7 lib/toolhound-ruby/project.rb
toolhound-ruby-1.0.6 lib/toolhound-ruby/project.rb
toolhound-ruby-1.0.5 lib/toolhound-ruby/project.rb