growthforecast 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -144,7 +144,7 @@ gf.add_graph('example', 'test', 'graph1')
144
144
 
145
145
  # add(spec)
146
146
  ## spec: instance of GrowthForecast::Graph
147
- spec = GrowthForecast::Graph({service_name: 'example', section_name: 'test', graph_name: 'graph1', color: '#0000ff'})
147
+ spec = GrowthForecast::Graph.new({service_name: 'example', section_name: 'test', graph_name: 'graph1', color: '#0000ff'})
148
148
  gf.add(spec)
149
149
  ```
150
150
 
@@ -162,7 +162,8 @@ gf.add_complex('example', 'test', 'summary1', 'testing...', true, 0, 'AREA', 'ga
162
162
 
163
163
  # add(spec)
164
164
  ## spec: instance of GrowthForecast::Complex
165
- spec = GrowthForecast::Complex({
165
+ spec = GrowthForecast::Complex.new({
166
+ complex: true,
166
167
  service_name: 'example', section_name: 'test', graph_name: 'summary1',
167
168
  description: 'testing...', sumup: true,
168
169
  data: graph_id_list.map{|id| GrowthForecast::Complex::Item.new({graph_id: id, type: 'AREA', gmode: 'gauge', stack: true}) }
@@ -8,7 +8,7 @@ class GrowthForecast::Complex
8
8
  attr_accessor :number, :data, :created_at, :updated_at
9
9
 
10
10
  # TODO strict validations
11
-
11
+
12
12
  def initialize(obj)
13
13
  if obj.is_a?(String)
14
14
  obj = JSON.parse(obj)
@@ -28,7 +28,7 @@ class GrowthForecast::Complex
28
28
  @description = obj[:description]
29
29
  @sort = (obj[:sort] || 19).to_i
30
30
  @sumup = obj[:sumup] ? true : false
31
- @data = (obj[:data] || []).map{|d| Item.new(d)}
31
+ @data = (obj[:data] || []).map{|d| d.is_a?(Item) ? d : Item.new(d)}
32
32
  @number = (obj[:number] || 0).to_i
33
33
  @created_at = obj[:created_at] ? Time.strptime(obj[:created_at], GrowthForecast::TIME_FORMAT) : nil
34
34
  @updated_at = obj[:updated_at] ? Time.strptime(obj[:updated_at], GrowthForecast::TIME_FORMAT) : nil
@@ -1,3 +1,3 @@
1
1
  class GrowthForecast
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growthforecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2013-02-04 00:00:00.000000000 Z
12
+ date: 2013-02-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Client library and tool to update values, create/edit/delete graphs of
15
15
  GrowthForecast