Class: Toolhound::Rental

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

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

Attributes inherited from Base

#client, #connection

Instance Method Summary collapse

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 Method Details

#default_joinsObject



22
23
24
25
26
27
28
# File 'lib/toolhound-ruby/rental.rb', line 22

def default_joins
  arr = []
  arr << "LEFT OUTER JOIN tblJobText ON (tblJobText.intJobID = tblRental.intJobID AND varLocaleID = '#{locale}')"
  # arr << "INNER JOIN tblLocationText ON (tblLocationText.intLocationID = tblLocation.intLocationID)"

  arr
end

#default_selectsObject

self.table_name = :rental self.primary_key = :int_rental_id



11
12
13
14
15
16
17
18
19
20
# File 'lib/toolhound-ruby/rental.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%'"
  {
    rental: [
      :int_rental_id, :var_rental_number, :int_from_location_id, :int_entity_id, :dte_required_date, :int_rate_sheet_id,
      :int_job_id, :dte_created_date, :dte_modified_date
    ],
    job_text: [{var_job: :contact_name}]
  }
end

#for_entity(id) ⇒ Object



30
31
32
# File 'lib/toolhound-ruby/rental.rb', line 30

def for_entity(id)
  all(where: [{int_entity_id: id}])
end