td-client 0.8.85 → 0.9.0dev1
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 +4 -4
- data/lib/td/client.rb +8 -16
- data/lib/td/client/api.rb +46 -62
- data/lib/td/client/api/bulk_import.rb +2 -1
- data/lib/td/client/api/bulk_load.rb +3 -3
- data/lib/td/client/api/export.rb +0 -12
- data/lib/td/client/api/import.rb +2 -3
- data/lib/td/client/api/job.rb +71 -145
- data/lib/td/client/api/schedule.rb +1 -1
- data/lib/td/client/api_error.rb +0 -5
- data/lib/td/client/model.rb +28 -91
- data/lib/td/client/version.rb +1 -1
- data/spec/spec_helper.rb +5 -5
- data/spec/td/client/account_api_spec.rb +5 -5
- data/spec/td/client/api_spec.rb +51 -69
- data/spec/td/client/api_ssl_connection_spec.rb +1 -1
- data/spec/td/client/bulk_import_spec.rb +29 -28
- data/spec/td/client/bulk_load_spec.rb +35 -60
- data/spec/td/client/db_api_spec.rb +1 -1
- data/spec/td/client/export_api_spec.rb +1 -11
- data/spec/td/client/import_api_spec.rb +10 -85
- data/spec/td/client/job_api_spec.rb +61 -567
- data/spec/td/client/model_job_spec.rb +10 -27
- data/spec/td/client/model_schedule_spec.rb +2 -2
- data/spec/td/client/partial_delete_api_spec.rb +1 -1
- data/spec/td/client/result_api_spec.rb +3 -3
- data/spec/td/client/sched_api_spec.rb +4 -12
- data/spec/td/client/server_status_api_spec.rb +2 -2
- data/spec/td/client/spec_resources.rb +0 -1
- data/spec/td/client/table_api_spec.rb +14 -14
- data/spec/td/client/user_api_spec.rb +12 -12
- data/spec/td/client_sched_spec.rb +6 -31
- data/spec/td/client_spec.rb +0 -1
- metadata +97 -42
- data/spec/td/client/api_error_spec.rb +0 -77
- data/spec/td/client/model_schema_spec.rb +0 -134
@@ -26,7 +26,7 @@ describe 'Job Model' do
|
|
26
26
|
'job_id', 'type', 'query', 'status', 'url', 'debug',
|
27
27
|
'start_at', 'end_at', 'cpu_time', 'result_size', 'result', 'result_url',
|
28
28
|
'hive_result_schema', 'priority', 'retry_limit', 'org_name', 'db_name',
|
29
|
-
'duration'
|
29
|
+
'duration'
|
30
30
|
].map {|name| job_attributes[name]}
|
31
31
|
end
|
32
32
|
|
@@ -43,20 +43,20 @@ describe 'Job Model' do
|
|
43
43
|
let(:io) { StringIO.new }
|
44
44
|
|
45
45
|
context 'not finished?' do
|
46
|
-
before {
|
46
|
+
before { job.stub(:finished?) { false } }
|
47
47
|
|
48
48
|
it 'do not call #job_result_raw' do
|
49
|
-
|
49
|
+
client.should_not_receive(:job_result_raw)
|
50
50
|
|
51
51
|
expect(job.result_raw(format, io)).to_not be
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'finished?' do
|
56
|
-
before {
|
56
|
+
before { job.stub(:finished?) { true } }
|
57
57
|
|
58
58
|
it 'call #job_result_raw' do
|
59
|
-
|
59
|
+
client.should_receive(:job_result_raw).with(job_id, format, io)
|
60
60
|
|
61
61
|
job.result_raw(format, io)
|
62
62
|
end
|
@@ -90,17 +90,14 @@ describe 'Job Model' do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'calls a given block in every wait_interval second' do
|
93
|
-
now = 1_400_000_000
|
94
|
-
allow(self).to receive(:sleep){|arg| now += arg }
|
95
|
-
allow(Process).to receive(:clock_gettime){ now }
|
96
93
|
expect { |b|
|
97
94
|
begin
|
98
95
|
thread = Thread.start {
|
99
|
-
job.wait(nil,
|
96
|
+
job.wait(nil, 0.1, &b)
|
100
97
|
}
|
101
|
-
sleep
|
98
|
+
sleep 0.3
|
102
99
|
change_job_status(Job::STATUS_SUCCESS)
|
103
|
-
thread.join(
|
100
|
+
thread.join(0.5)
|
104
101
|
expect(thread).to be_stop
|
105
102
|
ensure
|
106
103
|
thread.kill # just in case
|
@@ -111,26 +108,12 @@ describe 'Job Model' do
|
|
111
108
|
|
112
109
|
context 'with timeout' do
|
113
110
|
context 'the job running time is too long' do
|
114
|
-
it 'raise
|
111
|
+
it 'raise TreasureData::Job::TimeoutError' do
|
115
112
|
expect {
|
116
113
|
job.wait(0.1)
|
117
|
-
}.to raise_error(
|
114
|
+
}.to raise_error(Job::TimeoutError)
|
118
115
|
end
|
119
116
|
end
|
120
|
-
|
121
|
-
it 'calls a given block in every wait_interval second, and timeout' do
|
122
|
-
expect { |b|
|
123
|
-
begin
|
124
|
-
thread = Thread.start {
|
125
|
-
job.wait(0.3, 0.1, &b)
|
126
|
-
}
|
127
|
-
expect{ thread.value }.to raise_error(Timeout::Error)
|
128
|
-
expect(thread).to be_stop
|
129
|
-
ensure
|
130
|
-
thread.kill # just in case
|
131
|
-
end
|
132
|
-
}.to yield_control.at_least(2).times
|
133
|
-
end
|
134
117
|
end
|
135
118
|
end
|
136
119
|
end
|
@@ -14,11 +14,11 @@ describe 'Schedule Model' do
|
|
14
14
|
let(:num) { 1 }
|
15
15
|
|
16
16
|
before do
|
17
|
-
|
17
|
+
API.stub(:new).with(api_key, {}).and_return(api)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'success call api' do
|
21
|
-
|
21
|
+
api.should_receive(:run_schedule).with(name, time, num).and_return([])
|
22
22
|
|
23
23
|
schedule.run(time, num)
|
24
24
|
end
|
@@ -27,7 +27,7 @@ describe 'PartialDelete API' do
|
|
27
27
|
stub_api_request(:post, "/v3/table/partialdelete/#{e(db_name)}/#{e(table_name)}").with(:body => from_to).
|
28
28
|
to_return(:body => {'database' => db_name, 'table' => table_name, 'job_id' => '1'}.to_json)
|
29
29
|
|
30
|
-
|
30
|
+
api.partial_delete(db_name, table_name, to, from).should == '1'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should return 404 error with non exist database name' do
|
@@ -14,7 +14,7 @@ describe 'Result API' do
|
|
14
14
|
params = {'url' => result_url}
|
15
15
|
stub_api_request(:post, "/v3/result/create/#{e(result_name)}").with(:body => params).to_return(:body => {'result' => result_name}.to_json)
|
16
16
|
|
17
|
-
|
17
|
+
api.create_result(result_name, result_url).should be true
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should return 422 error with invalid name' do
|
@@ -56,14 +56,14 @@ describe 'Result API' do
|
|
56
56
|
it 'should return name and url' do
|
57
57
|
stub_api_request(:get, '/v3/result/list').
|
58
58
|
to_return(:body => {'results' => [{'name' => 'name', 'url' => 'url'}]}.to_json)
|
59
|
-
|
59
|
+
api.list_result.should == [['name', 'url', nil]]
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe 'delete_result' do
|
64
64
|
it 'should delete the result' do
|
65
65
|
stub_api_request(:post, "/v3/result/delete/#{e(result_name)}")
|
66
|
-
|
66
|
+
api.delete_result(result_name).should == true
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should raise error' do
|
@@ -20,15 +20,7 @@ describe 'Schedule API' do
|
|
20
20
|
with(:body => opts.merge('type' => 'hive')).
|
21
21
|
to_return(:body => {'name' => sched_name, 'start' => start.to_s}.to_json)
|
22
22
|
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should create a dummy schedule' do
|
27
|
-
stub_api_request(:post, "/v3/schedule/create/#{e(sched_name)}").
|
28
|
-
with(:body => opts.merge('type' => 'hive')).
|
29
|
-
to_return(:body => {'name' => sched_name, 'start' => nil}.to_json)
|
30
|
-
|
31
|
-
expect(api.create_schedule(sched_name, opts.merge('type' => 'hive'))).to be_nil
|
23
|
+
api.create_schedule(sched_name, opts.merge('type' => 'hive')).should == start.to_s
|
32
24
|
end
|
33
25
|
|
34
26
|
it 'should return 422 error with invalid name' do
|
@@ -48,7 +40,7 @@ describe 'Schedule API' do
|
|
48
40
|
it 'should delete the schedule' do
|
49
41
|
stub_api_request(:post, "/v3/schedule/delete/#{e(sched_name)}").
|
50
42
|
to_return(:body => {'cron' => 'cron', 'query' => 'query'}.to_json)
|
51
|
-
|
43
|
+
api.delete_schedule(sched_name).should == ['cron', 'query']
|
52
44
|
end
|
53
45
|
end
|
54
46
|
|
@@ -94,7 +86,7 @@ describe 'Schedule API' do
|
|
94
86
|
stub_api_request(:get, "/v3/schedule/history/#{e(sched_name)}").
|
95
87
|
with(:query => {'from' => 0, 'to' => 100}).
|
96
88
|
to_return(:body => {'history' => [history]}.to_json)
|
97
|
-
|
89
|
+
api.history(sched_name, 0, 100).should == [[nil, 'job_id', :type, 'status', 'query', 'start_at', 'end_at', 'result', 'priority', 'database']]
|
98
90
|
end
|
99
91
|
end
|
100
92
|
|
@@ -103,7 +95,7 @@ describe 'Schedule API' do
|
|
103
95
|
stub_api_request(:post, "/v3/schedule/run/#{e(sched_name)}/123456789").
|
104
96
|
with(:body => {'num' => '5'}).
|
105
97
|
to_return(:body => {'jobs' => [{'job_id' => 'job_id', 'scheduled_at' => 'scheduled_at', 'type' => 'type'}]}.to_json)
|
106
|
-
|
98
|
+
api.run_schedule(sched_name, 123456789, 5).should == [['job_id', :type, 'scheduled_at']]
|
107
99
|
end
|
108
100
|
end
|
109
101
|
end
|
@@ -13,13 +13,13 @@ describe 'ServerStatus API' do
|
|
13
13
|
it 'returns status' do
|
14
14
|
stub_api_request(:get, '/v3/system/server_status').
|
15
15
|
to_return(:body => {'status' => 'OK'}.to_json)
|
16
|
-
|
16
|
+
api.server_status.should == 'OK'
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'returns error description' do
|
20
20
|
stub_api_request(:get, '/v3/system/server_status').
|
21
21
|
to_return(:status => 500)
|
22
|
-
|
22
|
+
api.server_status.should == 'Server is down (500)'
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ describe 'Table API' do
|
|
27
27
|
it 'should create a new table if the database exists' do
|
28
28
|
stub_api_request(:post, "/v3/table/create/#{e db_name}/#{e(table_name)}/log").
|
29
29
|
to_return(:body => {'database' => db_name, 'table' => table_name, 'type' => 'log'}.to_json)
|
30
|
-
|
30
|
+
api.create_log_table(db_name, table_name).should be true
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should return 400 error with invalid name' do
|
@@ -82,10 +82,10 @@ describe 'Table API' do
|
|
82
82
|
describe "'tables' Client API" do
|
83
83
|
it 'should return an array of Table objects' do
|
84
84
|
tables = [
|
85
|
-
["table_1", "item", "[[\"value\",\"string\"]]", 111, "2013-01-21 01:51:41 UTC", "2014-01-21 01:51:41 UTC"],
|
86
|
-
["table_2", "log", "[[\"value\",\"long\"]]", 222, "2013-02-22 02:52:42 UTC", "2014-02-22 02:52:42 UTC"],
|
87
|
-
["table_3", "item", "[[\"value\",\"string\"]]", 333, "2013-03-23 03:53:43 UTC", "2014-03-23 03:53:43 UTC"],
|
88
|
-
["table_4", "log", "[[\"value\",\"long\"]]", 444, "2013-04-24 04:54:44 UTC", "2014-04-24 04:54:44 UTC"]
|
85
|
+
["table_1", "item", "[[\"time\",\"long\"],[\"value\",\"string\"]]", 111, "2013-01-21 01:51:41 UTC", "2014-01-21 01:51:41 UTC"],
|
86
|
+
["table_2", "log", "[[\"time\",\"long\"],[\"value\",\"long\"]]", 222, "2013-02-22 02:52:42 UTC", "2014-02-22 02:52:42 UTC"],
|
87
|
+
["table_3", "item", "[[\"time\",\"long\"],[\"value\",\"string\"]]", 333, "2013-03-23 03:53:43 UTC", "2014-03-23 03:53:43 UTC"],
|
88
|
+
["table_4", "log", "[[\"time\",\"long\"],[\"value\",\"long\"]]", 444, "2013-04-24 04:54:44 UTC", "2014-04-24 04:54:44 UTC"]
|
89
89
|
]
|
90
90
|
stub_api_request(:get, "/v3/table/list/#{e db_name}").
|
91
91
|
to_return(:body => {'tables' => [
|
@@ -138,10 +138,10 @@ describe 'Table API' do
|
|
138
138
|
describe "'table' Client API" do
|
139
139
|
it 'should return the Table object corresponding to the name' do
|
140
140
|
tables = [
|
141
|
-
["table_1", "item", "[[\"value\",\"string\"]]", 111, "2013-01-21 01:51:41 UTC", "2014-01-21 01:51:41 UTC"],
|
142
|
-
["table_2", "log", "[[\"value\",\"long\"]]", 222, "2013-02-22 02:52:42 UTC", "2014-02-22 02:52:42 UTC"],
|
143
|
-
["table_3", "item", "[[\"value\",\"string\"]]", 333, "2013-03-23 03:53:43 UTC", "2014-03-23 03:53:43 UTC"],
|
144
|
-
["table_4", "log", "[[\"value\",\"long\"]]", 444, "2013-04-24 04:54:44 UTC", "2014-04-24 04:54:44 UTC"]
|
141
|
+
["table_1", "item", "[[\"time\",\"long\"],[\"value\",\"string\"]]", 111, "2013-01-21 01:51:41 UTC", "2014-01-21 01:51:41 UTC"],
|
142
|
+
["table_2", "log", "[[\"time\",\"long\"],[\"value\",\"long\"]]", 222, "2013-02-22 02:52:42 UTC", "2014-02-22 02:52:42 UTC"],
|
143
|
+
["table_3", "item", "[[\"time\",\"long\"],[\"value\",\"string\"]]", 333, "2013-03-23 03:53:43 UTC", "2014-03-23 03:53:43 UTC"],
|
144
|
+
["table_4", "log", "[[\"time\",\"long\"],[\"value\",\"long\"]]", 444, "2013-04-24 04:54:44 UTC", "2014-04-24 04:54:44 UTC"]
|
145
145
|
]
|
146
146
|
stub_api_request(:get, "/v3/table/list/#{e db_name}").
|
147
147
|
to_return(:body => {'tables' => [
|
@@ -166,7 +166,7 @@ describe 'Table API' do
|
|
166
166
|
describe 'swap_table' do
|
167
167
|
it 'should swap tables' do
|
168
168
|
stub_api_request(:post, '/v3/table/swap/db/table1/table2')
|
169
|
-
|
169
|
+
api.swap_table('db', 'table1', 'table2').should == true
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -175,7 +175,7 @@ describe 'Table API' do
|
|
175
175
|
stub_api_request(:post, '/v3/table/update/db/table').
|
176
176
|
with(:body => {'expire_days' => '5'}).
|
177
177
|
to_return(:body => {'type' => 'type'}.to_json)
|
178
|
-
|
178
|
+
api.update_expire('db', 'table', 5).should == true
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -197,14 +197,14 @@ describe 'Table API' do
|
|
197
197
|
api.tail('db', 'table', 10) do |row|
|
198
198
|
result << row
|
199
199
|
end
|
200
|
-
|
200
|
+
result.should == [[1, 2, 3], [4, 5, 6]]
|
201
201
|
end
|
202
202
|
|
203
203
|
it 'returns rows' do
|
204
204
|
stub_api_request(:get, '/v3/table/tail/db/table').
|
205
205
|
with(:query => {'format' => 'msgpack', 'count' => '10'}).
|
206
206
|
to_return(:body => packed)
|
207
|
-
|
207
|
+
api.tail('db', 'table', 10).should == [[1, 2, 3], [4, 5, 6]]
|
208
208
|
end
|
209
209
|
|
210
210
|
it 'shows deprecated warning for from and to' do
|
@@ -220,7 +220,7 @@ describe 'Table API' do
|
|
220
220
|
$stderr.reopen(backup)
|
221
221
|
w.close
|
222
222
|
end
|
223
|
-
|
223
|
+
r.read.should == %Q(parameter "to" and "from" no longer work\n)
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -14,7 +14,7 @@ describe 'User API' do
|
|
14
14
|
it 'returns apikey' do
|
15
15
|
stub_api_request(:post, "/v3/user/authenticate").
|
16
16
|
to_return(:body => {'apikey' => 'apikey'}.to_json)
|
17
|
-
|
17
|
+
api.authenticate('user', 'password').should == 'apikey'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'raises AuthError for authentication failure' do
|
@@ -38,30 +38,30 @@ describe 'User API' do
|
|
38
38
|
it 'returns users' do
|
39
39
|
stub_api_request(:get, "/v3/user/list").
|
40
40
|
to_return(:body => {'users' => [{'name' => 'name1', 'email' => 'email1'}, {'name' => 'name2', 'email' => 'email2'}]}.to_json)
|
41
|
-
|
41
|
+
api.list_users.should == [
|
42
42
|
['name1', nil, nil, 'email1'],
|
43
43
|
['name2', nil, nil, 'email2'],
|
44
|
-
]
|
44
|
+
]
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe 'add_user' do
|
49
49
|
it 'runs' do
|
50
50
|
stub_api_request(:post, "/v3/user/add/name").to_return(:body => {}.to_json)
|
51
|
-
|
51
|
+
api.add_user('name', "org", 'name+suffix@example.com', 'password').should == true
|
52
52
|
end
|
53
53
|
|
54
54
|
# TODO
|
55
55
|
it 'does not escape sp but it must be a bug' do
|
56
56
|
stub_api_request(:post, "/v3/user/add/!%20%20%20%20@%23$%25%5E&*()_%2B%7C~%2Ecom").to_return(:body => {}.to_json)
|
57
|
-
|
57
|
+
api.add_user('! @#$%^&*()_+|~.com', "org", 'name+suffix@example.com', 'password').should == true
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe 'remove_user' do
|
62
62
|
it 'runs' do
|
63
63
|
stub_api_request(:post, "/v3/user/remove/name").to_return(:body => {}.to_json)
|
64
|
-
|
64
|
+
api.remove_user('name').should == true
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -70,7 +70,7 @@ describe 'User API' do
|
|
70
70
|
stub_api_request(:post, "/v3/user/email/change/name").
|
71
71
|
with(:body => {'email' => 'new@email.com'}).
|
72
72
|
to_return(:body => {}.to_json)
|
73
|
-
|
73
|
+
api.change_email('name', 'new@email.com').should == true
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -78,7 +78,7 @@ describe 'User API' do
|
|
78
78
|
it 'runs' do
|
79
79
|
stub_api_request(:get, "/v3/user/apikey/list/name").
|
80
80
|
to_return(:body => {'apikeys' => ['key1', 'key2']}.to_json)
|
81
|
-
|
81
|
+
api.list_apikeys('name').should == ['key1', 'key2']
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -86,7 +86,7 @@ describe 'User API' do
|
|
86
86
|
it 'does not return the generated apikey because you can list apikey afterwards' do
|
87
87
|
stub_api_request(:post, "/v3/user/apikey/add/name").
|
88
88
|
to_return(:body => {'apikey' => 'apikey'}.to_json)
|
89
|
-
|
89
|
+
api.add_apikey('name').should == true
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -94,7 +94,7 @@ describe 'User API' do
|
|
94
94
|
it 'runs' do
|
95
95
|
stub_api_request(:post, "/v3/user/apikey/remove/name").
|
96
96
|
to_return(:body => {}.to_json)
|
97
|
-
|
97
|
+
api.remove_apikey('name', 'apikey').should == true
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -103,7 +103,7 @@ describe 'User API' do
|
|
103
103
|
stub_api_request(:post, "/v3/user/password/change/name").
|
104
104
|
with(:body => {'password' => 'password'}).
|
105
105
|
to_return(:body => {}.to_json)
|
106
|
-
|
106
|
+
api.change_password('name', 'password').should == true
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -112,7 +112,7 @@ describe 'User API' do
|
|
112
112
|
stub_api_request(:post, "/v3/user/password/change").
|
113
113
|
with(:body => {'old_password' => 'old_password', 'password' => 'password'}).
|
114
114
|
to_return(:body => {}.to_json)
|
115
|
-
|
115
|
+
api.change_my_password('old_password', 'password').should == true
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -15,31 +15,6 @@ describe 'Schedule Command' do
|
|
15
15
|
client
|
16
16
|
end
|
17
17
|
|
18
|
-
describe 'create' do
|
19
|
-
let :opts do
|
20
|
-
{:database => db_name, :cron => '', :type => 'hive', :query => 'select 1;'}
|
21
|
-
end
|
22
|
-
|
23
|
-
before do
|
24
|
-
stub_api_request(:post, "/v3/schedule/create/#{e(sched_name)}").
|
25
|
-
with(:body => opts).
|
26
|
-
to_return(:body => {'name' => sched_name, 'start' => start}.to_json)
|
27
|
-
end
|
28
|
-
context 'start is now' do
|
29
|
-
let (:start){ Time.now.round }
|
30
|
-
it 'returns Time object' do
|
31
|
-
expect(client.create_schedule(sched_name, opts)).to eq(start)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'start is nil' do
|
36
|
-
let (:start){ nil }
|
37
|
-
it do
|
38
|
-
expect(client.create_schedule(sched_name, opts)).to eq(start)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
18
|
describe 'history' do
|
44
19
|
let :opts do
|
45
20
|
{'database' => db_name}
|
@@ -58,11 +33,11 @@ describe 'Schedule Command' do
|
|
58
33
|
to_return(:body => {'count' => 1, 'history' => [h]}.to_json)
|
59
34
|
|
60
35
|
client.history(sched_name, 0, 19).each do |scheduled_job|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
36
|
+
scheduled_job.scheduled_at.xmlschema.should == Time.parse('2015-02-17T14:16:00+09:00').xmlschema #avoid depending on CI's Locale
|
37
|
+
scheduled_job.job_id.should == 'job_id'
|
38
|
+
scheduled_job.status.should == 'status'
|
39
|
+
scheduled_job.priority.should == 'priority'
|
40
|
+
scheduled_job.result_url.should == 'result'
|
66
41
|
end
|
67
42
|
end
|
68
43
|
|
@@ -72,7 +47,7 @@ describe 'Schedule Command' do
|
|
72
47
|
to_return(:body => {'count' => 1, 'history' => [h]}.to_json)
|
73
48
|
|
74
49
|
client.history(sched_name, 0, 19).each do |scheduled_job|
|
75
|
-
|
50
|
+
scheduled_job.scheduled_at.should == nil
|
76
51
|
end
|
77
52
|
end
|
78
53
|
end
|
data/spec/td/client_spec.rb
CHANGED
@@ -39,7 +39,6 @@ describe 'Command' do
|
|
39
39
|
expect(job.org_name).to eq raw_jobs[i]['organization']
|
40
40
|
expect(job.db_name).to eq raw_jobs[i]['database']
|
41
41
|
expect(job.duration).to eq raw_jobs[i]['duration']
|
42
|
-
expect(job.num_records).to eq raw_jobs[i]['num_records']
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
metadata
CHANGED
@@ -1,142 +1,200 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0dev1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Treasure Data, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: msgpack
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
18
|
+
version: 0.4.4
|
19
|
+
- - "!="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.0
|
22
|
+
- - "!="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.5.1
|
25
|
+
- - "!="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.5.2
|
28
|
+
- - "!="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.5.3
|
20
31
|
- - "<"
|
21
32
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
23
|
-
|
33
|
+
version: 0.6.0
|
34
|
+
name: msgpack
|
24
35
|
prerelease: false
|
36
|
+
type: :runtime
|
25
37
|
version_requirements: !ruby/object:Gem::Requirement
|
26
38
|
requirements:
|
27
39
|
- - ">="
|
28
40
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
41
|
+
version: 0.4.4
|
42
|
+
- - "!="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.5.0
|
45
|
+
- - "!="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.1
|
48
|
+
- - "!="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.5.2
|
51
|
+
- - "!="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.5.3
|
30
54
|
- - "<"
|
31
55
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
56
|
+
version: 0.6.0
|
33
57
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: json
|
35
58
|
requirement: !ruby/object:Gem::Requirement
|
36
59
|
requirements:
|
37
60
|
- - ">="
|
38
61
|
- !ruby/object:Gem::Version
|
39
62
|
version: 1.7.6
|
40
|
-
|
63
|
+
name: json
|
41
64
|
prerelease: false
|
65
|
+
type: :runtime
|
42
66
|
version_requirements: !ruby/object:Gem::Requirement
|
43
67
|
requirements:
|
44
68
|
- - ">="
|
45
69
|
- !ruby/object:Gem::Version
|
46
70
|
version: 1.7.6
|
47
71
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: httpclient
|
49
72
|
requirement: !ruby/object:Gem::Requirement
|
50
73
|
requirements:
|
51
74
|
- - ">="
|
52
75
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
|
76
|
+
version: 2.5.2
|
77
|
+
- - "<"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.6.0
|
80
|
+
name: httpclient
|
55
81
|
prerelease: false
|
82
|
+
type: :runtime
|
56
83
|
version_requirements: !ruby/object:Gem::Requirement
|
57
84
|
requirements:
|
58
85
|
- - ">="
|
59
86
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
87
|
+
version: 2.5.2
|
88
|
+
- - "<"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.6.0
|
61
91
|
- !ruby/object:Gem::Dependency
|
62
|
-
name: rspec
|
63
92
|
requirement: !ruby/object:Gem::Requirement
|
64
93
|
requirements:
|
65
94
|
- - "~>"
|
66
95
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
|
96
|
+
version: '2.8'
|
97
|
+
name: rspec
|
69
98
|
prerelease: false
|
99
|
+
type: :development
|
70
100
|
version_requirements: !ruby/object:Gem::Requirement
|
71
101
|
requirements:
|
72
102
|
- - "~>"
|
73
103
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
104
|
+
version: '2.8'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.25'
|
111
|
+
name: mime-types
|
112
|
+
prerelease: false
|
113
|
+
type: :development
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '1.25'
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.6.8
|
125
|
+
name: rest-client
|
126
|
+
prerelease: false
|
127
|
+
type: :development
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.6.8
|
75
133
|
- !ruby/object:Gem::Dependency
|
76
|
-
name: coveralls
|
77
134
|
requirement: !ruby/object:Gem::Requirement
|
78
135
|
requirements:
|
79
136
|
- - ">="
|
80
137
|
- !ruby/object:Gem::Version
|
81
138
|
version: '0'
|
82
|
-
|
139
|
+
name: coveralls
|
83
140
|
prerelease: false
|
141
|
+
type: :development
|
84
142
|
version_requirements: !ruby/object:Gem::Requirement
|
85
143
|
requirements:
|
86
144
|
- - ">="
|
87
145
|
- !ruby/object:Gem::Version
|
88
146
|
version: '0'
|
89
147
|
- !ruby/object:Gem::Dependency
|
90
|
-
name: webmock
|
91
148
|
requirement: !ruby/object:Gem::Requirement
|
92
149
|
requirements:
|
93
150
|
- - "~>"
|
94
151
|
- !ruby/object:Gem::Version
|
95
152
|
version: '1.16'
|
96
|
-
|
153
|
+
name: webmock
|
97
154
|
prerelease: false
|
155
|
+
type: :development
|
98
156
|
version_requirements: !ruby/object:Gem::Requirement
|
99
157
|
requirements:
|
100
158
|
- - "~>"
|
101
159
|
- !ruby/object:Gem::Version
|
102
160
|
version: '1.16'
|
103
161
|
- !ruby/object:Gem::Dependency
|
104
|
-
name: simplecov
|
105
162
|
requirement: !ruby/object:Gem::Requirement
|
106
163
|
requirements:
|
107
164
|
- - ">="
|
108
165
|
- !ruby/object:Gem::Version
|
109
166
|
version: 0.5.4
|
110
|
-
|
167
|
+
name: simplecov
|
111
168
|
prerelease: false
|
169
|
+
type: :development
|
112
170
|
version_requirements: !ruby/object:Gem::Requirement
|
113
171
|
requirements:
|
114
172
|
- - ">="
|
115
173
|
- !ruby/object:Gem::Version
|
116
174
|
version: 0.5.4
|
117
175
|
- !ruby/object:Gem::Dependency
|
118
|
-
name: rake
|
119
176
|
requirement: !ruby/object:Gem::Requirement
|
120
177
|
requirements:
|
121
178
|
- - ">="
|
122
179
|
- !ruby/object:Gem::Version
|
123
180
|
version: '0'
|
124
|
-
|
181
|
+
name: rake
|
125
182
|
prerelease: false
|
183
|
+
type: :development
|
126
184
|
version_requirements: !ruby/object:Gem::Requirement
|
127
185
|
requirements:
|
128
186
|
- - ">="
|
129
187
|
- !ruby/object:Gem::Version
|
130
188
|
version: '0'
|
131
189
|
- !ruby/object:Gem::Dependency
|
132
|
-
name: yard
|
133
190
|
requirement: !ruby/object:Gem::Requirement
|
134
191
|
requirements:
|
135
192
|
- - ">="
|
136
193
|
- !ruby/object:Gem::Version
|
137
194
|
version: '0'
|
138
|
-
|
195
|
+
name: yard
|
139
196
|
prerelease: false
|
197
|
+
type: :development
|
140
198
|
version_requirements: !ruby/object:Gem::Requirement
|
141
199
|
requirements:
|
142
200
|
- - ">="
|
@@ -174,7 +232,6 @@ files:
|
|
174
232
|
- spec/spec_helper.rb
|
175
233
|
- spec/td/client/access_control_api_spec.rb
|
176
234
|
- spec/td/client/account_api_spec.rb
|
177
|
-
- spec/td/client/api_error_spec.rb
|
178
235
|
- spec/td/client/api_spec.rb
|
179
236
|
- spec/td/client/api_ssl_connection_spec.rb
|
180
237
|
- spec/td/client/bulk_import_spec.rb
|
@@ -185,7 +242,6 @@ files:
|
|
185
242
|
- spec/td/client/job_api_spec.rb
|
186
243
|
- spec/td/client/model_job_spec.rb
|
187
244
|
- spec/td/client/model_schedule_spec.rb
|
188
|
-
- spec/td/client/model_schema_spec.rb
|
189
245
|
- spec/td/client/partial_delete_api_spec.rb
|
190
246
|
- spec/td/client/result_api_spec.rb
|
191
247
|
- spec/td/client/sched_api_spec.rb
|
@@ -198,7 +254,7 @@ files:
|
|
198
254
|
homepage: http://treasuredata.com/
|
199
255
|
licenses: []
|
200
256
|
metadata: {}
|
201
|
-
post_install_message:
|
257
|
+
post_install_message:
|
202
258
|
rdoc_options: []
|
203
259
|
require_paths:
|
204
260
|
- lib
|
@@ -206,22 +262,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
262
|
requirements:
|
207
263
|
- - ">="
|
208
264
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
265
|
+
version: 1.8.7
|
210
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
267
|
requirements:
|
212
|
-
- - "
|
268
|
+
- - ">"
|
213
269
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
270
|
+
version: 1.3.1
|
215
271
|
requirements: []
|
216
|
-
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
218
|
-
signing_key:
|
272
|
+
rubyforge_project:
|
273
|
+
rubygems_version: 2.4.8
|
274
|
+
signing_key:
|
219
275
|
specification_version: 4
|
220
276
|
summary: Treasure Data API library for Ruby
|
221
277
|
test_files:
|
278
|
+
- spec/td/client_sched_spec.rb
|
279
|
+
- spec/td/client_spec.rb
|
222
280
|
- spec/td/client/access_control_api_spec.rb
|
223
281
|
- spec/td/client/account_api_spec.rb
|
224
|
-
- spec/td/client/api_error_spec.rb
|
225
282
|
- spec/td/client/api_spec.rb
|
226
283
|
- spec/td/client/api_ssl_connection_spec.rb
|
227
284
|
- spec/td/client/bulk_import_spec.rb
|
@@ -232,12 +289,10 @@ test_files:
|
|
232
289
|
- spec/td/client/job_api_spec.rb
|
233
290
|
- spec/td/client/model_job_spec.rb
|
234
291
|
- spec/td/client/model_schedule_spec.rb
|
235
|
-
- spec/td/client/model_schema_spec.rb
|
236
292
|
- spec/td/client/partial_delete_api_spec.rb
|
237
293
|
- spec/td/client/result_api_spec.rb
|
238
294
|
- spec/td/client/sched_api_spec.rb
|
239
295
|
- spec/td/client/server_status_api_spec.rb
|
240
296
|
- spec/td/client/table_api_spec.rb
|
241
297
|
- spec/td/client/user_api_spec.rb
|
242
|
-
|
243
|
-
- spec/td/client_spec.rb
|
298
|
+
has_rdoc: false
|