td-client 0.8.27 → 0.8.28
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 +6 -0
- data/lib/td/client.rb +6 -1
- data/lib/td/client/api.rb +19 -1
- data/lib/td/client/model.rb +4 -2
- data/lib/td/client/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/lib/td/client.rb
CHANGED
@@ -43,10 +43,15 @@ class Client
|
|
43
43
|
|
44
44
|
# => Account
|
45
45
|
def account
|
46
|
-
plan, storage = @api.show_account
|
46
|
+
plan, storage, guaranteed_cores, maximum_cores = @api.show_account
|
47
47
|
return Account.new(self, plan, storage)
|
48
48
|
end
|
49
49
|
|
50
|
+
def core_utilization(from, to)
|
51
|
+
from, to, interval, history = @api.account_core_utilization(from, to)
|
52
|
+
return from, to, interval, history
|
53
|
+
end
|
54
|
+
|
50
55
|
# => [Database]
|
51
56
|
def databases
|
52
57
|
m = @api.list_databases
|
data/lib/td/client/api.rb
CHANGED
@@ -159,7 +159,25 @@ class API
|
|
159
159
|
a = js["account"]
|
160
160
|
plan = a['plan'].to_i
|
161
161
|
storage_size = a['storage_size'].to_i
|
162
|
-
|
162
|
+
guaranteed_cores = a['guaranteed_cores'].to_i
|
163
|
+
maximum_cores = a['maximum_cores'].to_i
|
164
|
+
return [plan, storage_size, guaranteed_cores, maximum_cores]
|
165
|
+
end
|
166
|
+
|
167
|
+
def account_core_utilization(from, to)
|
168
|
+
params = { }
|
169
|
+
params['from'] = from.to_s if from
|
170
|
+
params['to'] = to.to_s if to
|
171
|
+
code, body, res = get("/v3/account/core_utilization", params)
|
172
|
+
if code != "200"
|
173
|
+
raise_error("Show account failed", res)
|
174
|
+
end
|
175
|
+
js = checked_json(body, %w[from to interval history])
|
176
|
+
from = Time.parse(js['from']).utc
|
177
|
+
to = Time.parse(js['to']).utc
|
178
|
+
interval = js['interval'].to_i
|
179
|
+
history = js['history']
|
180
|
+
return [from, to, interval, history]
|
163
181
|
end
|
164
182
|
|
165
183
|
|
data/lib/td/client/model.rb
CHANGED
@@ -11,13 +11,15 @@ class Model
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Account < Model
|
14
|
-
def initialize(client, plan, storage_size=nil)
|
14
|
+
def initialize(client, plan, storage_size=nil, guaranteed_cores=nil, maximum_cores=nil)
|
15
15
|
super(client)
|
16
16
|
@plan = plan
|
17
17
|
@storage_size = storage_size
|
18
|
+
@guaranteed_cores = guaranteed_cores
|
19
|
+
@maximum_cores = maximum_cores
|
18
20
|
end
|
19
21
|
|
20
|
-
attr_reader :plan, :storage_size
|
22
|
+
attr_reader :plan, :storage_size, :guaranteed_cores, :maximum_cores
|
21
23
|
|
22
24
|
def storage_size_string
|
23
25
|
if @storage_size <= 1024*1024
|
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.28
|
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-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|