rawgento_db 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe3b3478f240604d44d825c5e952cbbe7588b091
4
- data.tar.gz: fc9d252fab119300aa6df0fb2a187656be37dc8b
3
+ metadata.gz: c83957aeeb965ba0c52cb85ec1050676196a5606
4
+ data.tar.gz: bde063b48ba8338f06a4c3593032baebf360d25e
5
5
  SHA512:
6
- metadata.gz: 2e3c905bbb095ac98b5efdecdd17f674f8384724e0a67ee4b02b0ad7e286189abdfbd6281ffa26b132fa1b64cc22aec733f899a1a8126652d17dd368645834b2
7
- data.tar.gz: 3041a3b2dcc9779872f4766f29d66671cfc98989e035272c63480da44ab66eb0dc3a7bf29da366619911ea9e6c5a821ab00c30a75df88ebe523a4364790c6c28
6
+ metadata.gz: 240f5c485cfac378044b2cf7018117ebee914da9ef74ebff079d4500a03568b3742524615e2da3647a35c23d812b2b7dd34b72156764fc7bddbf0def860126aa
7
+ data.tar.gz: f33df13b5d0dea5b6e7da85082b6bb76243a8bcf613cc235666c032024b09650efe9d74d62dfc99a2d81df4087f9cd97fb7bec082be9a242a62ba04c025cb86d
data/README.md CHANGED
@@ -44,6 +44,8 @@ The first 5 keys define access to the mysql (magento) database.
44
44
  - `RawgentoDB::Query.attribute_varchar(attribute_id, settings)`: Returns array of [product_id, attribute_value] varchar-attribute-value information for all products.
45
45
  - `RawgentoDB::Query.attribute_option(attribute_id, settings)`: Returns array of [product_id, attribute_value] attribute-value of an option for all products.
46
46
 
47
+ All of these can optionally be called with a (second) parameter settings, which is the yaml parsed file. To initialize the settings, call `RawgentoDB.settings filename`.
48
+
47
49
 
48
50
  Furthermore, some command line applications are provided to get a view on the Shop through the eyes of the `rawgento_db` gem:
49
51
 
@@ -5,12 +5,12 @@ module RawgentoDB
5
5
  ProductQty = Struct.new(:product_id, :qty)
6
6
 
7
7
  class Query
8
- def self.client settings
8
+ def self.client settings=RawgentoDB.settings
9
9
  # Pick up a memoized settings?
10
10
  Mysql2::Client.new settings
11
11
  end
12
12
 
13
- def self.products settings
13
+ def self.products settings=RawgentoDB.settings
14
14
  # Unfortunately, name is an own attribute in different table.
15
15
  result = client(settings).query('SELECT entity_id '\
16
16
  'FROM catalog_product_entity')
@@ -19,7 +19,7 @@ module RawgentoDB
19
19
  end
20
20
  end
21
21
 
22
- def self.stock settings
22
+ def self.stock settings=RawgentoDB.settings
23
23
  result = client(settings).query('SELECT product_id, qty '\
24
24
  'FROM cataloginventory_stock_item ')
25
25
  result.map do |r|
@@ -27,7 +27,7 @@ module RawgentoDB
27
27
  end
28
28
  end
29
29
 
30
- def self.understocked settings
30
+ def self.understocked settings=RawgentoDB.settings
31
31
  results = client(settings).query(
32
32
  "SELECT product_id, qty, notify_stock_qty "\
33
33
  "FROM cataloginventory_stock_item "\
@@ -38,7 +38,7 @@ module RawgentoDB
38
38
  end
39
39
  end
40
40
 
41
- def self.sales_monthly product_id, settings
41
+ def self.sales_monthly product_id, settings=RawgentoDB.settings
42
42
  result = client(settings).query('SELECT * '\
43
43
  'FROM sales_bestsellers_aggregated_monthly '\
44
44
  ' WHERE product_id = %d ORDER BY period DESC' % product_id)
@@ -47,7 +47,7 @@ module RawgentoDB
47
47
  end
48
48
  end
49
49
 
50
- def self.sales_daily product_id, settings
50
+ def self.sales_daily product_id, settings=RawgentoDB.settings
51
51
  result = client(settings).query('SELECT * '\
52
52
  'FROM sales_bestsellers_aggregated_daily '\
53
53
  ' WHERE product_id = %d ORDER BY period DESC' % product_id)
@@ -56,7 +56,7 @@ module RawgentoDB
56
56
  end
57
57
  end
58
58
 
59
- def self.attribute_varchar attribute_id, settings
59
+ def self.attribute_varchar attribute_id, settings=RawgentoDB.settings
60
60
  result = client(settings).query("
61
61
  SELECT entity_id, value
62
62
  FROM catalog_product_entity_varchar
@@ -66,7 +66,7 @@ module RawgentoDB
66
66
  end
67
67
  end
68
68
 
69
- def self.attribute_option attribute_id, settings
69
+ def self.attribute_option attribute_id, settings=RawgentoDB.settings
70
70
  # Join
71
71
  result = client(settings).query("
72
72
  SELECT optchoice.entity_id, optval.value
@@ -1,3 +1,3 @@
1
1
  module RawgentoDB
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rawgento_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Wolfsteller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rawgento_models