td-client 0.8.56 → 0.8.57
Sign up to get free protection for your applications and to get access to all the features.
- data/data/ca-bundle.crt +82 -0
- data/lib/td/client.rb +7 -56
- data/lib/td/client/api.rb +16 -132
- data/lib/td/client/model.rb +0 -63
- data/lib/td/client/version.rb +1 -1
- metadata +37 -24
- data/ChangeLog +0 -309
- data/README.rdoc +0 -16
data/data/ca-bundle.crt
CHANGED
@@ -3364,3 +3364,85 @@ l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
|
|
3364
3364
|
E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
|
3365
3365
|
5EI=
|
3366
3366
|
-----END CERTIFICATE-----
|
3367
|
+
|
3368
|
+
treasuredata.com
|
3369
|
+
================
|
3370
|
+
-----BEGIN CERTIFICATE-----
|
3371
|
+
MIIE0DCCA7igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
|
3372
|
+
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
|
3373
|
+
EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
|
3374
|
+
ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTExMDUwMzA3MDAwMFoXDTMxMDUwMzA3
|
3375
|
+
MDAwMFowgbQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
|
3376
|
+
EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjEtMCsGA1UE
|
3377
|
+
CxMkaHR0cDovL2NlcnRzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkvMTMwMQYDVQQD
|
3378
|
+
EypHbyBEYWRkeSBTZWN1cmUgQ2VydGlmaWNhdGUgQXV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NLEsNKR1EwRcbNhyz2h
|
3439
|
+
/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
|
3440
|
+
IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
|
3441
|
+
YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
|
3442
|
+
ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
|
3443
|
+
OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
|
3444
|
+
TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
|
3445
|
+
HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
|
3446
|
+
dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
|
3447
|
+
ReYNnyicsbkqWletNw+vHX/bvZ8=
|
3448
|
+
-----END CERTIFICATE-----
|
data/lib/td/client.rb
CHANGED
@@ -129,7 +129,7 @@ class Client
|
|
129
129
|
def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
130
130
|
# for compatibility, assume type is hive unless specifically specified
|
131
131
|
type = opts[:type] || opts['type'] || :hive
|
132
|
-
raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala].include? type
|
132
|
+
raise ArgumentError, "The specified query type is not supported: #{type}" unless [:hive, :pig, :impala, :presto].include? type
|
133
133
|
job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
|
134
134
|
Job.new(self, job_id, type, q)
|
135
135
|
end
|
@@ -222,6 +222,12 @@ class Client
|
|
222
222
|
@api.bulk_import_error_records(name, &block)
|
223
223
|
end
|
224
224
|
|
225
|
+
# => BulkImport
|
226
|
+
def bulk_import(name)
|
227
|
+
data = @api.show_bulk_import(name)
|
228
|
+
BulkImport.new(self, data)
|
229
|
+
end
|
230
|
+
|
225
231
|
# => [BulkImport]
|
226
232
|
def bulk_imports
|
227
233
|
@api.list_bulk_imports.map {|data|
|
@@ -380,62 +386,7 @@ class Client
|
|
380
386
|
def test_access_control(user, action, scope)
|
381
387
|
@api.test_access_control(user, action, scope)
|
382
388
|
end
|
383
|
-
|
384
|
-
# => [AggregationSchema]
|
385
|
-
def aggregation_schemas
|
386
|
-
list = @api.list_aggregation_schema
|
387
|
-
list.map {|name,relation_key,timezone|
|
388
|
-
AggregationSchema.new(self, name, relation_key, nil, nil, timezone)
|
389
|
-
}
|
390
|
-
end
|
391
|
-
|
392
|
-
# => true
|
393
|
-
def create_aggregation_schema(name, relation_key, params={})
|
394
|
-
@api.create_aggregation_schema(name, relation_key, params)
|
395
|
-
end
|
396
|
-
|
397
|
-
# => true
|
398
|
-
def delete_aggregation_schema(name)
|
399
|
-
@api.delete_aggregation_schema(name)
|
400
|
-
end
|
401
|
-
|
402
|
-
# => AggregationSchema
|
403
|
-
def aggregation_schema(name)
|
404
|
-
relation_key, logs, attrs = @api.show_aggregation_schema(name)
|
405
|
-
logs.map! {|name,comment,database,table,okeys,value_key,count_key|
|
406
|
-
table = Table.new(self, database, table, 'log', nil, nil)
|
407
|
-
LogAggregationSchemaEntry.new(self, name, comment, table,
|
408
|
-
okeys, value_key, count_key)
|
409
|
-
}
|
410
|
-
attrs.map! {|name,comment,database,table,method_name,parameters|
|
411
|
-
table = Table.new(self, database, table, 'log', nil, nil)
|
412
|
-
AttributeAggregationSchemaEntry.new(self, name, comment, table,
|
413
|
-
method_name, parameters)
|
414
|
-
}
|
415
|
-
AggregationSchema.new(self, name, relation_key, logs, attrs)
|
416
|
-
end
|
417
|
-
|
418
|
-
# => true
|
419
|
-
def create_aggregation_log_entry(name, entry_name, comment, db, table, okeys, value_key, count_key)
|
420
|
-
@api.create_aggregation_log_entry(name, entry_name, comment, db, table, okeys, value_key, count_key)
|
421
|
-
end
|
422
|
-
|
423
|
-
# => true
|
424
|
-
def delete_aggregation_log_entry(name, entry_name)
|
425
|
-
@api.delete_aggregation_log_entry(name, entry_name)
|
426
|
-
end
|
427
|
-
|
428
|
-
# => true
|
429
|
-
def create_aggregation_attr_entry(name, entry_name, comment, db, table, method_name, parameters)
|
430
|
-
@api.create_aggregation_attr_entry(name, entry_name, comment, db, table, method_name, parameters)
|
431
|
-
end
|
432
|
-
|
433
|
-
# => true
|
434
|
-
def delete_aggregation_attr_entry(name, entry_name)
|
435
|
-
@api.delete_aggregation_attr_entry(name, entry_name)
|
436
|
-
end
|
437
389
|
end
|
438
390
|
|
439
391
|
|
440
392
|
end
|
441
|
-
|
data/lib/td/client/api.rb
CHANGED
@@ -596,6 +596,16 @@ class API
|
|
596
596
|
return nil
|
597
597
|
end
|
598
598
|
|
599
|
+
# => data:Hash
|
600
|
+
def show_bulk_import(name)
|
601
|
+
code, body, res = get("/v3/bulk_import/show/#{name}")
|
602
|
+
if code != "200"
|
603
|
+
raise_error("Show bulk import failed", res)
|
604
|
+
end
|
605
|
+
js = checked_json(body, %w[status])
|
606
|
+
return js
|
607
|
+
end
|
608
|
+
|
599
609
|
# => result:[data:Hash]
|
600
610
|
def list_bulk_imports(opts={})
|
601
611
|
params = opts.dup
|
@@ -877,136 +887,6 @@ class API
|
|
877
887
|
end
|
878
888
|
|
879
889
|
|
880
|
-
####
|
881
|
-
## Aggregation Schema API
|
882
|
-
##
|
883
|
-
|
884
|
-
# => [(name:String, relation_key:String)]
|
885
|
-
def list_aggregation_schema
|
886
|
-
code, body, res = get("/v3/aggr/list")
|
887
|
-
if code != "200"
|
888
|
-
raise_error("List aggregation schema failed", res)
|
889
|
-
end
|
890
|
-
js = checked_json(body, %w[aggrs])
|
891
|
-
result = js["aggrs"].map {|aggrinfo|
|
892
|
-
name = aggrinfo['name'].to_s
|
893
|
-
relation_key = aggrinfo['relation_key'].to_s
|
894
|
-
timezone = aggrinfo['timezone'].to_s
|
895
|
-
[name, relation_key, timezone]
|
896
|
-
}
|
897
|
-
return result
|
898
|
-
end
|
899
|
-
|
900
|
-
# => true
|
901
|
-
def create_aggregation_schema(name, relation_key, params={})
|
902
|
-
params['relation_key'] = relation_key if relation_key
|
903
|
-
code, body, res = post("/v3/aggr/create/#{e name}", params)
|
904
|
-
if code != "200"
|
905
|
-
raise_error("Create aggregation schema failed", res)
|
906
|
-
end
|
907
|
-
return true
|
908
|
-
end
|
909
|
-
|
910
|
-
# => true
|
911
|
-
def delete_aggregation_schema(name)
|
912
|
-
code, body, res = post("/v3/aggr/delete/#{e name}")
|
913
|
-
if code != "200"
|
914
|
-
raise_error("Delete aggregation schema failed", res)
|
915
|
-
end
|
916
|
-
return true
|
917
|
-
end
|
918
|
-
|
919
|
-
# => [
|
920
|
-
# {
|
921
|
-
# relation_key: String,
|
922
|
-
# logs: (entry_name:String, comment:String, database:String, table:String,
|
923
|
-
# os:Array[String], value_key:String?, count_key:String?),
|
924
|
-
# attrs: (entry_name:String, comment:String, database:String, table:String,
|
925
|
-
# method_name:String, parameters:Hash[String=>Object])
|
926
|
-
# }
|
927
|
-
# ]
|
928
|
-
def show_aggregation_schema(name)
|
929
|
-
code, body, res = get("/v3/aggr/show/#{e name}")
|
930
|
-
if code != "200"
|
931
|
-
raise_error("Show aggregation schema failed", res)
|
932
|
-
end
|
933
|
-
js = checked_json(body, %w[relation_key logs attrs])
|
934
|
-
relation_key = js['relation_key']
|
935
|
-
logs = js['logs'].map {|loginfo|
|
936
|
-
entry_name = loginfo['name'].to_s
|
937
|
-
comment = loginfo['comment'].to_s
|
938
|
-
database = loginfo['database'].to_s
|
939
|
-
table = loginfo['table'].to_s
|
940
|
-
os = loginfo['os']
|
941
|
-
value_key = loginfo['value_key'].to_s
|
942
|
-
count_key = loginfo['count_key'].to_s
|
943
|
-
value_key = nil if value_key.empty?
|
944
|
-
count_key = nil if count_key.empty?
|
945
|
-
[entry_name, comment, database, table, os, value_key, count_key]
|
946
|
-
}
|
947
|
-
attrs = js['attrs'].map {|attrinfo|
|
948
|
-
entry_name = attrinfo['name'].to_s
|
949
|
-
comment = attrinfo['comment'].to_s
|
950
|
-
database = attrinfo['database'].to_s
|
951
|
-
table = attrinfo['table'].to_s
|
952
|
-
method_name = attrinfo['method_name'].to_s
|
953
|
-
parameters = attrinfo['parameters'].to_s
|
954
|
-
parameters = "{}" if parameters.empty?
|
955
|
-
parameters = JSON.parse(parameters)
|
956
|
-
[entry_name, comment, database, table, method_name, parameters]
|
957
|
-
}
|
958
|
-
return [relation_key, logs, attrs]
|
959
|
-
end
|
960
|
-
|
961
|
-
# => true
|
962
|
-
def create_aggregation_log_entry(name, entry_name, comment, db, table, okeys, value_key, count_key)
|
963
|
-
params = {}
|
964
|
-
params['comment'] = comment if comment
|
965
|
-
okeys.each_with_index {|okey,i|
|
966
|
-
params["os[#{i}]"] = okey
|
967
|
-
}
|
968
|
-
params['value_key'] = value_key if value_key
|
969
|
-
params['count_key'] = count_key if count_key
|
970
|
-
code, body, res = post("/v3/aggr/entry/log/create/#{e name}/#{e entry_name}/#{e db}/#{e table}", params)
|
971
|
-
if code != "200"
|
972
|
-
raise_error("Create aggregation log entry failed", res)
|
973
|
-
end
|
974
|
-
return true
|
975
|
-
end
|
976
|
-
|
977
|
-
# => true
|
978
|
-
def delete_aggregation_log_entry(name, entry_name)
|
979
|
-
code, body, res = post("/v3/aggr/entry/log/delete/#{e name}/#{e entry_name}")
|
980
|
-
if code != "200"
|
981
|
-
raise_error("Delete aggregation log entry failed", res)
|
982
|
-
end
|
983
|
-
return true
|
984
|
-
end
|
985
|
-
|
986
|
-
# => true
|
987
|
-
def create_aggregation_attr_entry(name, entry_name, comment, db, table, method_name, parameters)
|
988
|
-
params = {}
|
989
|
-
parameters.each_pair {|k,v|
|
990
|
-
params["parameters[#{k}]"] = v.to_s
|
991
|
-
}
|
992
|
-
params['comment'] = comment if comment
|
993
|
-
code, body, res = post("/v3/aggr/entry/attr/create/#{e name}/#{e entry_name}/#{e db}/#{e table}/#{e method_name}", params)
|
994
|
-
if code != "200"
|
995
|
-
raise_error("Create aggregation attr entry failed", res)
|
996
|
-
end
|
997
|
-
return true
|
998
|
-
end
|
999
|
-
|
1000
|
-
# => true
|
1001
|
-
def delete_aggregation_attr_entry(name, entry_name)
|
1002
|
-
code, body, res = post("/v3/aggr/entry/attr/delete/#{e name}/#{e entry_name}")
|
1003
|
-
if code != "200"
|
1004
|
-
raise_error("Delete aggregation attr entry failed", res)
|
1005
|
-
end
|
1006
|
-
return true
|
1007
|
-
end
|
1008
|
-
|
1009
|
-
|
1010
890
|
####
|
1011
891
|
## User API
|
1012
892
|
##
|
@@ -1317,7 +1197,7 @@ class API
|
|
1317
1197
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
1318
1198
|
#store = OpenSSL::X509::Store.new
|
1319
1199
|
#http.cert_store = store
|
1320
|
-
http.ca_file = File.join(
|
1200
|
+
http.ca_file = File.join(ssl_ca_file)
|
1321
1201
|
end
|
1322
1202
|
|
1323
1203
|
header = {}
|
@@ -1337,7 +1217,7 @@ class API
|
|
1337
1217
|
client.connect_timeout = @connect_timeout
|
1338
1218
|
|
1339
1219
|
if @ssl
|
1340
|
-
client.ssl_config.add_trust_ca(
|
1220
|
+
client.ssl_config.add_trust_ca(ssl_ca_file)
|
1341
1221
|
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
1342
1222
|
end
|
1343
1223
|
|
@@ -1352,6 +1232,10 @@ class API
|
|
1352
1232
|
return client, header
|
1353
1233
|
end
|
1354
1234
|
|
1235
|
+
def ssl_ca_file
|
1236
|
+
@ssl_ca_file ||= File.join(File.dirname(__FILE__), '..', '..', '..', 'data', 'ca-bundle.crt')
|
1237
|
+
end
|
1238
|
+
|
1355
1239
|
def raise_error(msg, res, klass=nil)
|
1356
1240
|
begin
|
1357
1241
|
status_code = res.code.to_s
|
data/lib/td/client/model.rb
CHANGED
@@ -471,68 +471,5 @@ class AccessControl < Model
|
|
471
471
|
end
|
472
472
|
|
473
473
|
|
474
|
-
class AggregationSchema < Model
|
475
|
-
def initialize(client, name, relation_key, logs=nil, attributes=nil, timezone=nil)
|
476
|
-
super(client)
|
477
|
-
@name = name
|
478
|
-
@relation_key = relation_key
|
479
|
-
@logs = logs
|
480
|
-
@attributes = attributes
|
481
|
-
@timezone = timezone
|
482
|
-
end
|
483
|
-
|
484
|
-
attr_reader :name, :relation_key, :timezone
|
485
|
-
|
486
|
-
def logs
|
487
|
-
update_entries! unless @logs
|
488
|
-
@logs
|
489
|
-
end
|
490
|
-
|
491
|
-
def attributes
|
492
|
-
update_entries! unless @attributes
|
493
|
-
@attributes
|
494
|
-
end
|
495
|
-
|
496
|
-
def update_entries!
|
497
|
-
sc = @client.aggregation_schema(@name)
|
498
|
-
@relation_key = sc.relation_key
|
499
|
-
@logs = sc.logs
|
500
|
-
@attributes = sc.attributes
|
501
|
-
self
|
502
|
-
end
|
503
|
-
end
|
504
|
-
|
505
|
-
|
506
|
-
class LogAggregationSchemaEntry < Model
|
507
|
-
def initialize(client, name, comment, table, okeys, value_key, count_key)
|
508
|
-
super(client)
|
509
|
-
@name = name
|
510
|
-
@comment = comment
|
511
|
-
@table = table
|
512
|
-
@okeys = okeys
|
513
|
-
@value_key = value_key
|
514
|
-
@count_key = count_key
|
515
|
-
end
|
516
|
-
|
517
|
-
attr_reader :name, :comment, :table
|
518
|
-
attr_reader :okeys, :value_key, :count_key
|
519
|
-
end
|
520
|
-
|
521
|
-
|
522
|
-
class AttributeAggregationSchemaEntry < Model
|
523
|
-
def initialize(client, name, comment, table, method_name, parameters)
|
524
|
-
super(client)
|
525
|
-
@name = name
|
526
|
-
@comment = comment
|
527
|
-
@table = table
|
528
|
-
@method_name = method_name
|
529
|
-
@parameters = parameters
|
530
|
-
end
|
531
|
-
|
532
|
-
attr_reader :name, :comment, :table
|
533
|
-
attr_reader :method_name, :parameters
|
534
|
-
end
|
535
|
-
|
536
|
-
|
537
474
|
end
|
538
475
|
|
data/lib/td/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.57
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Treasure Data, Inc.
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.4
|
19
22
|
- - ! '!='
|
20
23
|
- !ruby/object:Gem::Version
|
21
24
|
version: 0.5.0
|
@@ -31,14 +34,14 @@ dependencies:
|
|
31
34
|
- - <
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 0.6.0
|
34
|
-
- - ! '>='
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.4.4
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.4.4
|
42
45
|
- - ! '!='
|
43
46
|
- !ruby/object:Gem::Version
|
44
47
|
version: 0.5.0
|
@@ -54,9 +57,6 @@ dependencies:
|
|
54
57
|
- - <
|
55
58
|
- !ruby/object:Gem::Version
|
56
59
|
version: 0.6.0
|
57
|
-
- - ! '>='
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 0.4.4
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: json
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 2.8
|
99
|
+
version: '2.8'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
102
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -104,7 +104,7 @@ dependencies:
|
|
104
104
|
requirements:
|
105
105
|
- - ~>
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: 2.8
|
107
|
+
version: '2.8'
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: webmock
|
110
110
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - ~>
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 1.
|
115
|
+
version: '1.16'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -120,22 +120,36 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - ~>
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 1.
|
124
|
-
|
125
|
-
|
123
|
+
version: '1.16'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: simplecov
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.5.4
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.5.4
|
140
|
+
description: Treasure Data API library for Ruby
|
141
|
+
email: support@treasure-data.com
|
126
142
|
executables: []
|
127
143
|
extensions: []
|
128
|
-
extra_rdoc_files:
|
129
|
-
- ChangeLog
|
130
|
-
- README.rdoc
|
144
|
+
extra_rdoc_files: []
|
131
145
|
files:
|
132
|
-
- data/ca-bundle.crt
|
133
|
-
- lib/td-client.rb
|
134
|
-
- lib/td/client.rb
|
135
146
|
- lib/td/client/api.rb
|
136
147
|
- lib/td/client/compat_gzip_reader.rb
|
137
148
|
- lib/td/client/model.rb
|
138
149
|
- lib/td/client/version.rb
|
150
|
+
- lib/td/client.rb
|
151
|
+
- lib/td-client.rb
|
152
|
+
- data/ca-bundle.crt
|
139
153
|
- spec/api_spec.rb
|
140
154
|
- spec/spec_helper.rb
|
141
155
|
- spec/td/client/api_spec.rb
|
@@ -147,9 +161,7 @@ files:
|
|
147
161
|
- spec/td/client/result_api_spec.rb
|
148
162
|
- spec/td/client/sched_api_spec.rb
|
149
163
|
- spec/td/client/spec_resources.rb
|
150
|
-
|
151
|
-
- README.rdoc
|
152
|
-
homepage:
|
164
|
+
homepage: http://treasuredata.com/
|
153
165
|
licenses: []
|
154
166
|
post_install_message:
|
155
167
|
rdoc_options: []
|
@@ -183,3 +195,4 @@ test_files:
|
|
183
195
|
- spec/td/client/partial_delete_api_spec.rb
|
184
196
|
- spec/td/client/result_api_spec.rb
|
185
197
|
- spec/td/client/sched_api_spec.rb
|
198
|
+
has_rdoc: false
|
data/ChangeLog
DELETED
@@ -1,309 +0,0 @@
|
|
1
|
-
== 2013-11-14 version 0.8.56
|
2
|
-
|
3
|
-
* Remove organization, role and ip_limit subcommands
|
4
|
-
* Change item_table parameter
|
5
|
-
* Now accept :header option to set custom header
|
6
|
-
|
7
|
-
== 2013-09-13 version 0.8.55
|
8
|
-
|
9
|
-
* Use httpclient gem for import and bulk_import upload
|
10
|
-
* connect_timeout / read_timeout / send_timeout options are available.
|
11
|
-
* these options affect only import and bulk_import upload.
|
12
|
-
|
13
|
-
|
14
|
-
== 2013-08-23 version 0.8.54
|
15
|
-
|
16
|
-
* Support table's expire_days API
|
17
|
-
|
18
|
-
|
19
|
-
== 2013-07-22 version 0.8.53
|
20
|
-
|
21
|
-
* Add normalized_msgpack method to serialize Bignum type
|
22
|
-
|
23
|
-
|
24
|
-
== 2013-06-24 version 0.8.52
|
25
|
-
|
26
|
-
* Add last_log_timestamp to Table model
|
27
|
-
|
28
|
-
|
29
|
-
== 2013-06-17 version 0.8.51
|
30
|
-
|
31
|
-
* Relax dependent gem versions
|
32
|
-
|
33
|
-
|
34
|
-
== 2013-05-27 version 0.8.50
|
35
|
-
|
36
|
-
* add_user now requires email and passowrd
|
37
|
-
|
38
|
-
|
39
|
-
== 2013-05-06 version 0.8.49
|
40
|
-
|
41
|
-
* Add User-Agent header
|
42
|
-
* VERSION constant moved to under TreasureData::Client
|
43
|
-
|
44
|
-
|
45
|
-
== 2013-04-22 version 0.8.48
|
46
|
-
|
47
|
-
* create_schedule now takes :type option
|
48
|
-
* Fix wrong error messages
|
49
|
-
* Ues 'api-import' instead of 'api' on data import
|
50
|
-
|
51
|
-
|
52
|
-
== 2013-04-09 version 0.8.47
|
53
|
-
|
54
|
-
* Fix HTTP proxy handlig issue which is overwritten with ENV['HTTP_PROXY']
|
55
|
-
|
56
|
-
|
57
|
-
== 2013-03-29 version 0.8.46
|
58
|
-
|
59
|
-
* Add IP limitation API
|
60
|
-
|
61
|
-
|
62
|
-
== 2013-01-25 version 0.8.45
|
63
|
-
|
64
|
-
* Re-implement Client#job_status using /v3/job/status/job_id
|
65
|
-
instead of /v3/job/show/job_id to poll the progress of a job
|
66
|
-
|
67
|
-
|
68
|
-
== 2013-01-23 version 0.8.44
|
69
|
-
|
70
|
-
* Re-add json gem dependency
|
71
|
-
|
72
|
-
|
73
|
-
== 2013-01-23 version 0.8.43
|
74
|
-
|
75
|
-
* Add organization parameter support to create_database, query,
|
76
|
-
partial_delete, create_bulk_import, create_result
|
77
|
-
|
78
|
-
|
79
|
-
== 2013-01-16 version 0.8.42
|
80
|
-
|
81
|
-
* Added retry_limit to job and schedule APIs
|
82
|
-
* Increased table/database name limit from 32 to 256
|
83
|
-
|
84
|
-
|
85
|
-
== 2013-01-10 version 0.8.41
|
86
|
-
|
87
|
-
* Fix API#job_result_format to handle Content-Encoding properly
|
88
|
-
|
89
|
-
|
90
|
-
== 2012-12-27 version 0.8.40
|
91
|
-
|
92
|
-
* Add Table#last_import to use counter_updated_at column
|
93
|
-
|
94
|
-
|
95
|
-
== 2012-12-05 version 0.8.39
|
96
|
-
|
97
|
-
* Add conditions argument to Client#list_jobs for slow query listing
|
98
|
-
|
99
|
-
|
100
|
-
== 2012-11-21 version 0.8.38
|
101
|
-
|
102
|
-
* Add Account#created_at
|
103
|
-
|
104
|
-
|
105
|
-
== 2012-11-16 version 0.8.37
|
106
|
-
|
107
|
-
* Remove json gem dependency again (previous version has bug)
|
108
|
-
|
109
|
-
|
110
|
-
== 2012-11-16 version 0.8.36
|
111
|
-
|
112
|
-
* Remove json gem dependency
|
113
|
-
|
114
|
-
|
115
|
-
== 2012-10-23 version 0.8.35
|
116
|
-
|
117
|
-
* Added Account#account_id
|
118
|
-
|
119
|
-
|
120
|
-
== 2012-10-16 version 0.8.34
|
121
|
-
|
122
|
-
* Set Net::HTTP#open_timeout = 60
|
123
|
-
|
124
|
-
|
125
|
-
== 2012-10-10 version 0.8.33
|
126
|
-
|
127
|
-
* Supports import_with_id API
|
128
|
-
* Supports deflate and gzip Content-Encodings and sends Accept-Encoding header
|
129
|
-
|
130
|
-
|
131
|
-
== 2012-10-09 version 0.8.32
|
132
|
-
|
133
|
-
* Added Client#swap_table
|
134
|
-
|
135
|
-
|
136
|
-
== 2012-09-21 version 0.8.31
|
137
|
-
|
138
|
-
* Added Job#db_name
|
139
|
-
|
140
|
-
|
141
|
-
== 2012-09-21 version 0.8.30
|
142
|
-
|
143
|
-
* Fixed Account#storage_size_string and Table#estimated_storage_size_string
|
144
|
-
|
145
|
-
|
146
|
-
== 2012-09-17 version 0.8.29
|
147
|
-
|
148
|
-
* Added Client#core_utilization method
|
149
|
-
* Added Account#guaranteed_cores and #maximum_cores methods
|
150
|
-
|
151
|
-
|
152
|
-
== 2012-09-17 version 0.8.27
|
153
|
-
|
154
|
-
* Added Table#estimated_storage_size_string
|
155
|
-
|
156
|
-
|
157
|
-
== 2012-09-13 version 0.8.26
|
158
|
-
|
159
|
-
* Added Account model and Table#esetimated_storage_size method
|
160
|
-
* Name length limit is changed from 32 characters to 256 characters
|
161
|
-
|
162
|
-
|
163
|
-
== 2012-09-04 version 0.8.25
|
164
|
-
|
165
|
-
* Added Client#change_my_password(old_password, password)
|
166
|
-
|
167
|
-
|
168
|
-
== 2012-08-30 version 0.8.24
|
169
|
-
|
170
|
-
* TreasureData::Client.new supports :http_proxy option
|
171
|
-
|
172
|
-
|
173
|
-
== 2012-08-30 version 0.8.23
|
174
|
-
|
175
|
-
* Supports HTTP_PROXY environment variable
|
176
|
-
|
177
|
-
|
178
|
-
== 2012-08-20 version 0.8.22
|
179
|
-
|
180
|
-
* Top-level resource models support org_name parameter
|
181
|
-
|
182
|
-
|
183
|
-
== 2012-08-06 version 0.8.21
|
184
|
-
|
185
|
-
* Added multiuser features: organizations, users, roles
|
186
|
-
* Added access control
|
187
|
-
|
188
|
-
|
189
|
-
== 2012-07-23 version 0.8.20
|
190
|
-
|
191
|
-
* Implemented Zlib::GzipReader#readpartial for compatibility with ruby 1.8
|
192
|
-
|
193
|
-
|
194
|
-
== 2012-07-03 version 0.8.19
|
195
|
-
|
196
|
-
* Added Client#partial_delete
|
197
|
-
* Client#query and Client#create_schedule support 'priority' option
|
198
|
-
|
199
|
-
|
200
|
-
== 2012-06-26 version 0.8.18
|
201
|
-
|
202
|
-
* Client#result_each(&block) uses streaming raed not to read all data into memory
|
203
|
-
* Client#result_format(format, io=nil) supports second argument not to read
|
204
|
-
all data into memory
|
205
|
-
|
206
|
-
|
207
|
-
== 2012-06-11 version 0.8.17
|
208
|
-
|
209
|
-
* Client#jobs supports status option
|
210
|
-
|
211
|
-
|
212
|
-
== 2012-05-10 version 0.8.16
|
213
|
-
|
214
|
-
* Added bulk import feature
|
215
|
-
|
216
|
-
|
217
|
-
== 2012-04-26 version 0.8.15
|
218
|
-
|
219
|
-
* Result model replaces ResultSet model
|
220
|
-
* Removed methods related to ResultSet from Job and Schedule models
|
221
|
-
* Added methods related to Result to Job and Schedule models
|
222
|
-
|
223
|
-
|
224
|
-
== 2012-04-03 version 0.8.14
|
225
|
-
|
226
|
-
* Added Database#count, #created_at and #updated_at
|
227
|
-
* Added Table#created_at and #updated_at
|
228
|
-
|
229
|
-
|
230
|
-
== 2012-04-03 version 0.8.13
|
231
|
-
|
232
|
-
* Added Job#hive_result_schema
|
233
|
-
|
234
|
-
|
235
|
-
== 2012-03-12 version 0.8.12
|
236
|
-
|
237
|
-
* Client#run_schedule returns an array of ScheduledJob
|
238
|
-
|
239
|
-
|
240
|
-
== 2012-03-01 version 0.8.11
|
241
|
-
|
242
|
-
* Use data/ca-bundle.crt for SSL connections
|
243
|
-
|
244
|
-
|
245
|
-
== 2012-02-22 version 0.8.10
|
246
|
-
|
247
|
-
* Added Client#run_schedule and update_schedule
|
248
|
-
* Added timezone, delay and next_time fields to the Schedule model
|
249
|
-
* create_aggregation_schema accepts params argument
|
250
|
-
|
251
|
-
|
252
|
-
== 2012-02-12 version 0.8.9
|
253
|
-
|
254
|
-
* Added API#normalize_table_name and API#normalize_database_name
|
255
|
-
|
256
|
-
|
257
|
-
== 2012-02-02 version 0.8.8
|
258
|
-
|
259
|
-
* Fixed SSL support
|
260
|
-
|
261
|
-
|
262
|
-
== 2012-02-02 version 0.8.7
|
263
|
-
|
264
|
-
* Added SSL support
|
265
|
-
|
266
|
-
|
267
|
-
== 2012-01-19 version 0.8.6
|
268
|
-
|
269
|
-
* Check JSON format of HTTP responses
|
270
|
-
|
271
|
-
|
272
|
-
== 2011-12-04 version 0.8.5
|
273
|
-
|
274
|
-
* added new feature: ResultSet
|
275
|
-
* added new feature: AggregationSchema
|
276
|
-
* added Job#rset and Schedule#rset to get associated ResultSet
|
277
|
-
|
278
|
-
|
279
|
-
== 2011-11-11 version 0.8.4
|
280
|
-
|
281
|
-
* Added Model#client
|
282
|
-
* Added Database#query
|
283
|
-
* Added Table#import
|
284
|
-
* Increased http.read_timeout on Client#import
|
285
|
-
|
286
|
-
|
287
|
-
== 2011-10-03 version 0.8.3
|
288
|
-
|
289
|
-
* Added Client#tail method
|
290
|
-
|
291
|
-
|
292
|
-
== 2011-09-13 version 0.8.2
|
293
|
-
|
294
|
-
* Added APIs for scheduled queries
|
295
|
-
* Set 'Content-Length: 0' header to POST request if no parameters are
|
296
|
-
provided
|
297
|
-
|
298
|
-
|
299
|
-
== 2011-09-09 version 0.8.1
|
300
|
-
|
301
|
-
* Added Client#kill method
|
302
|
-
* Client.authenticate throws AuthError instead of APIError when
|
303
|
-
status code is 400
|
304
|
-
|
305
|
-
|
306
|
-
== 2011-08-21 version 0.8.0
|
307
|
-
|
308
|
-
* First release
|
309
|
-
|
data/README.rdoc
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
= Treasure Data API library for Ruby
|
2
|
-
|
3
|
-
= Getting Started
|
4
|
-
|
5
|
-
> gem install td-client
|
6
|
-
|
7
|
-
== Running Tests
|
8
|
-
> gem install jeweler
|
9
|
-
> gem install webmock
|
10
|
-
> rake spec
|
11
|
-
|
12
|
-
== Copyright
|
13
|
-
|
14
|
-
Copyright:: Copyright (c) 2011 Treasure Data Inc.
|
15
|
-
License:: Apache License, Version 2.0
|
16
|
-
|