Class: FriendlyShipping::Services::UpsFreight::LabelDocumentOptions
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::UpsFreight::LabelDocumentOptions
- Defined in:
- lib/friendly_shipping/services/ups_freight/label_document_options.rb
Constant Summary collapse
- DOCUMENT_TYPES =
{ label: "30", ups_bol: "20", vics_bol: "21" }.freeze
- DOCUMENT_FORMATS =
{ pdf: "01" }.freeze
- THERMAL_CODE =
{ false => "01", true => "02" }.freeze
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#thermal ⇒ Object
readonly
Returns the value of attribute thermal.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #document_type_code ⇒ Object
- #format_code ⇒ Object
-
#initialize(format: :pdf, type: :label, size: "4x6", thermal: false, labels_per_page: 1) ⇒ LabelDocumentOptions
constructor
A new instance of LabelDocumentOptions.
- #labels_per_page ⇒ Object
- #thermal_code ⇒ Object
Constructor Details
#initialize(format: :pdf, type: :label, size: "4x6", thermal: false, labels_per_page: 1) ⇒ LabelDocumentOptions
Returns a new instance of LabelDocumentOptions.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 24 def initialize( format: :pdf, type: :label, size: "4x6", thermal: false, labels_per_page: 1 ) @format = format @type = type @length, @width = size.split('x').sort @thermal = thermal @labels_per_page = labels_per_page end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
7 8 9 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 7 def format @format end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
7 8 9 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 7 def length @length end |
#thermal ⇒ Object (readonly)
Returns the value of attribute thermal.
7 8 9 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 7 def thermal @thermal end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 7 def type @type end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
7 8 9 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 7 def width @width end |
Instance Method Details
#document_type_code ⇒ Object
42 43 44 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 42 def document_type_code DOCUMENT_TYPES.fetch(type) end |
#format_code ⇒ Object
38 39 40 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 38 def format_code DOCUMENT_FORMATS.fetch(format) end |
#labels_per_page ⇒ Object
50 51 52 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 50 def labels_per_page @labels_per_page.to_s end |
#thermal_code ⇒ Object
46 47 48 |
# File 'lib/friendly_shipping/services/ups_freight/label_document_options.rb', line 46 def thermal_code THERMAL_CODE.fetch(thermal) end |