Class: StubHubApi::Fulfillment
- Inherits:
-
Base
- Object
- Base
- StubHubApi::Fulfillment
show all
- Defined in:
- lib/stub_hub_api/fulfillment.rb
Instance Attribute Summary
Attributes inherited from Base
#sandbox, #token
Instance Method Summary
collapse
Methods inherited from Base
#delete_query_api, #get_query_api, #initialize, #post_multi_part_query_api, #post_multi_pdfs_json_query_api, #post_query_api, #put_query_api
Instance Method Details
#confirm_transfer_sales(sale_id) ⇒ Object
58
59
60
|
# File 'lib/stub_hub_api/fulfillment.rb', line 58
def confirm_transfer_sales(sale_id)
post_query_api("/fulfillment/delivery/v1/sale/#{sale_id}/confirmation", false)
end
|
#get_label_for(options) ⇒ Object
54
55
56
|
# File 'lib/stub_hub_api/fulfillment.rb', line 54
def get_label_for(options)
get_query_api("/fulfillment/shipping/v1/labels", options)
end
|
#label_for(options) ⇒ Object
49
50
51
|
# File 'lib/stub_hub_api/fulfillment.rb', line 49
def label_for(options)
post_query_api("/fulfillment/shipping/v1/labels", true, options)
end
|
#preload_pdf(file, listing_id, options) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/stub_hub_api/fulfillment.rb', line 15
def preload_pdf(file, listing_id, options)
doc = post_multi_part_query_api("/fulfillment/pdf/v1/listing/#{listing_id}", options, StringIO.new(Base64.decode64(file)))
fields = %w(listingId row seatNo uploadStatus preDelivered)
response = {}
doc.xpath("uploadPDFTicketToListingResponse").each do |xml|
fields.each do |field|
response[field] = xml.at_xpath(field).content if xml.at_xpath(field).content
end
end
response
end
|
#preload_pdf_json(listing_id, options, files) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/stub_hub_api/fulfillment.rb', line 27
def preload_pdf_json(listing_id, options, files)
boundary = "------WebKitFormBoundary7MA4YWxkTrZu0gW"
post_body = ""
post_body << "#{boundary}\r\n"
post_body << "Content-Disposition: form-data; name=\"listing\"\r\n\r\n"
post_body << "#{options.to_json}\r\n"
files.each do |file|
post_body << "#{boundary}\r\n"
post_body << "Content-Disposition: form-data; name=\"#{file[:file_name]}\"; filename=\"#{file[:file_name]}.pdf\"\r\n"
post_body << "Content-Type: application/pdf\r\n\r\n"
post_body << ""
post_body << ""
post_body << File.read(file[:file])
post_body << ""
post_body << "\r\n"
end
post_body << "\r\n"
post_body << "#{boundary}--\r\n"
post_multi_pdfs_json_query_api("/inventory/listings/v1/#{listing_id}/pdfs", post_body)
end
|
#upload_barcode(options) ⇒ Object
62
63
64
|
# File 'lib/stub_hub_api/fulfillment.rb', line 62
def upload_barcode(options)
post_query_api("/fulfillment/barcode/v1/order", true, options)
end
|
#upload_pdf(file, sale_id, options) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/stub_hub_api/fulfillment.rb', line 3
def upload_pdf(file, sale_id, options)
doc = post_multi_part_query_api("/fulfillment/pdf/v1/sale/#{sale_id}", options, StringIO.new(Base64.decode64(file)))
fields = %w(orderId row seatNo uploadStatus delivered)
response = {}
doc.xpath("uploadPDFTicketToOrderResponse").each do |xml|
fields.each do |field|
response[field] = xml.at_xpath(field).content if xml.at_xpath(field).content
end
end
response
end
|