dasboard_client 0.0.0
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 +7 -0
- data/lib/dasboard_client.rb +32 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83e04d457149a551037bd4b3fa4e0432b16f71c3
|
4
|
+
data.tar.gz: cf00dda22c5ac6c62c1f23915f17e5926faebfad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: def4f9d3856b08ba9e1b20fa2757d8283e1cfdec6fd43d648b2bedc7adffb0b45e970ff298727e2d5e86db809c975e54a61071bd5c6b3a8aadf508266e80cb81
|
7
|
+
data.tar.gz: 2ab156aa33c947de97ae20c31303ed8c204c8101025f969d27e0c583ff08fde373acc669dbebea5539f599d75a094d4e3b1a7808ce38dfc69a268626b8c267dc
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'yaml'
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
class DasboardClient
|
6
|
+
def self.load_config
|
7
|
+
begin
|
8
|
+
config_location = Rails.root.join('config/dasboard.yml')
|
9
|
+
@@config = YAML.load_file(config_location)[Rails.env]
|
10
|
+
rescue Exception => err
|
11
|
+
puts config_location
|
12
|
+
throw Exception.new("Error loading DasBoard config from #{config_location}: #{err.message}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.post_stat(metric_name, value, date = Time.now)
|
17
|
+
metric_id = @@config["metrics"][metric_name.to_s]
|
18
|
+
|
19
|
+
url = "#{@@config["instance"]}/metrics/#{metric_id}/data"
|
20
|
+
data = {
|
21
|
+
data: {
|
22
|
+
date: date.to_i,
|
23
|
+
value: value
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
puts `curl -X POST -H "Content-Type: application/json" -d \
|
28
|
+
'#{data.to_json}' #{url}`
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
DasboardClient.load_config
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dasboard_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Cox
|
8
|
+
- Adam Mulligan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 3.0.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 3.0.0
|
28
|
+
description: Simple adaptor to allow posting stats to DasBoard
|
29
|
+
email:
|
30
|
+
- james.cox@unep-wcmc.org
|
31
|
+
- adam.mulligan@unep-wcmc.org
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- lib/dasboard_client.rb
|
37
|
+
homepage: http://rubygems.org/gems/dasboard_client
|
38
|
+
licenses:
|
39
|
+
- BSD
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.0.3
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: DasBoard ruby adaptor
|
61
|
+
test_files: []
|