Class: Toolhound::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/toolhound-ruby/project.rb

Overview

Class to parse GitHub repository owner and name from URLs and to generate URLs

Constant Summary

Constants inherited from Base

Base::DB_TYPE_REGEX

Instance Attribute Summary collapse

Attributes inherited from Base

#connection

Instance Method Summary collapse

Methods inherited from Base

#_build_joins, #_build_selects, #_build_where, #all, #build_and_query, #build_joins, #build_selects, #build_sql, #build_where, #default_wheres, #find, #formatted_table_and_column, #formatted_table_name, #formmatted_column_name, #get_operator, #initialize, #locale, #merge_options, primary_key, #primary_key, primary_key=, #query, rename_attributes, renamed_attributes, #table_name, table_name, table_name=, #transform_attribute_key, #transform_attributes

Methods included from Util

#acronym_regex, #acronyms, #camelize, #demodulize, #underscore

Constructor Details

This class inherits a constructor from Toolhound::Base

Instance Attribute Details

#id ⇒ Object

Returns the value of attribute id.



6
7
8
# File 'lib/toolhound-ruby/project.rb', line 6

def id
  @id
end

#name ⇒ Object

Returns the value of attribute name.



6
7
8
# File 'lib/toolhound-ruby/project.rb', line 6

def name
  @name
end

#owner ⇒ Object

Returns the value of attribute owner.



6
7
8
# File 'lib/toolhound-ruby/project.rb', line 6

def owner
  @owner
end

Instance Method Details

#default_joins ⇒ Object



20
21
22
23
24
25
26
# File 'lib/toolhound-ruby/project.rb', line 20

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

  arr
end

#default_selects ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/toolhound-ruby/project.rb', line 11

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

#find_by_entity_id(id) ⇒ Object



28
29
30
# File 'lib/toolhound-ruby/project.rb', line 28

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

#find_by_job_no(job_no) ⇒ Object



32
33
34
35
# File 'lib/toolhound-ruby/project.rb', line 32

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

end