Class: VividSeatApi::Fulfillment

Inherits:
Base
  • Object
show all
Defined in:
lib/vivid_seat_api/fulfillment.rb

Instance Method Summary collapse

Methods inherited from Base

#builder_options, #get_query_api, #initialize, #make_request_url, #post_query_api, #session, #to_query

Constructor Details

This class inherits a constructor from VividSeatApi::Base

Instance Method Details

#base_urlObject



3
4
5
6
7
8
9
# File 'lib/vivid_seat_api/fulfillment.rb', line 3

def base_url
  if sandboxed?
    "http://brokers-test.vividseats.com/webservices/v1/"
  else
    "https://brokers.vividseats.com/webservices/v1/"
  end
end

#confirm_order(options = {}) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/vivid_seat_api/fulfillment.rb', line 48

def confirm_order(options = {})
  transform!(post_query_api("confirmOrder", options)) do |xml|
    fields = %w(success message trackingNumber purchaseOrderId)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end

#download_airbill(options = {}) ⇒ Object



84
85
86
# File 'lib/vivid_seat_api/fulfillment.rb', line 84

def download_airbill(options = {})
  get_query_api("downloadAirbill", options)
end

#download_purchase_order(options = {}) ⇒ Object



97
98
99
# File 'lib/vivid_seat_api/fulfillment.rb', line 97

def download_purchase_order(options = {})
  get_query_api("downloadPurchaseOrder", options)
end

#get_airbill(options = {}) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/vivid_seat_api/fulfillment.rb', line 75

def get_airbill(options = {})
  transform!(get_query_api("getAirbill", options)) do |xml|
    fields = %w(success message trackingNumber airbillBase64String)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end

#get_completed_orders(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vivid_seat_api/fulfillment.rb', line 25

def get_completed_orders(options = {})
  transform!(get_query_api("getCompletedOrders", options)) do |doc|
    fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery mercuryOrderId purchaseOrderId)
    self.orders = []
    xml.xpath("//orders").each do |xml|
      order = OpenStruct.new
      fields.each do |attr|
        order.send("#{attr}=", xml.at_xpath(attr).content)
      end
      self.orders.push(listing)
    end
  end
end

#get_order(options = {}) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/vivid_seat_api/fulfillment.rb', line 39

def get_order(options = {})
  transform!(get_query_api("getOrder", options)) do |xml|
    fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery purchaseOrderId)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end

#get_orders(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vivid_seat_api/fulfillment.rb', line 11

def get_orders(options = {})
  transform!(get_query_api("getOrders", options)) do |doc|
    fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery mercuryOrderId purchaseOrderId)
    self.orders = []
    xml.xpath("//orders").each do |xml|
      order = OpenStruct.new
      fields.each do |attr|
        order.send("#{attr}=", xml.at_xpath(attr).content)
      end
      self.orders.push(listing)
    end
  end
end

#get_purchase_order(options = {}) ⇒ Object



88
89
90
91
92
93
94
95
# File 'lib/vivid_seat_api/fulfillment.rb', line 88

def get_purchase_order(options = {})
  transform!(get_query_api("getPurchaseOrder", options)) do |xml|
    fields = %w(success message purchaseOrderId poBase64String)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end

#reject_order(options = {}) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/vivid_seat_api/fulfillment.rb', line 66

def reject_order(options = {})
  transform!(post_query_api("rejectOrder", options)) do |xml|
    fields = %w(success message)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end

#ship_order(options = {}) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/vivid_seat_api/fulfillment.rb', line 57

def ship_order(options = {})
  transform!(post_query_api("shipOrder", options)) do |xml|
    fields = %w(success message trackingNumber airbillBase64String)
    fields.each do |attr|
      self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
    end
  end
end