Class: FriendlyShipping::Label

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/label.rb

Direct Known Subclasses

Services::Ups::Label

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, shipment_id: nil, tracking_number: nil, service_code: nil, label_href: nil, label_format: nil, label_data: nil, cost: nil, shipment_cost: nil, data: {}) ⇒ Label

Returns a new instance of Label.

Parameters:

  • id (Integer) (defaults to: nil)

    The label’s ID

  • shipment_id (Integer) (defaults to: nil)

    The label’s shipment ID

  • tracking_number (String) (defaults to: nil)

    The label’s tracking number

  • service_code (String) (defaults to: nil)

    The label’s service code

  • label_href (String) (defaults to: nil)

    The URL for the label

  • label_format (String) (defaults to: nil)

    The label’s format

  • label_data (String) (defaults to: nil)

    The raw label data

  • shipment_cost (Float) (defaults to: nil)

    The cost of the shipment

  • data (Hash) (defaults to: {})

    Additional data related to the label



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/friendly_shipping/label.rb', line 27

def initialize(
  id: nil,
  shipment_id: nil,
  tracking_number: nil,
  service_code: nil,
  label_href: nil,
  label_format: nil,
  label_data: nil,
  cost: nil,
  shipment_cost: nil,
  data: {}
)
  @id = id
  @shipment_id = shipment_id
  @tracking_number = tracking_number
  @service_code = service_code
  @label_href = label_href
  @label_format = label_format
  @cost = FriendlyShipping::Types::Money.optional[cost]
  @shipment_cost = FriendlyShipping::Types::Money.optional[shipment_cost]
  @label_data = label_data
  @data = data
end

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def cost
  @cost
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def id
  @id
end

#label_dataObject (readonly)

Returns the value of attribute label_data.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def label_data
  @label_data
end

#label_formatObject (readonly)

Returns the value of attribute label_format.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def label_format
  @label_format
end

#label_hrefObject (readonly)

Returns the value of attribute label_href.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def label_href
  @label_href
end

#service_codeObject (readonly)

Returns the value of attribute service_code.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def service_code
  @service_code
end

#shipment_costObject (readonly)

Returns the value of attribute shipment_cost.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def shipment_cost
  @shipment_cost
end

#shipment_idObject (readonly)

Returns the value of attribute shipment_id.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def shipment_id
  @shipment_id
end

#tracking_numberObject (readonly)

Returns the value of attribute tracking_number.



7
8
9
# File 'lib/friendly_shipping/label.rb', line 7

def tracking_number
  @tracking_number
end