Created
March 19, 2019 21:05
-
-
Save alessandrostein/02e703f5f136cc526c149dd2e7e5e42b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Get the lastes tickets | |
https://skybox.vividseats.com/services/tickets?lastUpdateFrom=2019-03-18 | |
## Get inventory sold | |
# Check if inventory exists (available) | |
https://skybox.vividseats.com/services/inventory/69822544 | |
# Check if inventory exists (sold) | |
https://skybox.vividseats.com/services/inventory/sold?inventoryId=69822544 | |
integration = Integration.last | |
service = SkyBox::Ticket.new(integration.api_key, integration.app_token) | |
response = service.last_updates("2019-03-18") | |
response.each do |r| | |
ticket = Ticket.find_by(external_id: r["id"]) | |
if ticket | |
if ticket.inventory.external_id == r["inventoryId"] | |
# just update the ticket | |
else | |
# create inventory and update ticket | |
end | |
else | |
# create inventory and create ticket | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment