Class: TicketEvolution::Shipments

Inherits:
Endpoint show all
Includes:
Modules::Create, Modules::List, Modules::Show, Modules::Update
Defined in:
lib/ticket_evolution/shipments.rb

Constant Summary

Constants included from Endpoint::RequestHandler

Endpoint::RequestHandler::CODES

Instance Method Summary collapse

Methods included from Modules::Update

#build_for_update, included, #update

Methods included from Modules::Show

#build_for_show, #show

Methods included from Modules::List

#list, #raw

Methods included from Modules::Create

#build_for_create, #create

Methods inherited from Endpoint

#base_path, #connection, #endpoint_name, #has_connection?, #id, #initialize, #method_missing

Methods included from SingularClass

#singular_class

Methods included from Endpoint::RequestHandler

#build_request, #collection_handler, #naturalize_response, #raw_handler, #request, #upload_history_handler

Methods inherited from Base

#method_missing

Constructor Details

This class inherits a constructor from TicketEvolution::Endpoint

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TicketEvolution::Endpoint

Instance Method Details

#cancel_shipment(params = nil) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ticket_evolution/shipments.rb', line 48

def cancel_shipment(params = nil)
  ensure_id

  request(:PUT, "/cancel", nil) do |response|
    singular_class.new(response.body.merge({
      :status_code => response.response_code,
      :server_message => response.server_message,
      :connection => response.body[:connection]
    }))
  end
end

#deliver_shipment(params = nil) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ticket_evolution/shipments.rb', line 72

def deliver_shipment(params = nil)
  ensure_id

  request(:GET, "/deliver", nil) do |response|
    singular_class.new(response.body.merge({
      :status_code => response.response_code,
      :server_message => response.server_message,
      :connection => response.body[:connection]
    }))
  end
end

#email_airbill(params = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/ticket_evolution/shipments.rb', line 36

def email_airbill(params = nil)
  ensure_id
  request(:POST, "/email_airbill", params) do |response|
    singular_class.new(response.body.merge({
      :status_code => response.response_code,
      :server_message => response.server_message,
      :connection => response.body[:connection]
    }))
  end
end

#generate_airbill(params = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/ticket_evolution/shipments.rb', line 25

def generate_airbill(params = nil)
  ensure_id
  request(:POST, "/airbill", nil) do |response|
    singular_class.new(response.body.merge({
      :status_code => response.response_code,
      :server_message => response.server_message,
      :connection => response.body[:connection]
    }))
  end
end

#get_airbill(params = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ticket_evolution/shipments.rb', line 13

def get_airbill(params = {})
   ensure_id

   request(:GET, "/get_airbill", nil) do |response|
     singular_class.new(response.body.merge({
       :status_code => response.response_code,
       :server_message => response.server_message,
       :connection => response.body[:connection]
     }))
   end
end

#pend_shipment(params = nil) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ticket_evolution/shipments.rb', line 60

def pend_shipment(params = nil)
  ensure_id

  request(:GET, "/pend", nil) do |response|
    singular_class.new(response.body.merge({
      :status_code => response.response_code,
      :server_message => response.server_message,
      :connection => response.body[:connection]
    }))
  end
end

#status(params = {}) ⇒ Object



8
9
10
11
# File 'lib/ticket_evolution/shipments.rb', line 8

def status(params = {})
  handler ||= method(:collection_handler)
  request(:GET, '/status', params, &handler)
end

#suggestion(params, &handler) ⇒ Object



84
85
86
# File 'lib/ticket_evolution/shipments.rb', line 84

def suggestion(params, &handler)
  request(:POST, "/suggestion", params, &method(:raw_handler))
end