Class: Abacos::Shipping

Inherits:
Base
  • Object
show all
Defined in:
lib/abacos/shipping.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#response

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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/abacos/shipping.rb', line 3

def name
  @name
end

#priceObject (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.10, 2) from abacos..tcom_locent lo with (nolock) inner join abacos..TCOM_FREPES fr with (nolock) on lo.LOCE_COD=fr.LOCE_COD inner join abacos..TCOM_SERENT se with (nolock) on lo.SERE_COD=se.SERE_COD where '#{cep}' between LOCE_CEP_ini and loce_cep_fim and FREP_PES_MAX  >= #{weight} and se.TRAN_COD=1 and se.SERE_COD in(3,2) group by SE.SERE_NOM")
end