td-client 0.8.26 → 0.8.27
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/lib/td/client/api.rb +2 -2
- data/lib/td/client/model.rb +18 -6
- data/lib/td/client/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/lib/td/client/api.rb
CHANGED
@@ -158,7 +158,7 @@ class API
|
|
158
158
|
js = checked_json(body, %w[account])
|
159
159
|
a = js["account"]
|
160
160
|
plan = a['plan'].to_i
|
161
|
-
storage_size = a['storage_size'].
|
161
|
+
storage_size = a['storage_size'].to_i
|
162
162
|
return [plan, storage_size]
|
163
163
|
end
|
164
164
|
|
@@ -223,7 +223,7 @@ class API
|
|
223
223
|
count = (m['count'] || 0).to_i # TODO?
|
224
224
|
created_at = m['created_at']
|
225
225
|
updated_at = m['updated_at']
|
226
|
-
estimated_storage_size = m['estimated_storage_size']
|
226
|
+
estimated_storage_size = m['estimated_storage_size'].to_i
|
227
227
|
schema = JSON.parse(m['schema'] || '[]')
|
228
228
|
result[name] = [type, schema, count, created_at, updated_at, estimated_storage_size]
|
229
229
|
}
|
data/lib/td/client/model.rb
CHANGED
@@ -20,14 +20,14 @@ class Account < Model
|
|
20
20
|
attr_reader :plan, :storage_size
|
21
21
|
|
22
22
|
def storage_size_string
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
return "0.0 GB"
|
27
|
-
end
|
23
|
+
if @storage_size <= 1024*1024
|
24
|
+
return "0.0 GB"
|
25
|
+
elsif @storage_size <= 60*1024*1024
|
28
26
|
return "0.01 GB"
|
27
|
+
elsif @storage_size <= 10*1024*1024*1024
|
28
|
+
"%.1f GB" % (@storage_size.to_f / (1024*1024*1024))
|
29
29
|
else
|
30
|
-
|
30
|
+
"%d GB" % (@storage_size.to_f / (1024*1024*1024)).to_i
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -138,6 +138,18 @@ class Table < Model
|
|
138
138
|
def export(storage_type, opts={})
|
139
139
|
@client.export(@db_name, @table_name, storage_type, opts)
|
140
140
|
end
|
141
|
+
|
142
|
+
def estimated_storage_size_string
|
143
|
+
if @estimated_storage_size <= 1024*1024
|
144
|
+
return "0.0 GB"
|
145
|
+
elsif @estimated_storage_size <= 60*1024*1024
|
146
|
+
return "0.01 GB"
|
147
|
+
elsif @estimated_storage_size <= 10*1024*1024*1024
|
148
|
+
"%.1f GB" % (@estimated_storage_size.to_f / (1024*1024*1024))
|
149
|
+
else
|
150
|
+
"%d GB" % (@estimated_storage_size.to_f / (1024*1024*1024)).to_i
|
151
|
+
end
|
152
|
+
end
|
141
153
|
end
|
142
154
|
|
143
155
|
class Schema
|
data/lib/td/client/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.27
|
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: 2012-09-
|
12
|
+
date: 2012-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|