Class: Toolhound::Project
Overview
Class to parse GitHub repository owner and name from URLs and to generate URLs
Constant Summary
Constants inherited from Base
Base::DATE_TIME_FORMAT, Base::DB_TYPE_REGEX
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
Attributes inherited from Base
Instance Method Summary collapse
- #default_joins ⇒ Object
- #default_selects ⇒ Object
- #find_by_entity_id(id) ⇒ Object
- #find_by_job_no(job_no) ⇒ Object
Methods inherited from Base
#_build_joins, #_build_selects, #_build_where, #all, #build_and_query, #build_group, #build_joins, #build_selects, #build_sql, #build_update_attributes, #build_update_sql, #build_where, #default_wheres, #find, #formatted_table_and_column, #formatted_table_name, #formmatted_column_name, #get_operator, #initialize, #insert, #locale, #merge_options, #parse_time, primary_key, #primary_key, primary_key=, #procedure, #query, rename_attributes, renamed_attributes, #table_name, table_name, table_name=, #transform_attribute_key, #transform_attributes, #transform_procedure_key, #transform_procedure_value, #transform_procedure_variables, #update, #update_query
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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/toolhound-ruby/project.rb', line 25 def default_joins arr = [] arr << "INNER JOIN tblEntity ON (tblEntity.intEntityID = tblLocation.intEntityID)" arr << "INNER JOIN tblLocationText ON (tblLocationText.intLocationID = tblLocation.intLocationID)" # tax rates arr << "LEFT OUTER JOIN ( SELECT intLocationID, MAX(tblTax.dteCreatedDate) AS max_date FROM tblTax GROUP BY intLocationID ) as taxQuery ON taxQuery.intLocationID = tblLocation.intLocationID" arr << "LEFT OUTER JOIN tblTax ON tblTax.intLocationID = taxQuery.intLocationID AND tblTax.dteCreatedDate = taxQuery.max_date" arr << "LEFT OUTER JOIN tblTaxText ON tblTaxText.intTaxID = tblTax.intTaxID AND tblTaxText.varLocaleID = '#{locale}'" # rental periods arr << "LEFT OUTER JOIN ( SELECT intEntityID, MIN(dteStartDate) as dteMinRentalDate, MAX(dteStartDate) AS dteMaxRentalDate FROM tblRentalCharge GROUP BY intEntityID ) AS tblRentalPeriod ON tblRentalPeriod.intEntityID = tblEntity.intEntityID" arr end |
#default_selects ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 ], # tax rates tax: [:dec_tax1_rate, :dec_tax2_rate, :dec_tax3_rate, :dec_tax4_rate], tax_text: [:var_tax1_description, :var_tax2_description, :var_tax3_description, :var_tax4_description], # rental periods rental_period: [:dte_min_rental_date, :dte_max_rental_date] } end |
#find_by_entity_id(id) ⇒ Object
43 44 45 |
# File 'lib/toolhound-ruby/project.rb', line 43 def find_by_entity_id(id) all(limit: 1, where: [{int_entity_id: id}]).first end |
#find_by_job_no(job_no) ⇒ Object
47 48 49 50 |
# File 'lib/toolhound-ruby/project.rb', line 47 def find_by_job_no(job_no) all(limit: 1, where: [{"entity.var_entity_id" => {value: "%#{job_no}%", op: :like} }]).first end |