Class: ShipEngine::Domain::Labels

Inherits:
Object
  • Object
show all
Defined in:
lib/shipengine/domains/labels.rb

Instance Method Summary collapse

Constructor Details

#initializeLabels

Returns a new instance of Labels.



8
9
10
# File 'lib/shipengine/domains/labels.rb', line 8

def initialize
  @client = ShipEngine::Client.new
end

Instance Method Details

#create_return_label(label_id:, params: {}) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/shipengine/domains/labels.rb', line 66

def create_return_label(label_id:, params: {})
  response = @client.post(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.root}/#{label_id}/return",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#label_by_external_shipment_id(shipment_id:, params: {}) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/shipengine/domains/labels.rb', line 30

def label_by_external_shipment_id(shipment_id:, params: {})
  response = @client.get(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.label_by_external_shipment_id}/#{shipment_id}",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#label_by_id(label_id:, params: {}) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/shipengine/domains/labels.rb', line 57

def label_by_id(label_id:, params: {})
  response = @client.get(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.root}/#{label_id}",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#label_tracking_information(label_id:, params: {}) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/shipengine/domains/labels.rb', line 75

def label_tracking_information(label_id:, params: {})
  response = @client.get(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.root}/#{label_id}/track",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#list_labels(params: {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/shipengine/domains/labels.rb', line 12

def list_labels(params: {})
  response = @client.get(
    path: ShipEngine::Constants::PATHS.v1.labels.root,
    options: params
  )

  Hashie::Mash.new(response.body)
end

#purchase_label(params: {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/shipengine/domains/labels.rb', line 21

def purchase_label(params: {})
  response = @client.post(
    path: ShipEngine::Constants::PATHS.v1.labels.root,
    options: params
  )

  Hashie::Mash.new(response.body)
end

#purchase_label_with_rate_id(rate_id:, params: {}) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/shipengine/domains/labels.rb', line 39

def purchase_label_with_rate_id(rate_id:, params: {})
  response = @client.post(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.purchase_label_with_rate_id}/#{rate_id}",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#purchase_label_with_shipment_id(shipment_id:, params: {}) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/shipengine/domains/labels.rb', line 48

def purchase_label_with_shipment_id(shipment_id:, params: {})
  response = @client.post(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.purchase_label_with_shipment_id}/#{shipment_id}",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#void_label_by_id(label_id:, params: {}) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/shipengine/domains/labels.rb', line 84

def void_label_by_id(label_id:, params: {})
  response = @client.put(
    path: "#{ShipEngine::Constants::PATHS.v1.labels.root}/#{label_id}/void",
    options: params
  )

  Hashie::Mash.new(response.body)
end