growthforecast-client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc49802fafcfffae9ab1ba873d15a4d5e7d2118a
4
- data.tar.gz: 16c23fa49c8f1bf380d2adaa37b36a0cf3187329
3
+ metadata.gz: 0f08451a6391693686e7860e69d4c73e07332021
4
+ data.tar.gz: 9b40c514b10a6362fbaf075a70610f36a1514c22
5
5
  SHA512:
6
- metadata.gz: 091ffcb68fff297f93bdf5c91bb506d41c4e9b16a5e55788518f5cf8f8f35735e2557312ed484e61e71fb39ea73f6d1271361eec256c77d05bc227cf28d3dcdc
7
- data.tar.gz: 5464d4a3c35988b5f93502bc3c839de730c998f5a3ee2294a2651eb135139f818f378e4a7f7dca027bcaba88527f059afec3221f470d734d8900ca7b8e25d0e0
6
+ metadata.gz: 91f7bfe0c54e4768d8a952bec31930edd5071a1ec890091f3341be6463c90f76fe4136bcff88f3cc945aef7fe91ffe78bcc65e575863abdfc83c03e6c30c0b3f
7
+ data.tar.gz: 4a83edef7f730f1824ec975fc664bb67d1dccf969856d5ae8483b266cff6a86c2245c3757fcbfbf93a5eb7143cbfd170be1559d5fdbc73275997b558cf4cad38
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ # v0.0.3
2
+ Add bin/growthforecast-client delete_graph
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -2,4 +2,4 @@
2
2
  # -*- encoding: utf-8 -*-
3
3
 
4
4
  require 'growthforecast-client'
5
- CLI::GrowthforecastClient.start(ARGV)
5
+ GrowthForecast::CLI.start(ARGV)
@@ -1,2 +1,2 @@
1
1
  require 'growthforecast/client'
2
- require 'cli/growthforecast-client'
2
+ require 'growthforecast/cli'
@@ -1,8 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require 'thor'
3
3
 
4
- module CLI
5
- class GrowthforecastClient < Thor
4
+ class GrowthForecast::CLI < Thor
6
5
  desc 'delete_graph <url>', 'delete a graph or graphs under a url'
7
6
  long_desc <<-LONGDESC
8
7
  Delete a graph or graphs under a <url> where <url> is the one obtained from the view, e.g.,
@@ -23,6 +22,15 @@ class GrowthforecastClient < Thor
23
22
  puts "\tclass:#{e.class}\t#{e.message}"
24
23
  end
25
24
  end
25
+ graphs = client.list_complex(service_name, section_name, graph_name)
26
+ graphs.each do |graph|
27
+ begin
28
+ client.delete_complex(graph['service_name'], graph['section_name'], graph['graph_name'])
29
+ puts "Deleted #{e graph['service_name']}/#{e graph['section_name']}/#{e graph['graph_name']}"
30
+ rescue => e
31
+ puts "\tclass:#{e.class}\t#{e.message}"
32
+ end
33
+ end
26
34
  end
27
35
 
28
36
  no_tasks do
@@ -40,4 +48,4 @@ class GrowthforecastClient < Thor
40
48
  end
41
49
  end
42
50
  end
43
- end
51
+
@@ -221,8 +221,12 @@ module GrowthForecast
221
221
  # "section_name"=>"hostname",
222
222
  # "id"=>3},
223
223
  # ]
224
- def list_complex
225
- get_json('/json/list/complex')
224
+ def list_complex(service_name = nil, section_name = nil, graph_name = nil)
225
+ graphs = get_json('/json/list/complex')
226
+ graphs = graphs.select {|g| g['service_name'] == service_name } if service_name
227
+ graphs = graphs.select {|g| g['section_name'] == section_name } if section_name
228
+ graphs = graphs.select {|g| g['graph_name'] == graph_name } if graph_name
229
+ graphs
226
230
  end
227
231
 
228
232
  # Create a complex graph
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CLI::GrowthforecastClient do
3
+ describe GrowthForecast::CLI do
4
4
  include_context "setup_growthforecast_client"
5
- before(:all) { @cli = CLI::GrowthforecastClient.new }
5
+ before(:all) { @cli = GrowthForecast::CLI.new }
6
6
 
7
7
  context "#split_path" do
8
8
  context 'list service url' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growthforecast-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-18 00:00:00.000000000 Z
11
+ date: 2013-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -120,6 +120,7 @@ files:
120
120
  - .rdebugrc
121
121
  - .rspec
122
122
  - .travis.yml
123
+ - CHANGELOG.md
123
124
  - Gemfile
124
125
  - LICENSE
125
126
  - README.md
@@ -129,10 +130,10 @@ files:
129
130
  - examples/create_complex.rb
130
131
  - examples/edit_graph.rb
131
132
  - growthforecast-client.gemspec
132
- - lib/cli/growthforecast-client.rb
133
133
  - lib/growthforecast-client.rb
134
+ - lib/growthforecast/cli.rb
134
135
  - lib/growthforecast/client.rb
135
- - spec/cli/growthforecast-client_spec.rb
136
+ - spec/growthforecast/cli_spec.rb
136
137
  - spec/growthforecast/client_spec.rb
137
138
  - spec/spec_helper.rb
138
139
  - spec/support/mock.rb
@@ -161,7 +162,7 @@ signing_key:
161
162
  specification_version: 4
162
163
  summary: A Ruby Client Library for GrowthForecast API
163
164
  test_files:
164
- - spec/cli/growthforecast-client_spec.rb
165
+ - spec/growthforecast/cli_spec.rb
165
166
  - spec/growthforecast/client_spec.rb
166
167
  - spec/spec_helper.rb
167
168
  - spec/support/mock.rb