td-client 0.8.46 → 0.8.47

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.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 2012-04-09 version 0.8.47
2
+
3
+ * Fix HTTP proxy handlig issue which is overwritten with ENV['HTTP_PROXY']
4
+
5
+
1
6
  == 2012-03-29 version 0.8.46
2
7
 
3
8
  * Add IP limitation API
@@ -4,6 +4,10 @@
4
4
 
5
5
  > gem install td-client
6
6
 
7
+ == Running Tests
8
+ > gem install jeweler
9
+ > gem install webmock
10
+ > rake spec
7
11
 
8
12
  == Copyright
9
13
 
@@ -121,8 +121,11 @@ class Client
121
121
 
122
122
  # => Job
123
123
  def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
124
- job_id = @api.hive_query(q, db_name, result_url, priority, retry_limit, opts)
125
- Job.new(self, job_id, :hive, q)
124
+ # for compatibility, assume type is hive unless specifically specified
125
+ type = opts[:type] || opts['type'] || :hive
126
+ raise ArgumentError, "only 'hive' and 'pig' types are supported" unless [:hive, :pig].include? type
127
+ job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
128
+ Job.new(self, job_id, type, q)
126
129
  end
127
130
 
128
131
  # => [Job]
@@ -56,7 +56,7 @@ class API
56
56
  end
57
57
 
58
58
  @http_proxy = opts[:http_proxy] || ENV['HTTP_PROXY']
59
- if @http_proxy = ENV['HTTP_PROXY']
59
+ if @http_proxy
60
60
  if @http_proxy =~ /\Ahttp:\/\/(.*)\z/
61
61
  @http_proxy = $~[1]
62
62
  end
@@ -474,11 +474,21 @@ class API
474
474
 
475
475
  # => jobId:String
476
476
  def hive_query(q, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
477
+ query(q, :hive, db, result_url, priority, retry_limit, opts)
478
+ end
479
+
480
+ # => jobId:String
481
+ def pig_query(q, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
482
+ query(q, :pig, db, result_url, priority, retry_limit, opts)
483
+ end
484
+
485
+ # => jobId:String
486
+ def query(q, type=:hive, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
477
487
  params = {'query' => q}.merge(opts)
478
488
  params['result'] = result_url if result_url
479
489
  params['priority'] = priority if priority
480
490
  params['retry_limit'] = retry_limit if retry_limit
481
- code, body, res = post("/v3/job/issue/hive/#{e db}", params)
491
+ code, body, res = post("/v3/job/issue/#{type}/#{e db}", params)
482
492
  if code != "200"
483
493
  raise_error("Query failed", res)
484
494
  end
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.8.46'
3
+ VERSION = '0.8.47'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.46
4
+ version: 0.8.47
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-28 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack