add token in lookups
This commit is contained in:
@@ -186,6 +186,7 @@ Add Kitchen Role of Employee
|
||||
|
||||
Add Base URL for DOEMAL
|
||||
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
|
||||
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
|
||||
|
||||
* ToDo list
|
||||
|
||||
|
||||
@@ -220,11 +220,14 @@ class OrderReservation < ApplicationRecord
|
||||
|
||||
def self.send_status_to_ordering(url,ref_no,status)
|
||||
base_url = 'https://api.doemal.com'
|
||||
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
|
||||
order_reservation = Lookup.collection_of("order_reservation")
|
||||
if !order_reservation.empty?
|
||||
order_reservation.each do |order_reserve|
|
||||
if order_reserve[0] == 'BaseURL'
|
||||
base_url = order_reserve[1]
|
||||
elsif order_reserve[0] == 'Token'
|
||||
token = order_reserve[1]
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -234,11 +237,12 @@ class OrderReservation < ApplicationRecord
|
||||
Rails.logger.debug "Doemal URL" + base_url
|
||||
post_url = base_url + url
|
||||
|
||||
|
||||
begin
|
||||
response = HTTParty.post(post_url,
|
||||
:body => { id: ref_no, status: status}.to_json,
|
||||
:headers => {
|
||||
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
|
||||
'Authorization' => 'Token token='+token,
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
}, :timeout => 10
|
||||
|
||||
Reference in New Issue
Block a user