parametrized access
This commit is contained in:
@@ -14,11 +14,11 @@ require 'sendgrid-ruby'
|
||||
|
||||
Trello.configure do |config|
|
||||
# API key generated by visiting https://trello.com/1/appKey/generate
|
||||
config.developer_public_key = "f13dd6c2dcc65f48b9a56c6d420e32e7"
|
||||
config.developer_public_key = RibicaConfig::TRELLO_DEVELOPER_PUBLIC_KEY
|
||||
|
||||
# Member token
|
||||
# larry-price.com/blog/2014/03/18/connecting-to-the-trello-api/
|
||||
config.member_token = "e8e1885d794dbc4d9d8d1ae586a84e580be224b2737254de6064d7d7219f3064"
|
||||
config.member_token = RibicaConfig::TRELLO_MEMBER_TOKEN
|
||||
end
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/models/*.rb'].each {|file| require file }
|
||||
|
||||
@@ -10,3 +10,21 @@ ActiveRecord::Base.establish_connection(
|
||||
:database => db.path[1..-1],
|
||||
:encoding => 'utf8'
|
||||
)
|
||||
|
||||
|
||||
module RibicaConfig
|
||||
ROOT_ADDRESS = "https://ribica.ba"
|
||||
SENDGRID_API_USER = "ribica"
|
||||
SENDGRID_API_KEY = "(enter key here)"
|
||||
|
||||
BACKOFFICE_ORDER_EMAIL_TO = "narudzbe@ribica.ba"
|
||||
BACKOFFICE_ORDER_EMAIL_FROM = "draga@ribica.ba"
|
||||
BACKOFFICE_ORDER_EMAIL_FROM_NAME = "Prodavnica Ribica"
|
||||
|
||||
# API key generated by visiting https://trello.com/1/appKey/generate
|
||||
TRELLO_DEVELOPER_PUBLIC_KEY = "f13dd6c2dcc65f48b9a56c6d420e32e7"
|
||||
# Member token
|
||||
# larry-price.com/blog/2014/03/18/connecting-to-the-trello-api/
|
||||
TRELLO_MEMBER_TOKEN = "(enter token here)"
|
||||
TRELLO_BOARD_NAME = "FqDO1eFL"
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ post '/cart/delivery_destination', &update_delivery_destination
|
||||
def report_to_trello(cart)
|
||||
Thread.new do
|
||||
@cart = cart
|
||||
board = Trello::Board.find('FqDO1eFL')
|
||||
board = Trello::Board.find(RibicaConfig.TRELLO_BOARD_NAME)
|
||||
list = board.lists.first
|
||||
card = Trello::Card.new
|
||||
card.list_id = list.id
|
||||
@@ -71,16 +71,16 @@ end
|
||||
def send_order_email(cart)
|
||||
Thread.new do
|
||||
client = SendGrid::Client.new(
|
||||
api_user: "ribica",
|
||||
api_key: "plava*kutija*svjetlo*torba07"
|
||||
api_user: RibicaConfig.SENDGRID_API_USER,
|
||||
api_key: RibicaConfig.SENDGRID_API_KEY
|
||||
)
|
||||
|
||||
email = SendGrid::Mail.new do |m|
|
||||
m.to = "narudzbe@ribica.ba"
|
||||
m.from = "draga@ribica.ba"
|
||||
m.to = RibicaConfig.BACKOFFICE_ORDER_EMAIL_TO
|
||||
m.from = RibicaConfig.BACKOFFICE_ORDER_EMAIL_FROM
|
||||
m.from_name = "Prodavnica Ribica"
|
||||
m.subject = "Nova Narudžba: #{cart.id}"
|
||||
m.html = "Mušterija naručila nešto. <br /> Pogledati https://www.ribica.ba/backoffice/carts/#{cart.id}"
|
||||
m.html = "Mušterija naručila nešto. <br /> Pogledati #{RibicaConfig.ROOT_ADDRESS}/backoffice/carts/#{cart.id}"
|
||||
end
|
||||
client.send(email)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user