Skip to content

Commit

Permalink
Finished GetStoreInfo
Browse files Browse the repository at this point in the history
I finsihed the function that tell us info about a specific. If I missed something about the info of a store please let me know in this pull comment. Thank you!
  • Loading branch information
vinidalvino committed Jan 30, 2020
1 parent c1ffb0d commit 9fc665a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ An library for ordering pizza from domino pizza on roblox
* [x] Figure out the endpoint
* [x] Write a library function
* Get info about a specific restaurant
* [ ] Figure out the endpoint
* [ ] Write a library function
* [x] Figure out the endpoint
* [x] Write a library function
* Get the menu for a restaurant
* [ ] Figure out the endpoint
* [ ] Write a library function
Expand Down
12 changes: 7 additions & 5 deletions src/ReplicatedStorage/DominoPizzaAPI/StoreLocator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function StoreLocator.StoreSearch(City,Province,PostalCode) -- Get all nearby st
assert(Province,'Missing argument : Province missing')
assert(PostalCode,'Missing argument : PostalCode missing')
local url = DominoURL.URL.Canada.StoreLocator .. City .. '%20' .. Province .. '%20' .. PostalCode
print(url)
local Data = HttpService:JSONDecode((HttpService:GetAsync(url)))
if Data.status == -104 then
error('You did not entered the store information correctly. Check if you entred the Address corretcly',2)
Expand All @@ -25,10 +24,13 @@ function StoreLocator.GetStoreInfo(City,Province,PostalCode,StoreID)
assert(Province,'Missing argument : Province missing')
assert(PostalCode,'Missing argument : PostalCode missing')
assert(StoreID,'Missing argument : StoreID missing')
local StoreIDSearch = table.find(StoreLocator.StoreSearch(City,Province,PostalCode,StoreID)
if StoreIDSearch == 1 then
print('Found!' .. '\n' .. StoreIDSearch)
end
local StoreNearBy = StoreLocator.StoreSearch(City,Province,PostalCode)
for i,v in pairs(StoreNearBy.Stores) do
if v.StoreID == StoreID then
return v
end
break
end
end

return StoreLocator

0 comments on commit 9fc665a

Please sign in to comment.