Class: FriendlyShipping::Services::UspsInternational::RateEstimatePackageOptions

Inherits:
PackageOptions
  • Object
show all
Defined in:
lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb

Instance Attribute Summary collapse

Attributes inherited from PackageOptions

#package_id

Instance Method Summary collapse

Methods inherited from PackageOptions

#options_for_item

Constructor Details

#initialize(**kwargs) ⇒ RateEstimatePackageOptions

Returns a new instance of RateEstimatePackageOptions.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 26

def initialize(**kwargs)
  container_code = value_or_default(:container, :variable, kwargs) || :variable
  mail_type_code = value_or_default(:mail_type, :all, kwargs) || :all

  @box_name = value_or_default(:box_name, :variable, kwargs)
  @commercial_pricing = value_or_default(:commercial_pricing, false, kwargs) ? 'Y' : 'N'
  @commercial_plus_pricing = value_or_default(:commercial_plus_pricing, false, kwargs) ? 'Y' : 'N'
  @container = CONTAINERS.fetch(container_code)
  @mail_type = MAIL_TYPES.fetch(mail_type_code)
  @rectangular = @container.eql?("ROLL") ? false : value_or_default(:rectangular, true, kwargs)
  @shipping_method = kwargs.delete(:shipping_method)
  @transmit_dimensions = value_or_default(:transmit_dimensions, true, kwargs)
  super(**kwargs)
end

Instance Attribute Details

#box_nameObject (readonly)

Returns the value of attribute box_name.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def box_name
  @box_name
end

#commercial_plus_pricingObject (readonly)

Returns the value of attribute commercial_plus_pricing.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def commercial_plus_pricing
  @commercial_plus_pricing
end

#commercial_pricingObject (readonly)

Returns the value of attribute commercial_pricing.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def commercial_pricing
  @commercial_pricing
end

#containerObject (readonly)

Returns the value of attribute container.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def container
  @container
end

#mail_typeObject (readonly)

Returns the value of attribute mail_type.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def mail_type
  @mail_type
end

#rectangularObject (readonly)

Returns the value of attribute rectangular.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def rectangular
  @rectangular
end

#shipping_methodObject (readonly)

Returns the value of attribute shipping_method.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def shipping_method
  @shipping_method
end

#transmit_dimensionsObject (readonly)

Returns the value of attribute transmit_dimensions.



17
18
19
# File 'lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb', line 17

def transmit_dimensions
  @transmit_dimensions
end