Module: Rawbotz
- Included in:
- RawbotzApp::Routing::Products
- Defined in:
- lib/rawbotz/routes.rb,
lib/rawbotz.rb,
lib/rawbotz/version.rb,
lib/rawbotz/datapolate.rb,
lib/rawbotz/local_shop.rb,
lib/rawbotz/sales_data.rb,
lib/rawbotz/remote_shop.rb,
lib/rawbotz/models/sales.rb,
lib/rawbotz/models/stock.rb,
lib/rawbotz/mail_template.rb,
lib/rawbotz/option_parser.rb,
lib/rawbotz/chart_month_dataset.rb,
lib/rawbotz/helpers/icon_helper.rb,
lib/rawbotz/helpers/flash_helper.rb,
lib/rawbotz/models/stock_product.rb,
lib/rawbotz/helpers/format_helper.rb,
lib/rawbotz/processors/order_linker.rb,
lib/rawbotz/processors/order_processor.rb,
lib/rawbotz/processors/product_updater.rb,
lib/rawbotz/processors/stock_processor.rb,
lib/rawbotz/helpers/resource_link_helper.rb,
lib/rawbotz/models/stock_product_factory.rb,
lib/rawbotz/helpers/order_item_color_helper.rb,
lib/rawbotz/processors/organic_product_deliveries_csv.rb
Overview
define Rawbotz::RawbotzApp::Routing
Defined Under Namespace
Modules: CLI, Datapolate, Helpers, LocalShop, MailTemplate, Models, RawbotzApp, RemoteShop, SalesData
Classes: ChartMonthDataset, OptionParser, OrderLinker, OrderProcessor, OrganicProductDeliveriesCSV, ProductUpdater, StockProcessor
Constant Summary
collapse
- VERSION =
"0.2.0".freeze
- @@conf_file_path =
nil
Class Method Summary
collapse
Class Method Details
.attribute_ids ⇒ Object
12
13
14
|
# File 'lib/rawbotz/remote_shop.rb', line 12
def self.attribute_ids
@@attribute_ids ||= (YAML.load_file Rawbotz.conf_file_path)["attribute_ids"]
end
|
.conf_file_path ⇒ Object
32
33
34
|
# File 'lib/rawbotz.rb', line 32
def self.conf_file_path
@@conf_file_path
end
|
.conf_file_path=(conf_file_path) ⇒ Object
29
30
31
|
# File 'lib/rawbotz.rb', line 29
def self.conf_file_path=(conf_file_path)
@@conf_file_path = conf_file_path
end
|
Configure components (from config file path), exit 1 if fails. ‘logs’ to STDERR (TODO)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rawbotz.rb', line 38
def self.configure!
begin
RawgentoModels.establish_connection @@conf_file_path
rescue
STDERR.puts "Could not establish rawbotz-database connection (read config from: #{@@conf_file_path})"
exit 1
end
begin
RawgentoDB.settings @@conf_file_path
rescue
STDERR.puts "Could not establish magento-database connection (read config from: #{@@conf_file_path})"
exit 1
end
end
|
60
61
62
|
# File 'lib/rawbotz.rb', line 60
def self.configure_logger options
logger.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
end
|
.logger ⇒ Object
54
55
56
|
# File 'lib/rawbotz.rb', line 54
def self.logger
@logger ||= Logger.new(STDOUT)
end
|
.logger=(logger) ⇒ Object
57
58
59
|
# File 'lib/rawbotz.rb', line 57
def self.logger= logger
@logger = logger
end
|
.mail(subject, body) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/rawbotz.rb', line 69
def self.mail subject, body
settings = YAML::load_file(Rawbotz::conf_file_path)["mail"]
pony_via_options = { address: settings["host"],
user_name: settings["user"],
port: settings["port"].to_i,
authentication: :login,
password: settings["pass"]}
Pony.mail({
to: settings["to"],
from: settings["from"],
subject: subject,
body: body,
via: :smtp,
via_options: pony_via_options
})
end
|
.mech ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/rawbotz/remote_shop.rb', line 4
def self.mech
settings = (YAML.load_file Rawbotz.conf_file_path)["remote_shop"]
mech = MagentoMech.new settings["base_uri"]
mech.pass = settings["pass"]
mech.user = settings["user"]
mech.login
mech
end
|
.new_mech ⇒ Object
64
65
66
67
|
# File 'lib/rawbotz.rb', line 64
def self.new_mech
config_values = YAML::load_file(@@conf_file_path)["remote_shop"]
MagentoMech.from_config OpenStruct.new(config_values)
end
|