sinatra-geckoboard 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +21 -0
  2. data/lib/sinatra/geckoboard.rb +25 -0
  3. metadata +15 -15
data/README.md CHANGED
@@ -63,6 +63,27 @@ Render a Geck-O-Meter widget.
63
63
  geck_o_meter(number, max, min)
64
64
  ```
65
65
 
66
+ ### RAG
67
+
68
+ Render a RAG widget.
69
+
70
+ ```ruby
71
+ red = {value: 4, text: 'Plop'}
72
+ amber = {value: 4, text: 'Plop'}
73
+ green = {value: 4, text: 'Plop'}
74
+ rag(red, amber, green)
75
+ ```
76
+
77
+ ### Number + optional secondary stat
78
+
79
+ Render a Number widget.
80
+
81
+ ```ruby
82
+ number1 = {value: 4, text: 'Plop'}
83
+ number2 = {value: 5, text: 'Plop'}
84
+ number(number1[, number2])
85
+ ```
86
+
66
87
  ## License
67
88
 
68
89
  MIT License
@@ -56,6 +56,31 @@ module Sinatra
56
56
  render_widget "item" => value, "max" => max, "min" => min
57
57
  end
58
58
 
59
+ # Render a RAG widget
60
+ # Set content type as json
61
+ # http://support.geckoboard.com/entries/231507-custom-widget-type-definitions
62
+ #
63
+ # @param [Hash] red
64
+ # @param [Hash] amber
65
+ # @param [Hash] green
66
+ # @return [String] the rag widget as json string
67
+ def rag(red, amber, green)
68
+ render_widget "item" => [red, amber, green]
69
+ end
70
+
71
+ # Render a number widget
72
+ # Set content type as json
73
+ # http://support.geckoboard.com/entries/231507-custom-widget-type-definitions
74
+ #
75
+ # @param [Hash] number1
76
+ # @param [Hash] number2
77
+ # @return [String] the number widget as jons string
78
+ def number(number1, number2=nil)
79
+ values = [number1]
80
+ values << number2 unless number2.nil?
81
+ render_widget "item" => values
82
+ end
83
+
59
84
  protected
60
85
  def render_widget(widget)
61
86
  content_type :json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-geckoboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-24 00:00:00.000000000Z
12
+ date: 2011-12-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &18868100 !ruby/object:Gem::Requirement
16
+ requirement: &7573620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18868100
24
+ version_requirements: *7573620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &18904260 !ruby/object:Gem::Requirement
27
+ requirement: &7609660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *18904260
35
+ version_requirements: *7609660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &18903880 !ruby/object:Gem::Requirement
38
+ requirement: &7609280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *18903880
46
+ version_requirements: *7609280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
- requirement: &18903340 !ruby/object:Gem::Requirement
49
+ requirement: &7608740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *18903340
57
+ version_requirements: *7608740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &18902920 !ruby/object:Gem::Requirement
60
+ requirement: &7608320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *18902920
68
+ version_requirements: *7608320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
- requirement: &18902460 !ruby/object:Gem::Requirement
71
+ requirement: &7607860 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *18902460
79
+ version_requirements: *7607860
80
80
  description: A little Sinatra extension to expose data nicely to Geckoboard.
81
81
  email: francois.de.metz@af83.com
82
82
  executables: []
@@ -87,7 +87,7 @@ files:
87
87
  - README.md
88
88
  - Gemfile
89
89
  - lib/sinatra/geckoboard.rb
90
- homepage:
90
+ homepage: https://github.com/AF83/sinatra-geckoboard
91
91
  licenses: []
92
92
  post_install_message:
93
93
  rdoc_options: []