growthforecast 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 835154447cfabc62d3169a9ebe8a230b4ebb8130
4
+ data.tar.gz: d5a728b0343028f389b9a026550e691e0e49492a
5
+ SHA512:
6
+ metadata.gz: d05c911e8a90f067d8b38d77c94696dcd9efea2df360159d648726c73974f698218239a7a9382c5a252457b499d70330b11fff984b68403d7c3e70e526706979
7
+ data.tar.gz: 341c831d83339bead3ddf2ea28b1390c23b12f6955b8a782304dce36f27870c416cc8c5c7aa8c43284edd7855a513d66d641a64dface2614ad81ed1d0b102451
@@ -14,4 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "growthforecast"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = GrowthForecast::VERSION
17
+
18
+ gem.add_runtime_dependency "resolve-hostname"
17
19
  end
@@ -12,6 +12,8 @@ require 'net/http'
12
12
  require 'uri'
13
13
  require 'json'
14
14
 
15
+ require 'resolve/hostname'
16
+
15
17
  class GrowthForecast
16
18
  attr_accessor :host, :port, :prefix, :timeout, :debug
17
19
  attr_accessor :username, :password
@@ -29,6 +31,8 @@ class GrowthForecast
29
31
 
30
32
  @username = username
31
33
  @password = password
34
+
35
+ @resolver = Resolve::Hostname.new(:system_resolver => true)
32
36
  end
33
37
 
34
38
  def debug(mode=nil)
@@ -84,8 +88,11 @@ class GrowthForecast
84
88
  end
85
89
 
86
90
  def tree
91
+ list = self.all()
92
+ return {} if list.nil?
93
+
87
94
  root = {}
88
- self.all().each do |i|
95
+ list.each do |i|
89
96
  root[i.service_name] ||= {}
90
97
  root[i.service_name][i.section_name] ||= {}
91
98
  root[i.service_name][i.section_name][i.graph_name] = i
@@ -191,7 +198,7 @@ class GrowthForecast
191
198
  end
192
199
 
193
200
  def http_request(method, path, header={}, content=nil, getlist=false)
194
- conn = Net::HTTP.new(@host, @port)
201
+ conn = Net::HTTP.new(@resolver.getaddress(@host), @port)
195
202
  conn.open_timeout = conn.read_timeout = @timeout
196
203
  request_path = @prefix + path
197
204
  req = case method
@@ -202,6 +209,7 @@ class GrowthForecast
202
209
  else
203
210
  raise ArgumentError, "Invalid HTTP method for GrowthForecast: '#{method}'"
204
211
  end
212
+ req['Host'] = @host
205
213
  if content
206
214
  req.body = content
207
215
  end
@@ -41,7 +41,7 @@ module GrowthForecast::Client
41
41
  def self.execute_once(gf, cache, force, spec, keywords)
42
42
  # generate dictionary
43
43
  if spec['keywords'].size != keywords.size
44
- warn "Keyword mismatch, in spec: #{spec.keywords.join('/')}"
44
+ warn "Keyword mismatch, in spec: #{spec['keywords'].join('/')}"
45
45
  exit(2)
46
46
  end
47
47
  dic = Hash[[spec['keywords'], keywords].transpose]
@@ -1,3 +1,3 @@
1
1
  class GrowthForecast
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,16 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growthforecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - TAGOMORI Satoshi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2013-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: resolve-hostname
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
14
27
  description: Client library and tool to update values, create/edit/delete graphs of
15
28
  GrowthForecast
16
29
  email:
@@ -41,26 +54,26 @@ files:
41
54
  - lib/growthforecast/version.rb
42
55
  homepage: https://github.com/tagomoris/rb-growthforecast
43
56
  licenses: []
57
+ metadata: {}
44
58
  post_install_message:
45
59
  rdoc_options: []
46
60
  require_paths:
47
61
  - lib
48
62
  required_ruby_version: !ruby/object:Gem::Requirement
49
- none: false
50
63
  requirements:
51
- - - ! '>='
64
+ - - '>='
52
65
  - !ruby/object:Gem::Version
53
66
  version: '0'
54
67
  required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
68
  requirements:
57
- - - ! '>='
69
+ - - '>='
58
70
  - !ruby/object:Gem::Version
59
71
  version: '0'
60
72
  requirements: []
61
73
  rubyforge_project:
62
- rubygems_version: 1.8.21
74
+ rubygems_version: 2.0.2
63
75
  signing_key:
64
- specification_version: 3
76
+ specification_version: 4
65
77
  summary: A client library for GrowthForecast
66
78
  test_files: []
79
+ has_rdoc: