class ActiveShipping::Correios::CorreiosPackage

Constants

FORMAT

Attributes

params[R]

Public Class Methods

new(package, format) click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 244
def initialize(package, format)
  @package = package

  @params = {
    :format => format,
    :weight => weight,
    :width => width,
    :length => length,
    :height => height(format),
    :diameter => diameter
  }
end

Private Instance Methods

diameter() click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 277
def diameter
  return 0 unless @package.cylinder?
  @package.cm(:width)
end
height(format) click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 271
def height(format)
  return 0 if format == FORMAT[:envelope]
  return diameter if @package.cylinder?
  @package.cm(:height)
end
length() click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 267
def length
  @package.cm(:length)
end
weight() click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 259
def weight
  @package.kg
end
width() click to toggle source
# File lib/active_shipping/carriers/correios.rb, line 263
def width
  @package.cm(:width)
end