Class: Mooamba::Sedex

Inherits:
Object show all
Includes:
SAXMachine
Defined in:
lib/mooamba/sedex.rb

Constant Summary collapse

CODE =
40010
DEFAULT_PARAMS =
{
  :nCdServico => CODE,
  :StrRetorno => "XML"
}

Class Method Summary collapse

Class Method Details

.calculate(options = {}) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/mooamba/sedex.rb', line 20

def self.calculate(options={})
  raise InvalidOriginZipCode if invalid_cep?(options[:from])
  raise InvalidDestinationZipCode if invalid_cep?(options[:to])
  raise InvalidWeight if invalid_weight?(options[:weight])
  response = response_for options
  error?(response) ? (raise exception(response)) : response
end