vivid_seat_api 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/Rakefile +62 -1
- data/lib/vivid_seat_api.rb +2 -8
- data/lib/vivid_seat_api/base.rb +45 -3
- data/lib/vivid_seat_api/fulfillment.rb +102 -0
- data/lib/vivid_seat_api/listing.rb +45 -0
- data/lib/vivid_seat_api/upload_filter.rb +26 -0
- data/lib/vivid_seat_api/version.rb +1 -1
- data/test/fulfillment_spec.rb +80 -0
- data/test/helper.rb +3 -0
- data/test/listing_spec.rb +127 -0
- data/vivid_seat_api.gemspec +1 -0
- metadata +45 -24
- data/lib/vivid_seat_api/client.rb +0 -7
- data/lib/vivid_seat_api/resource.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: a6f1ea4f20b8a5ea7530319538ccf9387c13eac8
|
4
|
+
data.tar.gz: b4c84cc207ca8e8781fda59fb5366ef501ca34fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6396c3f19a28d3aab33b06a6e9f41cc7cbbf581b108edafd8d263652126a239f4677e65be76387d42219e844d6e48fea7164675872140c56d7d54a3ac694caf
|
7
|
+
data.tar.gz: 7515d29f1852ccf1ac6e14c4caa7a4795ebd02a404ed76843273f1e73d603d7bbb3fa94c8484f18815f271ef02f5bcd146b9486bca271f6c559ca33d4257f599
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,63 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'faker'
|
4
|
+
require_relative "lib/vivid_seat_api"
|
5
|
+
|
6
|
+
task default: 'test'
|
7
|
+
|
8
|
+
Rake::TestTask.new do |t|
|
9
|
+
t.pattern = "test/*_spec.rb"
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Launch a console with the gem binding"
|
14
|
+
task :console do
|
15
|
+
exec 'irb -r vivid_seat_api -I ./lib'
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :seed do
|
19
|
+
SANDBOX_TOKEN = 'e4845f92-2610-4ca7-ae13-66015e27ec53'
|
20
|
+
DISCLAIMER_FOR_TEST = "Hashdog listing for test porpouses"
|
21
|
+
|
22
|
+
desc "Push an Inventory on sanbox"
|
23
|
+
task :new do
|
24
|
+
puts "Seeding for a new listing ..."
|
25
|
+
options = {
|
26
|
+
ticketId: rand(800000000..1100000000), # [String](Required) Your unique id associated with the listing.
|
27
|
+
eventName: "Hashdog - #{Faker::Name.name}", # [String](Required) The event Name.
|
28
|
+
venueName: Faker::Name.name, # [String](Required) The venue the event is taking place.
|
29
|
+
eventDateTime: Faker::Time.forward(30).strftime("%Y-%m-%d %T"), # [String](Required) The event date and time in yyyy-MM-dd HH:mm:ss format.
|
30
|
+
quantity: Faker::Number.digit, # [Integer](Required) The quantity of tickets available.
|
31
|
+
section: Faker::Commerce.department(1), # [String] (Required) The section of the listing.
|
32
|
+
row: Faker::Number.digit, # [String] (Required) The row of the listing.
|
33
|
+
price: Faker::Commerce.price.round(2), # [Double] (Required) The unit price of the listing.
|
34
|
+
seatFrom: nil, # [String] (Optional) The starting seat of the listing.
|
35
|
+
seatThru: nil, # [String] (Optional) The ending seat of the listing.
|
36
|
+
notes: DISCLAIMER_FOR_TEST, # [String] (Optional) Notes associated with the listing, displayed to buyres.
|
37
|
+
electronic: nil, # [Boolean] (Optional) Boolean indicating whether the tickets can be delivered electronically.
|
38
|
+
inHandDate: nil, # [String] (Optional) Date the listing can ship in yyyy-MM-dd format.
|
39
|
+
splitType: nil, # [TicketSplitType] (Optional) One of DEFAULT, ANY, or CUSTOM. Indicates how the listing can be split.
|
40
|
+
splitValue: nil # Comma-delimted split values if CUSTOM splitType is selected.
|
41
|
+
}
|
42
|
+
|
43
|
+
puts "Create a new listing for #{options[:eventName]} (#{options[:ticketId]} )"
|
44
|
+
client = VividSeatApi::Listing.new(SANDBOX_TOKEN, sandboxed: true)
|
45
|
+
doc = client.create(options.delete_if {|_,v|v.nil?})
|
46
|
+
puts doc.at_xpath("/response/message").content
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "List sandbox listing"
|
50
|
+
task :list do
|
51
|
+
client = VividSeatApi::Listing.new(SANDBOX_TOKEN, sandboxed: true)
|
52
|
+
puts client.list
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Show a sandbox listing"
|
56
|
+
task :show do
|
57
|
+
fail("You must provide LISTING_ID env variable") unless ENV["LISTING_ID"]
|
58
|
+
client = VividSeatApi::Listing.new(SANDBOX_TOKEN, sandboxed: true)
|
59
|
+
puts client.list(ticketId: ENV["LISTING_ID"])
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
2
63
|
|
data/lib/vivid_seat_api.rb
CHANGED
@@ -6,13 +6,7 @@ require 'nokogiri'
|
|
6
6
|
require_relative "vivid_seat_api/version"
|
7
7
|
require_relative "vivid_seat_api/response"
|
8
8
|
require_relative "vivid_seat_api/base"
|
9
|
-
require_relative "vivid_seat_api/
|
10
|
-
require_relative "vivid_seat_api/
|
9
|
+
require_relative "vivid_seat_api/listing"
|
10
|
+
require_relative "vivid_seat_api/fulfillment"
|
11
11
|
|
12
12
|
module VividSeatApi;end
|
13
|
-
|
14
|
-
client = VividSeatApi::Client.new("b6a56d39-abc2-4d9c-aa22-06e5632c2ef8")
|
15
|
-
|
16
|
-
|
17
|
-
puts client.create()
|
18
|
-
|
data/lib/vivid_seat_api/base.rb
CHANGED
@@ -1,7 +1,39 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
1
3
|
module VividSeatApi
|
4
|
+
|
5
|
+
CSV_FILENAME = "inventories.csv"
|
6
|
+
|
7
|
+
class BaseUrlMissing < NotImplementedError; end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :configuration
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configure
|
14
|
+
self.configuration ||= Configuration.new
|
15
|
+
yield(configuration)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure_required!
|
19
|
+
raise ArgumentError, "You must configure VividSeatApi" if VividSeatApi.configuration.instance_variables.size < 4
|
20
|
+
end
|
21
|
+
|
22
|
+
class Configuration
|
23
|
+
attr_accessor :ftp_host
|
24
|
+
attr_accessor :ftp_user
|
25
|
+
attr_accessor :ftp_pass
|
26
|
+
attr_accessor :api_token
|
27
|
+
end
|
28
|
+
|
2
29
|
class Base
|
30
|
+
|
31
|
+
def initialize(options={})
|
32
|
+
@sandboxed = options.fetch(:sandboxed, false)
|
33
|
+
end
|
34
|
+
|
3
35
|
def base_url
|
4
|
-
"https://brokers.vividseats.com/webservices/listings/v1/"
|
36
|
+
raise BaseUrlMissing, "#{self}.fetch not implemented" #"https://brokers.vividseats.com/webservices/listings/v1/"
|
5
37
|
end
|
6
38
|
|
7
39
|
def make_request_url url, options
|
@@ -9,12 +41,11 @@ module VividSeatApi
|
|
9
41
|
end
|
10
42
|
|
11
43
|
def builder_options options
|
12
|
-
options.merge!(apiToken:
|
44
|
+
options.merge!(apiToken: VividSeatApi.configuration.api_token)
|
13
45
|
to_query(options)
|
14
46
|
end
|
15
47
|
|
16
48
|
def get_query_api url, options
|
17
|
-
puts make_request_url(url, options)
|
18
49
|
session.get(make_request_url(url, options)).body
|
19
50
|
end
|
20
51
|
|
@@ -34,5 +65,16 @@ module VividSeatApi
|
|
34
65
|
end
|
35
66
|
end
|
36
67
|
|
68
|
+
protected
|
69
|
+
|
70
|
+
def sandboxed?
|
71
|
+
!!@sandboxed
|
72
|
+
end
|
73
|
+
|
74
|
+
def transform!(doc, &block)
|
75
|
+
result = ::OpenStruct.new
|
76
|
+
result.instance_exec doc, &block
|
77
|
+
result
|
78
|
+
end
|
37
79
|
end
|
38
80
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module VividSeatApi
|
2
|
+
class Fulfillment < Base
|
3
|
+
def base_url
|
4
|
+
if sandboxed?
|
5
|
+
"http://brokers-test.vividseats.com/webservices/v1/"
|
6
|
+
else
|
7
|
+
"https://brokers.vividseats.com/webservices/v1/"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_orders(options = {})
|
12
|
+
transform!(get_query_api("getOrders", options)) do |doc|
|
13
|
+
fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery mercuryOrderId purchaseOrderId)
|
14
|
+
self.orders = []
|
15
|
+
xml.xpath("//orders").each do |xml|
|
16
|
+
order = OpenStruct.new
|
17
|
+
fields.each do |attr|
|
18
|
+
order.send("#{attr}=", xml.at_xpath(attr).content)
|
19
|
+
end
|
20
|
+
self.orders.push(listing)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_completed_orders(options = {})
|
26
|
+
transform!(get_query_api("getCompletedOrders", options)) do |doc|
|
27
|
+
fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery mercuryOrderId purchaseOrderId)
|
28
|
+
self.orders = []
|
29
|
+
xml.xpath("//orders").each do |xml|
|
30
|
+
order = OpenStruct.new
|
31
|
+
fields.each do |attr|
|
32
|
+
order.send("#{attr}=", xml.at_xpath(attr).content)
|
33
|
+
end
|
34
|
+
self.orders.push(listing)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_order(options = {})
|
41
|
+
transform!(get_query_api("getOrder", options)) do |xml|
|
42
|
+
fields = %w(orderId orderToken brokerTicketId section row notes quantity cost event venue eventDate electronicDelivery purchaseOrderId)
|
43
|
+
fields.each do |attr|
|
44
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def confirm_order(options = {})
|
50
|
+
transform!(post_query_api("confirmOrder", options)) do |xml|
|
51
|
+
fields = %w(success message trackingNumber purchaseOrderId)
|
52
|
+
fields.each do |attr|
|
53
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def ship_order(options = {})
|
59
|
+
transform!(post_query_api("shipOrder", options)) do |xml|
|
60
|
+
fields = %w(success message trackingNumber airbillBase64String)
|
61
|
+
fields.each do |attr|
|
62
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def reject_order(options = {})
|
68
|
+
transform!(post_query_api("rejectOrder", options)) do |xml|
|
69
|
+
fields = %w(success message)
|
70
|
+
fields.each do |attr|
|
71
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_airbill(options = {})
|
77
|
+
transform!(get_query_api("getAirbill", options)) do |xml|
|
78
|
+
fields = %w(success message trackingNumber airbillBase64String)
|
79
|
+
fields.each do |attr|
|
80
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def download_airbill(options = {})
|
86
|
+
get_query_api("downloadAirbill", options)
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_purchase_order(options = {})
|
90
|
+
transform!(get_query_api("getPurchaseOrder", options)) do |xml|
|
91
|
+
fields = %w(success message purchaseOrderId poBase64String)
|
92
|
+
fields.each do |attr|
|
93
|
+
self.send("#{attr}=", xml.at_xpath("//#{attr}").content)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def download_purchase_order(options = {})
|
99
|
+
get_query_api("downloadPurchaseOrder", options)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative "upload_filter"
|
2
|
+
require "net/ftp"
|
3
|
+
require "tempfile"
|
4
|
+
|
5
|
+
module VividSeatApi
|
6
|
+
class PublishError < ArgumentError
|
7
|
+
attr_reader :errors
|
8
|
+
|
9
|
+
def initialize(erros)
|
10
|
+
@errors = errors
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Listing
|
15
|
+
extend self
|
16
|
+
|
17
|
+
def publish(records)
|
18
|
+
VividSeatApi.configure_required!
|
19
|
+
record_with_errors = records.detect{|record| !UploadFilter.new(attrs).valid?}
|
20
|
+
if record_with_errors
|
21
|
+
uploader = UploadFilter.new(record_with_errors)
|
22
|
+
raise PublishError.new(uploader.errors), "Invalid params" unless uploader.valid?
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
file = Tempfile.new("TicketMonsterApi")
|
27
|
+
file.write("#{UploadFilter::FIELDS.join(",")}\n")
|
28
|
+
records.each do |record|
|
29
|
+
ordered_values = UploadFilter::FIELDS.map do |field|
|
30
|
+
record[field]
|
31
|
+
end
|
32
|
+
file.write("#{ordered_values.join(",")}\n")
|
33
|
+
end
|
34
|
+
file.flush
|
35
|
+
Net::FTP.open(VividSeatApi.configuration.ftp_host) do |ftp|
|
36
|
+
ftp.passive = true
|
37
|
+
ftp.login(VividSeatApi.configuration.ftp_user, VividSeatApi.configuration.ftp_pass)
|
38
|
+
ftp.putbinaryfile(file.path, "#{VividSeatApi::CSV_FILENAME}")
|
39
|
+
end
|
40
|
+
ensure
|
41
|
+
file.close!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'scrivener'
|
2
|
+
|
3
|
+
module VividSeatApi
|
4
|
+
class UploadFilter < Scrivener
|
5
|
+
FIELDS = [
|
6
|
+
:Event,
|
7
|
+
:Venue,
|
8
|
+
:EventDate,
|
9
|
+
:EventTime,
|
10
|
+
:Quantity,
|
11
|
+
:Section,
|
12
|
+
:Row,
|
13
|
+
:SeatFrom,
|
14
|
+
:SeatThru,
|
15
|
+
:Notes,
|
16
|
+
:Cost,
|
17
|
+
:TicketID,
|
18
|
+
:Edelivery_ind,
|
19
|
+
:InHandDate
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
FIELDS.each do |attribute|
|
23
|
+
attr_accessor attribute
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
describe "Fulfillment" do
|
5
|
+
let(:fake_token){"31f502d-801c-4bd6-ac53-a8e0f68bdede"}
|
6
|
+
|
7
|
+
let(:default_headers) do
|
8
|
+
{"Content-Type" => "application/xml; charset=UTF-8"}
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:http_success_code){200}
|
12
|
+
|
13
|
+
let(:get_orders_response) do
|
14
|
+
<<-EOF
|
15
|
+
<orders>
|
16
|
+
<order>
|
17
|
+
<brokerTicketId>4762069</brokerTicketId>
|
18
|
+
<cost>127.85</cost>
|
19
|
+
<event>Chicago Blackhawks vs. Anaheim Ducks</event>
|
20
|
+
<orderId>296275</orderId>
|
21
|
+
<orderToken>aecc0c52-f5a1-4684-ade2-063b6c9e91f5</orderToken>
|
22
|
+
<quantity>2</quantity>
|
23
|
+
<row>5</row>
|
24
|
+
<section>301</section>
|
25
|
+
<status>UNCONFIRMED</status>
|
26
|
+
<venue>United Center - Chicago, IL</venue>
|
27
|
+
</order>
|
28
|
+
<order>
|
29
|
+
<brokerTicketId>4359430</brokerTicketId>
|
30
|
+
<cost>231.95</cost>
|
31
|
+
<event>Philadelphia 76ers at Miami Heat</event>
|
32
|
+
<orderId>296304</orderId>
|
33
|
+
<orderToken>73439cd8-73ea-48f4-aae4-030d209b85d2</orderToken>
|
34
|
+
<quantity>1</quantity>
|
35
|
+
<row>5</row>
|
36
|
+
<section>121</section>
|
37
|
+
<status>UNCONFIRMED</status>
|
38
|
+
<venue>American Airlines Arena - FL - Miami, FL</venue>
|
39
|
+
</order>
|
40
|
+
</orders>
|
41
|
+
EOF
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:success_response) do
|
45
|
+
<<-EOF
|
46
|
+
<response>
|
47
|
+
<success>true</success>
|
48
|
+
<message>Success.</message>
|
49
|
+
</response>
|
50
|
+
EOF
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:http_connection) {
|
54
|
+
Faraday.new do |builder|
|
55
|
+
builder.use Faraday::Response::VividSeat
|
56
|
+
builder.adapter :test, http_stubs
|
57
|
+
end
|
58
|
+
}
|
59
|
+
|
60
|
+
let(:http_stubs) { Faraday::Adapter::Test::Stubs.new }
|
61
|
+
|
62
|
+
let(:client) do
|
63
|
+
fetcher = VividSeatApi::Fulfillment.new(fake_token, sandboxed: true)
|
64
|
+
fetcher.instance_variable_set(:@connection, http_connection)
|
65
|
+
fetcher
|
66
|
+
end
|
67
|
+
|
68
|
+
let(:verify_stubbings){true}
|
69
|
+
|
70
|
+
it "Get orders" do
|
71
|
+
http_stubs.get("/getOrders?apiToken=#{fake_token}") {[http_success_code, default_headers, get_orders_response]}
|
72
|
+
|
73
|
+
doc = client.get_orders
|
74
|
+
|
75
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
76
|
+
assert_equal 2, doc.xpath("//order").size
|
77
|
+
assert_equal "127.85", doc.at_xpath("/orders/order/cost").content
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
describe "Listing" do
|
5
|
+
let(:fake_token){"31f502d-801c-4bd6-ac53-a8e0f68bdede"}
|
6
|
+
|
7
|
+
let(:default_headers) do
|
8
|
+
{"Content-Type" => "application/xml; charset=UTF-8"}
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:http_success_code){200}
|
12
|
+
|
13
|
+
let(:listing_response) do
|
14
|
+
<<-EOF
|
15
|
+
<brokerListings>
|
16
|
+
<brokerListing>
|
17
|
+
<electronic>false</electronic>
|
18
|
+
<id>201572363</id>
|
19
|
+
<inHandDate>2012-04-25T00:00:00-05:00</inHandDate>
|
20
|
+
<notes/>
|
21
|
+
<price>2.00</price>
|
22
|
+
<quantity>4</quantity>
|
23
|
+
<row>P</row>
|
24
|
+
<seatFrom/>
|
25
|
+
<seatThru/>
|
26
|
+
<section>503</section>
|
27
|
+
<splitType>DEFAULT</splitType>
|
28
|
+
<splitValue/>
|
29
|
+
<ticketId>492632</ticketId>
|
30
|
+
</brokerListing>
|
31
|
+
</brokerListings>
|
32
|
+
EOF
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:success_response) do
|
36
|
+
<<-EOF
|
37
|
+
<response>
|
38
|
+
<success>true</success>
|
39
|
+
<message>Success.</message>
|
40
|
+
</response>
|
41
|
+
EOF
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:http_connection) {
|
45
|
+
Faraday.new do |builder|
|
46
|
+
builder.use Faraday::Response::VividSeat
|
47
|
+
builder.adapter :test, http_stubs
|
48
|
+
end
|
49
|
+
}
|
50
|
+
|
51
|
+
let(:http_stubs) { Faraday::Adapter::Test::Stubs.new }
|
52
|
+
|
53
|
+
let(:client) do
|
54
|
+
fetcher = VividSeatApi::Listing.new(fake_token, sandboxed: true)
|
55
|
+
fetcher.instance_variable_set(:@connection, http_connection)
|
56
|
+
fetcher
|
57
|
+
end
|
58
|
+
|
59
|
+
let(:verify_stubbings){true}
|
60
|
+
|
61
|
+
it "listing" do
|
62
|
+
http_stubs.get("/getListings?apiToken=#{fake_token}") {[http_success_code, default_headers, listing_response]}
|
63
|
+
|
64
|
+
doc = client.get_listings
|
65
|
+
|
66
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
67
|
+
assert_equal 1, doc.xpath("//brokerListing").size
|
68
|
+
assert_equal "492632", doc.at_xpath("/brokerListings/brokerListing/ticketId").content
|
69
|
+
end
|
70
|
+
|
71
|
+
it "update" do
|
72
|
+
http_stubs.post("/updateListing?apiToken=#{fake_token}§ion=504") {[http_success_code, default_headers, success_response]}
|
73
|
+
|
74
|
+
doc = client.update_listing(section: 504)
|
75
|
+
|
76
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
77
|
+
assert_equal "true", doc.at_xpath("/response/success").content
|
78
|
+
end
|
79
|
+
|
80
|
+
it "delete" do
|
81
|
+
http_stubs.post("/deleteListing?apiToken=#{fake_token}&ticketId=201572363") {[http_success_code, default_headers, success_response]}
|
82
|
+
|
83
|
+
doc = client.delete_listing(ticketId: 201572363)
|
84
|
+
|
85
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
86
|
+
assert_equal "true", doc.at_xpath("/response/success").content
|
87
|
+
end
|
88
|
+
|
89
|
+
it "insert_listing" do
|
90
|
+
http_stubs.post("/insertListing?apiToken=#{fake_token}§ion=504") {[http_success_code, default_headers, success_response]}
|
91
|
+
|
92
|
+
attrs = {
|
93
|
+
ticketId: 201572363,
|
94
|
+
eventName: "Sample event",
|
95
|
+
venueName: "Sample venue",
|
96
|
+
eventDateTime: Time.now.iso8601,
|
97
|
+
quantity: 4,
|
98
|
+
section: 504,
|
99
|
+
row: 4,
|
100
|
+
price: 80.49
|
101
|
+
}
|
102
|
+
doc = client.insert_listing(attrs)
|
103
|
+
|
104
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
105
|
+
assert_equal "true", doc.at_xpath("/response/success").content
|
106
|
+
end
|
107
|
+
|
108
|
+
it "insert or update" do
|
109
|
+
http_stubs.post("/insertOrUpdateListing?apiToken=#{fake_token}§ion=504") {[http_success_code, default_headers, success_response]}
|
110
|
+
|
111
|
+
attrs = {
|
112
|
+
ticketId: 201572363,
|
113
|
+
eventName: "Sample event",
|
114
|
+
venueName: "Sample venue",
|
115
|
+
eventDateTime: Time.now.iso8601,
|
116
|
+
quantity: 4,
|
117
|
+
section: 504,
|
118
|
+
row: 4,
|
119
|
+
price: 80.49
|
120
|
+
}
|
121
|
+
doc = client.insert_or_update_listing(attrs)
|
122
|
+
|
123
|
+
http_stubs.verify_stubbed_calls if verify_stubbings
|
124
|
+
assert_equal "true", doc.at_xpath("/response/success").content
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
data/vivid_seat_api.gemspec
CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency 'faraday', '~> 0.9', '>= 0.9.0'
|
24
24
|
spec.add_runtime_dependency 'json', '~> 1.8.1', '>= 1.8.1'
|
25
25
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6.1', '>= 1.6.1'
|
26
|
+
spec.add_dependency 'scrivener', '0.3.0'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,103 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vivid_seat_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chebyte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.9'
|
48
|
-
- -
|
48
|
+
- - ! '>='
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 0.9.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ~>
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0.9'
|
58
|
-
- -
|
58
|
+
- - ! '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 0.9.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: json
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 1.8.1
|
68
|
-
- -
|
68
|
+
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 1.8.1
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 1.8.1
|
78
|
-
- -
|
78
|
+
- - ! '>='
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: 1.8.1
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: nokogiri
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ~>
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: 1.6.1
|
88
|
-
- -
|
88
|
+
- - ! '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 1.6.1
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 1.6.1
|
98
|
-
- -
|
98
|
+
- - ! '>='
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: 1.6.1
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: scrivener
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - '='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 0.3.0
|
108
|
+
type: :runtime
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 0.3.0
|
101
115
|
description: This gem provides access to add, edit and delete listings appearing on
|
102
116
|
Vivid Seats and it’s affiliates.
|
103
117
|
email:
|
@@ -106,17 +120,21 @@ executables: []
|
|
106
120
|
extensions: []
|
107
121
|
extra_rdoc_files: []
|
108
122
|
files:
|
109
|
-
-
|
123
|
+
- .gitignore
|
110
124
|
- Gemfile
|
111
125
|
- LICENSE.txt
|
112
126
|
- README.md
|
113
127
|
- Rakefile
|
114
128
|
- lib/vivid_seat_api.rb
|
115
129
|
- lib/vivid_seat_api/base.rb
|
116
|
-
- lib/vivid_seat_api/
|
117
|
-
- lib/vivid_seat_api/
|
130
|
+
- lib/vivid_seat_api/fulfillment.rb
|
131
|
+
- lib/vivid_seat_api/listing.rb
|
118
132
|
- lib/vivid_seat_api/response.rb
|
133
|
+
- lib/vivid_seat_api/upload_filter.rb
|
119
134
|
- lib/vivid_seat_api/version.rb
|
135
|
+
- test/fulfillment_spec.rb
|
136
|
+
- test/helper.rb
|
137
|
+
- test/listing_spec.rb
|
120
138
|
- vivid_seat_api.gemspec
|
121
139
|
homepage: http://hashdog.com
|
122
140
|
licenses:
|
@@ -128,12 +146,12 @@ require_paths:
|
|
128
146
|
- lib
|
129
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
148
|
requirements:
|
131
|
-
- -
|
149
|
+
- - ! '>='
|
132
150
|
- !ruby/object:Gem::Version
|
133
151
|
version: '0'
|
134
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
153
|
requirements:
|
136
|
-
- -
|
154
|
+
- - ! '>='
|
137
155
|
- !ruby/object:Gem::Version
|
138
156
|
version: '0'
|
139
157
|
requirements: []
|
@@ -142,4 +160,7 @@ rubygems_version: 2.2.2
|
|
142
160
|
signing_key:
|
143
161
|
specification_version: 4
|
144
162
|
summary: Ruby Gem API for vividseats.com.
|
145
|
-
test_files:
|
163
|
+
test_files:
|
164
|
+
- test/fulfillment_spec.rb
|
165
|
+
- test/helper.rb
|
166
|
+
- test/listing_spec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module VividSeatApi
|
2
|
-
class Resource < Base
|
3
|
-
def list(options = {})
|
4
|
-
get_query_api("getListings", options)
|
5
|
-
end
|
6
|
-
|
7
|
-
def update(options = {})
|
8
|
-
post_query_api("updateListing", options)
|
9
|
-
end
|
10
|
-
|
11
|
-
def delete(options = {})
|
12
|
-
get_query_api("deleteListing", options)
|
13
|
-
end
|
14
|
-
|
15
|
-
def create(options = {})
|
16
|
-
post_query_api("insertListing", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def insert_or_update(options = {})
|
20
|
-
post_query_api("insertOrUpdateListing", options)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|