Class: Abacos::Shipping
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Attributes inherited from Base
Class Method Summary collapse
Methods inherited from Base
available, call, collection_name, #confirm!, create, execute, #initialize, #persisted?
Constructor Details
This class inherits a constructor from Abacos::Base
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/abacos/shipping.rb', line 3 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
3 4 5 |
# File 'lib/abacos/shipping.rb', line 3 def price @price end |
Class Method Details
.find_all_by_cep_and_weight(cep, weight) ⇒ Object
5 6 7 |
# File 'lib/abacos/shipping.rb', line 5 def self.find_all_by_cep_and_weight cep, weight execute("SELECT name=SE.SERE_NOM, price=round(min(fr.FREP_VAL_COB)*1.035,2) FROM ABACOS.dbo.tcom_locent lo WITH (NOLOCK) INNER JOIN ABACOS.dbo.TCOM_FREPES fr WITH (NOLOCK) ON lo.LOCE_COD=fr.LOCE_COD INNER JOIN ABACOS.dbo.TCOM_SERENT se WITH (NOLOCK) ON lo.SERE_COD=se.SERE_COD WHERE '#{cep}' BETWEEN lo.LOCE_CEP_INI AND lo.LOCE_CEP_FIM AND fr.FREP_PES_MAX >= #{weight} AND se.TRAN_COD=1 AND se.SERE_COD IN (1,2,3) AND fr.FREP_VAL_COB>0 GROUP BY SE.SERE_NOM ORDER BY price ASC") end |