directiverecord 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beaaac82f30ff3e1c16a7c5844497500badcbbdb
4
- data.tar.gz: 60eb917a702a908c1ac2930b805d8ab68758603b
3
+ metadata.gz: 15593ea42289ab19de5a5b3d79a4a73a3c1b26bc
4
+ data.tar.gz: 5c54c1040ccbf78cff3c4bd86c176b4b8966ff96
5
5
  SHA512:
6
- metadata.gz: de73729b955fe0d5df7e026b413fd4a425bd6f28232bd0ecc6c46bea53bdf52db0603e62dc62d0e6ee4b5ac4d1024efb40dfd5023727b3dfc55820f1418cf3b9
7
- data.tar.gz: 981c5d1921382b87d20fc6f62293b6dbc62f20e05d0c92c7ce26b09844878ff664671486c4d1fa592a577b9931a42e4e4c4672c187989b170c419e0b1462f9a7
6
+ metadata.gz: c79a81ea790365f31a76c1b3528d4537e3ee0c4646033406ff1c9b195239d33aef03a7134cee50336fbb37ddc86fc60b59749b01db24d76cb1b2069b1e9064ae
7
+ data.tar.gz: 80d924a264d36962941a8994d691f28331c71d5b8e90879e127d4dddeebfdbea54f20179fae09acb675da2cb5c22b0ff7efbe165b404d7170d472e0164b9daae
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = DirectiveRecord CHANGELOG
2
2
 
3
+ == Version 0.1.24 (April 20, 2015)
4
+
5
+ * Properly getting BigQuery dataset from options
6
+
3
7
  == Version 0.1.23 (April 9, 2015)
4
8
 
5
9
  * Extracted ActiveRecord::Relation#count override to separate (non-auto-required) source file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.23
1
+ 0.1.24
@@ -18,8 +18,7 @@ module DirectiveRecord
18
18
  begin_date, end_date = $1, $2
19
19
  end
20
20
  if begin_date
21
- dataset = ::BigQuery.connection.instance_variable_get(:@dataset) # TODO: fix this
22
- options[:from] = "\n TABLE_DATE_RANGE(#{dataset}.#{base.table_name}_, TIMESTAMP('#{begin_date}'), TIMESTAMP('#{end_date}'))"
21
+ options[:from] = "\n TABLE_DATE_RANGE(#{options[:dataset]}.#{base.table_name}_, TIMESTAMP('#{begin_date}'), TIMESTAMP('#{end_date}'))"
23
22
  end
24
23
  end
25
24
  end
@@ -87,7 +87,7 @@ SQL
87
87
  end
88
88
 
89
89
  def validate_options!(options)
90
- options.assert_valid_keys :connection, :select, :subselect, :where, :ignore_where, :group_by, :order_by, :limit, :offset, :aggregates, :numerize_aliases, :period, :optimize
90
+ options.assert_valid_keys :connection, :select, :subselect, :where, :ignore_where, :group_by, :order_by, :limit, :offset, :aggregates, :numerize_aliases, :dataset, :period, :optimize
91
91
  end
92
92
 
93
93
  def optimize_query!(options)
@@ -1,7 +1,7 @@
1
1
  module DirectiveRecord
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 23
4
+ TINY = 24
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require_relative "../../test_helper"
2
2
 
3
- module BigQuery
4
- class Client
3
+ module Google
4
+ class BigQuery
5
5
  end
6
6
  end
7
7
 
@@ -11,8 +11,8 @@ module Unit
11
11
 
12
12
  describe DirectiveRecord::Query::BigQuery do
13
13
  before do
14
- (connection = BigQuery::Client.new).instance_variable_set(:@dataset, "my_stats")
15
- BigQuery.expects(:connection).returns(connection).at_least_once
14
+ connection = Google::BigQuery.new
15
+ Google::BigQuery.expects(:connection).returns(connection).at_least_once
16
16
  end
17
17
 
18
18
  it "generates the expected SQL" do
@@ -29,10 +29,11 @@ module Unit
29
29
  }.strip.gsub(/\s+/, " "),
30
30
  Order.to_qry(
31
31
  "id", "order_details_quantity_ordered", "order_details_price_each", "SUM(order_details_quantity_ordered * order_details_price_each) AS price",
32
- :connection => BigQuery.connection,
32
+ :connection => Google::BigQuery.connection,
33
33
  :where => "order_date = '2015-01-21'",
34
34
  :group_by => "id",
35
35
  :order_by => "price DESC",
36
+ :dataset => "my_stats",
36
37
  :period => "order_date",
37
38
  :aggregates => {
38
39
  "order_details_quantity_ordered" => :sum,
@@ -51,10 +52,11 @@ module Unit
51
52
  }.strip.gsub(/\s+/, " "),
52
53
  Order.to_qry(
53
54
  "id", "SUM(order_details.quantity_ordered * order_details.price_each)",
54
- :connection => BigQuery.connection,
55
+ :connection => Google::BigQuery.connection,
55
56
  :where => "order_date >= '2015-01-15' AND order_date <= '2015-01-21'",
56
57
  :group_by => "id",
57
58
  :order_by => "id",
59
+ :dataset => "my_stats",
58
60
  :period => "order_date"
59
61
  ).strip.gsub(/\s+/, " ")
60
62
  )
@@ -69,10 +71,11 @@ module Unit
69
71
  }.strip.gsub(/\s+/, " "),
70
72
  Order.to_qry(
71
73
  "id", "customer_id", "SUM(order_details.quantity_ordered * order_details.price_each)",
72
- :connection => BigQuery.connection,
74
+ :connection => Google::BigQuery.connection,
73
75
  :where => "order_date >= '2015-01-15' AND order_date <= '2015-01-21'",
74
76
  :group_by => "id",
75
77
  :order_by => "id",
78
+ :dataset => "my_stats",
76
79
  :period => "order_date"
77
80
  ).strip.gsub(/\s+/, " ")
78
81
  )
@@ -86,9 +89,10 @@ module Unit
86
89
  }.strip.gsub(/\s+/, " "),
87
90
  Order.to_qry(
88
91
  "COUNT(id)",
89
- :connection => BigQuery.connection,
92
+ :connection => Google::BigQuery.connection,
90
93
  :where => "order_date >= '2015-01-15' AND order_date <= '2015-01-21'",
91
94
  :group_by => "YEAR(order_date) AS year",
95
+ :dataset => "my_stats",
92
96
  :period => "order_date"
93
97
  ).strip.gsub(/\s+/, " ")
94
98
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directiverecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  requirements: []
208
208
  rubyforge_project:
209
- rubygems_version: 2.2.2
209
+ rubygems_version: 2.4.3
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: A layer on top of ActiveRecord for using paths within queries without thinking