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