diff --git a/front-api/app.rb b/front-api/app.rb
index 85bcc47..5dbe1f8 100644
--- a/front-api/app.rb
+++ b/front-api/app.rb
@@ -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 }
diff --git a/front-api/config.rb.example b/front-api/config.rb.example
index b1b8bdf..ad209df 100644
--- a/front-api/config.rb.example
+++ b/front-api/config.rb.example
@@ -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
diff --git a/front-api/controllers/cart.rb b/front-api/controllers/cart.rb
index 7d554fc..f0a87dc 100644
--- a/front-api/controllers/cart.rb
+++ b/front-api/controllers/cart.rb
@@ -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.
Pogledati https://www.ribica.ba/backoffice/carts/#{cart.id}"
+ m.html = "Mušterija naručila nešto.
Pogledati #{RibicaConfig.ROOT_ADDRESS}/backoffice/carts/#{cart.id}"
end
client.send(email)
end