gooddata 0.6.0.pre9 → 0.6.0.pre10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/.gitignore +3 -0
  2. data/.rspec +3 -0
  3. data/.yardopts +19 -0
  4. data/Gemfile +5 -0
  5. data/README.md +191 -0
  6. data/Rakefile +18 -1
  7. data/bin/gooddata +74 -63
  8. data/doc/.gitignore +1 -0
  9. data/doc/css/.gitkeepme +1 -0
  10. data/doc/images/.gitkeepme +1 -0
  11. data/doc/images/background.png +0 -0
  12. data/doc/images/bg-callout-button.png +0 -0
  13. data/doc/images/header-logo.png +0 -0
  14. data/doc/images/logo-image.png +0 -0
  15. data/doc/js/.gitkeepme +1 -0
  16. data/doc/pages/GET_STARTED.md +309 -0
  17. data/doc/pages/HOMEPAGE.md +75 -0
  18. data/doc/pages/TUTORIALS.md +52 -0
  19. data/doc/pages/tutorial/BRICKS.md +257 -0
  20. data/doc/pages/tutorial/CREATING_A_MODEL.md +79 -0
  21. data/doc/pages/tutorial/CRUNCHING_NUMBERS.md +233 -0
  22. data/doc/pages/tutorial/TEST_DRIVEN_DEVELOPMENT.md +118 -0
  23. data/doc/pages/tutorial/YOUR_FIRST_PROJECT.md +52 -0
  24. data/doc/templates/default/class/dot/setup.rb +6 -0
  25. data/doc/templates/default/class/dot/superklass.erb +3 -0
  26. data/doc/templates/default/class/setup.rb +36 -0
  27. data/doc/templates/default/class/text/setup.rb +11 -0
  28. data/doc/templates/default/class/text/subclasses.erb +5 -0
  29. data/doc/templates/default/constant/text/header.erb +11 -0
  30. data/doc/templates/default/constant/text/setup.rb +3 -0
  31. data/doc/templates/default/docstring/setup.rb +51 -0
  32. data/doc/templates/default/docstring/text/abstract.erb +2 -0
  33. data/doc/templates/default/docstring/text/deprecated.erb +2 -0
  34. data/doc/templates/default/docstring/text/index.erb +2 -0
  35. data/doc/templates/default/docstring/text/note.erb +4 -0
  36. data/doc/templates/default/docstring/text/private.erb +2 -0
  37. data/doc/templates/default/docstring/text/returns_void.erb +1 -0
  38. data/doc/templates/default/docstring/text/text.erb +1 -0
  39. data/doc/templates/default/docstring/text/todo.erb +4 -0
  40. data/doc/templates/default/layout/dot/header.erb +6 -0
  41. data/doc/templates/default/layout/dot/setup.rb +14 -0
  42. data/doc/templates/default/method/setup.rb +3 -0
  43. data/doc/templates/default/method/text/header.erb +1 -0
  44. data/doc/templates/default/method_details/setup.rb +10 -0
  45. data/doc/templates/default/method_details/text/header.erb +10 -0
  46. data/doc/templates/default/method_details/text/method_signature.erb +12 -0
  47. data/doc/templates/default/method_details/text/setup.rb +10 -0
  48. data/doc/templates/default/module/dot/child.erb +1 -0
  49. data/doc/templates/default/module/dot/dependencies.erb +3 -0
  50. data/doc/templates/default/module/dot/header.erb +6 -0
  51. data/doc/templates/default/module/dot/info.erb +14 -0
  52. data/doc/templates/default/module/dot/setup.rb +14 -0
  53. data/doc/templates/default/module/setup.rb +164 -0
  54. data/doc/templates/default/module/text/children.erb +10 -0
  55. data/doc/templates/default/module/text/class_meths_list.erb +8 -0
  56. data/doc/templates/default/module/text/extends.erb +8 -0
  57. data/doc/templates/default/module/text/header.erb +7 -0
  58. data/doc/templates/default/module/text/includes.erb +8 -0
  59. data/doc/templates/default/module/text/instance_meths_list.erb +8 -0
  60. data/doc/templates/default/module/text/setup.rb +12 -0
  61. data/doc/templates/default/root/dot/child.erb +3 -0
  62. data/doc/templates/default/root/dot/setup.rb +5 -0
  63. data/doc/templates/default/tags/setup.rb +55 -0
  64. data/doc/templates/default/tags/text/example.erb +12 -0
  65. data/doc/templates/default/tags/text/index.erb +1 -0
  66. data/doc/templates/default/tags/text/option.erb +20 -0
  67. data/doc/templates/default/tags/text/overload.erb +19 -0
  68. data/doc/templates/default/tags/text/see.erb +11 -0
  69. data/doc/templates/default/tags/text/tag.erb +13 -0
  70. data/examples.rb +2 -2
  71. data/gooddata.gemspec +31 -26
  72. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +1 -1
  73. data/lib/gooddata/client.rb +65 -53
  74. data/lib/gooddata/commands/commands.rb +9 -0
  75. data/lib/gooddata/commands/process.rb +9 -8
  76. data/lib/gooddata/commands/projects.rb +29 -0
  77. data/lib/gooddata/commands/runners.rb +1 -1
  78. data/lib/gooddata/connection.rb +6 -4
  79. data/lib/gooddata/exceptions.rb +2 -1
  80. data/lib/gooddata/helpers.rb +1 -1
  81. data/lib/gooddata/model.rb +360 -189
  82. data/lib/gooddata/models/metadata.rb +1 -1
  83. data/lib/gooddata/models/metric.rb +2 -1
  84. data/lib/gooddata/models/project.rb +1 -1
  85. data/lib/gooddata/models/report.rb +0 -18
  86. data/lib/gooddata/version.rb +1 -1
  87. data/spec/blueprint_spec.rb +83 -43
  88. data/spec/data/additional_dataset_module.json +18 -0
  89. data/spec/data/blueprint_invalid.json +36 -0
  90. data/spec/data/blueprint_valid.json +37 -0
  91. data/spec/data/model_module.json +18 -0
  92. data/spec/{test_project_model_spec.json → data/test_project_model_spec.json} +4 -0
  93. data/spec/full_project_spec.rb +4 -3
  94. data/spec/helpers/blueprint_helper.rb +17 -0
  95. data/spec/merging_blueprints_spec.rb +23 -48
  96. data/spec/model_dsl_spec.rb +2 -2
  97. data/spec/model_spec.rb +44 -0
  98. data/spec/project_build_and_update_spec.rb +28 -0
  99. data/spec/spec_helper.rb +6 -0
  100. data/yard-server.sh +3 -0
  101. metadata +251 -74
  102. data/README.rdoc +0 -176
@@ -0,0 +1 @@
1
+ html/
@@ -0,0 +1 @@
1
+ KEEP THIS FILE !!!
@@ -0,0 +1 @@
1
+ KEEP THIS FILE !!!
Binary file
Binary file
@@ -0,0 +1 @@
1
+ KEEP THIS FILE !!!
@@ -0,0 +1,309 @@
1
+ <div class="container-narrow">
2
+
3
+ <h1>Get Started</h1>
4
+
5
+ <p>
6
+ You just installed the Ruby GEM and want to start playing around, right? Follow this guide to learn more about the
7
+ basics and most common use cases.
8
+ </p>
9
+
10
+ <p>
11
+ And what you will learn? You will learn how to:<br/><br/>
12
+ <a class="topics" href="#login">Login to GoodData with gem</a><br/>
13
+ <a class="topics" href="#direct">Direct Post Requests</a><br/>
14
+ <a class="topics" href="#retrieve">Retrieving Objects</a><br/>
15
+ <a class="topics" href="#metrics">Metrics (not only) Creation</a><br/>
16
+ <a class="topics" href="#reports">Report Handling</a><br/>
17
+ <a class="topics" href="#dashboards">Dashboard Operations</a><br/>
18
+ </p>
19
+
20
+ <h2>Install</h2>
21
+
22
+ <p>If you are using bundler. Add</p>
23
+ <pre>
24
+ gem "gooddata"
25
+ </pre>
26
+ <p>into Gemfile and run</p>
27
+ <pre>
28
+ bundle install
29
+ </pre>
30
+ <p>If you are using gems just</p>
31
+ <pre>
32
+ gem install gooddata --version0.6.0.pre9
33
+ </pre>
34
+
35
+ <a name="login"></a>
36
+
37
+ <h2>Logging in</h2>
38
+
39
+ <pre>
40
+ GoodData.connect( :login => 'svarovsky@gooddata.com',
41
+ :password => 'pass',
42
+ :server => "https://na1.secure.gooddata.com",
43
+ :webdav_server => "https://na1-di.gooddata.com",
44
+ :token => "asdasdas")
45
+ </pre>
46
+
47
+ <p>Picking project to work with. There are several ways how to do it.</p>
48
+
49
+ <pre>
50
+ GoodData.connect( :login => 'svarovsky@gooddata.com',
51
+ :password => 'pass',
52
+ :project => 'project_pid')
53
+
54
+ GoodData.project = 'project_pid'
55
+
56
+ GoodData.use = 'project_pid'
57
+ </pre>
58
+
59
+ <p>This will let you work with the project in a block. The project has the value you picked only inside the block
60
+ afterwards it will reset the project value to whatever it was before.</p>
61
+
62
+ <pre>
63
+ GoodData.with_project('project_pid') do |project|
64
+ puts project.uri
65
+ end
66
+ </pre>
67
+
68
+ <a name="direct"></a>
69
+
70
+ <h2>Directly accessing API</h2>
71
+
72
+ <p>This is the most crude method and while you can do anything with it is also most cumbersome. It is needed sometimes
73
+ though so we are mentioneing it here. Gem will make sure that it does the plumbing like keeping you logged in etc
74
+ and you can just use the HTTP methods you are used to</p>
75
+
76
+ <pre>
77
+ GoodData.get("uri")
78
+ GoodData.post("uri", {:name => "John Doe"})
79
+ GoodData.put("uri", {:name => "John Doe"})
80
+ GoodData.delete("uri")
81
+ </pre>
82
+
83
+ <p>Nothing surprising</p>
84
+
85
+ <a name="retrieve"></a>
86
+
87
+ <h2>Retrieving objects</h2>
88
+
89
+ <p>There are several wrappers for different types of objects. There are some common things you can do with them.</p>
90
+
91
+ <p>You can retrieve all objects of that type.</p>
92
+
93
+ <pre>
94
+ reports = GoodData::Report[:all]
95
+ </pre>
96
+
97
+ <p>You can retrieve specific one</p>
98
+
99
+ <pre>
100
+ report = GoodData::Report["/gdc/md/pid/12"]
101
+ report = GoodData::Report[12]
102
+ </pre>
103
+
104
+
105
+ <p>You can retrieve reports based on tags</p>
106
+
107
+ <pre>
108
+ reports = GoodData::Report.find_by_tag("some_tag")
109
+ </pre>
110
+
111
+ <p>You can retrieve an object based on a title</p>
112
+
113
+ <pre>
114
+ report = GoodData::Report.find_first_by_title('My first report')
115
+ </pre>
116
+
117
+ <p>You can set some basic things like summary and title</p>
118
+
119
+ <pre>
120
+ report.title = "New title"
121
+ report.summary = "This is some fancy description"
122
+ </pre>
123
+
124
+ <p>You can also save the object back to the server</p>
125
+
126
+ <pre>report.save</pre>
127
+
128
+ <p>And then you can delete it</p>
129
+
130
+ <pre>
131
+ report.delete
132
+ </pre>
133
+
134
+ <p>Since metadata about project is one big tree you can also ask which object are used by or using other objects. For
135
+ example what reports are on a dashboard</p>
136
+
137
+ <pre>
138
+ report.get_used_by
139
+ report.get_using
140
+ </pre>
141
+
142
+ <p>What we just showed you can be done with all Metadata objects. These include Report, Dashboard, Metric, Attribute,
143
+ Fact</p>
144
+
145
+ <a name="metrics"></a>
146
+
147
+ <h2>Metrics</h2>
148
+
149
+ <p>Probably the most useful and complex obect is a metric. For its definition we are using language called MAQL. There
150
+ is one big drawback to current MAQL definition and that is how it reffers to another object. If you imagine a simple
151
+ metric definition like 'sum of all amounts' it could be described like this "SELECT SUM(Amount)". The problem is
152
+ that the proper maql definition is as follows
153
+
154
+ <pre>SELECT SUM([/gdc/md/project_id/obj/123])</pre>
155
+
156
+ </p>As you can see the reference to Amount fact is done via an URI. This has a big advantage of being unambiguous but it
157
+ has a bg drawback that t cannot be written buy hand and also it is not transferable between projects without some
158
+ translation.</p>
159
+
160
+ <p>Here we introduce eXtended MAQL which tries to mitigate some of the drawbacks. The implementation acurrently relies
161
+ on titles of objects and might change. In XMAQL there are only 4 additions<br/>
162
+ 1) fact is referenced like #"Amount"<br/>
163
+ 2) attribute like @"User Name"<br/>
164
+ 3) metric like ?"My metric"<br/>
165
+ 4) attribute value like $"United States"<br/>
166
+ </p>
167
+
168
+ <p>The aforementioned metric could be then expressed like this 'SELECT SUM(#"Amount")'. This allows to be explicit in
169
+ what type you are reffering to since MAQL is fairly complex and allows you to write them by hand. Also transfering
170
+ metrics nbetween objects is more transpoarent.</p>
171
+
172
+ <p>You can create a metric</p>
173
+
174
+ <pre>
175
+ m = Metric.create(:title => "My metric", :expression => 'SELECT SUM(["/gdc/md/1231231/obj/12"])')
176
+ m.save
177
+ </pre>
178
+
179
+ <p>If you want to use eXtended notation use xcreate or pass :extended => true option to the create method</p>
180
+
181
+ <pre>
182
+ m = Metric.create(:title => "My metric", :expression => 'SELECT SUM(#"Amount")', :extended => true)
183
+ m = Metric.xcreate(:title => "My metric", :expression => 'SELECT SUM(#"Amount")')
184
+ </pre>
185
+
186
+ <p>You can directly execute it which will return a number</p>
187
+
188
+ <pre>
189
+ m.execute
190
+ </pre>
191
+
192
+ <p>Note on executing metrics. Since GoodData currently cannot execute metric which is not saved there is some behavior
193
+ that might surprise you when executing unsaved metrics on the fly. If you execute a metric or use a metric in a
194
+ report it takes all unsaved metrics and saves them. After execution it takes those that it had to save and deletes
195
+ them so they are not visible and cluttering the system. If you are creating a metric to be really saved do save it
196
+ immediately. This will hopefully change as we will allow execution of metrics that are inlined in execution
197
+ description.</p>
198
+
199
+ <a name="reports"></a>
200
+
201
+ <h2>Reports</h2>
202
+
203
+ <p>You can execute report</p>
204
+
205
+ <pre>
206
+ report = report = GoodData::Report["/gdc/md/pid/12"]
207
+ result = report.execute
208
+ </pre>
209
+
210
+ <p>with result you can print it (needs more work, it roughly works but attribute reports only do not work)</p>
211
+
212
+ <pre>
213
+ result.print
214
+ </pre>
215
+
216
+ <p>You can export it to a file. This needs some work so it warns you if it does not make sense to export you report in
217
+ given format I think that our platfrom does not support all combinations. Currently there is :pdf, :png and :csv
218
+ supported</p>
219
+
220
+ <pre>
221
+ File.open('dash.pdf', 'w') do |f|
222
+ f.write(report.export(:pdf))
223
+ end
224
+ </pre>
225
+
226
+ <p>You can also create a report on the fly.</p>
227
+
228
+ <pre>
229
+ metric = GoodData::Metric.xcreate(:title => "My Metric", :expression => 'SELECT SUM(#"amount")')
230
+ metric.save
231
+
232
+ report = GoodData::Report.create(:title => "My report",:left => 'user', :top => metric)
233
+ report.save
234
+ </pre>
235
+
236
+ <p>There are some rules that need explanation. The report is structured a little different than in UI. You specify left
237
+ and top. It can either be an attribute or a metric. There can be multiple metrics but all of those need to be either
238
+ in top or left section. The objects can be specified in several ways. You can provide Attribute but remember that
239
+ eventually GoodData needs Label information (on API you can hit name display form). If you provide attribute it will
240
+ resolve to its first Label. If an attribute has more than one it will take the first.</p>
241
+
242
+ <p>1) MD object. Metric, Attribute and Label
243
+ 2) hash. If you do not have the object handy you can pass a hash structure like this {:type => :attribute, :title =>
244
+ 'some title'}. It will perform the lookup for you. This currently works for :attribute and :metric. If you want to
245
+ perform the lookup through identifier you can do it as well. Since id is unique {:identifier => 'some id'}
246
+ 3) String. If you put there a string it is assumed it is a name of an attribute so 'some title' is equivalent with
247
+ typing {:type => :attribute, :title => 'some title'}</p>
248
+
249
+ <p>TODO
250
+ Describe filtering</p>
251
+
252
+ <a name="dashboards"></a>
253
+
254
+ <h2>Dashboards</h2>
255
+
256
+ <p>You can export whole dashboards</p>
257
+
258
+ <pre>
259
+ dash = GoodData::Dashboard[33807]
260
+ File.open('dash.pdf', 'w') do |f|
261
+ f.write(dash.export(:pdf))
262
+ end
263
+ </pre>
264
+
265
+ <p>or just a specific tab</p>
266
+
267
+ <pre>
268
+ dash = GoodData::Dashboard[33807]
269
+ File.open('dash.pdf', 'w') do |f|
270
+ f.write(dash.export(:pdf, :tab => dash.tabs_ids.last))
271
+ end
272
+ </pre>
273
+
274
+ <p>
275
+ Project
276
+ create a project
277
+ clone a project
278
+ rename a project
279
+ delete a project
280
+ TBD - add a user
281
+ TBD - remove a user
282
+
283
+ Domain (Organization)
284
+ Add a user to a domain
285
+
286
+ Project Datasets
287
+ Create a model
288
+ Load data
289
+ </p>
290
+
291
+ <div class="section-nav">
292
+ <div class="left align-right">
293
+
294
+ <span class="prev disabled">Back</span>
295
+
296
+ </div>
297
+ <div class="right align-left">
298
+
299
+ <a href="/docs/file/doc/pages/TUTORIALS.md" class="next">
300
+ Next
301
+ </a>
302
+
303
+ </div>
304
+ <div class="clear"></div>
305
+ </div>
306
+
307
+ </div>
308
+
309
+ </div>
@@ -0,0 +1,75 @@
1
+ <div class="jumbotron">
2
+ <!-- style="background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,white), color-stop(100%,#6d3353));"> -->
3
+
4
+ <a href="http://sdk.gooddata.com" id="left-floater">
5
+ <p style="margin-top: 5px;">See other <br />SDKs</p>
6
+ </a>
7
+
8
+ <img src="http://www.prestonlee.com/wp-content/uploads/2008/09/ruby.png" width="200px" style="margin-bottom: 10px;">
9
+ <br />
10
+
11
+ <h1>Leverage power of GoodData API.<br />Now.</h1>
12
+
13
+ <a class="callout" target="_blank" href="https://github.com/gooddata/gooddata-ruby">Fork me on Github</a>
14
+ <div style="margin-top: 25px;">
15
+ <iframe src="http://ghbtns.com/github-btn.html?user=gooddata&repo=gooddata-ruby&type=watch&count=true&size=large"
16
+ allowtransparency="true" frameborder="0" scrolling="0" width="170" height="30"></iframe>
17
+ <a href="https://twitter.com/gooddata_dev" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @gooddata_dev</a>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="divider">
22
+ <h2>Feature set that rocks!</h2>
23
+ </div>
24
+
25
+ <div class="container-narrow">
26
+
27
+ <div class="row-fluid marketing">
28
+ <div class="span6">
29
+ <div>
30
+ <img src="http://www.defaulticon.com/sites/default/files/styles/icon-front-page-32x32-preview/public/field/image/MD-shuffle.png?itok=zffXPwRr" width="50px">
31
+ <h4 style="display: inline;">Expressive</h4>
32
+ <p>Do more with less code.</p>
33
+ </div>
34
+
35
+ <div>
36
+ <img src="http://www.defaulticon.com/sites/default/files/styles/icon-front-page-32x32-preview/public/field/image/hammer.png?itok=GwaBj_x2" width="50px">
37
+ <h4 style="display: inline;">Battle Tested</h4>
38
+ <p>Used on 10s of projects written by people at GoodData.</p>
39
+ </div>
40
+
41
+
42
+ </div>
43
+
44
+ <div class="span6">
45
+
46
+
47
+ <div>
48
+
49
+ <img src="http://www.defaulticon.com/sites/default/files/styles/icon-front-page-32x32-preview/public/field/image/plugin-disabled.png?itok=lVgrl6D3" width="50px">
50
+ <h4 style="display: inline;">Automation friendly</h4>
51
+ <p>No more manual jobs.</p>
52
+ </div>
53
+
54
+ <div><img src="http://www.defaulticon.com/sites/default/files/styles/icon-front-page-32x32-preview/public/field/image/layers_0.png?itok=wBvb1GYw" width="50px">
55
+ <h4 style="display: inline;">Full stack</h4>
56
+ <p>The whole cycle of a project done using dev familiar tools.</p>
57
+ </div>
58
+
59
+ </div>
60
+
61
+ </div>
62
+ </div>
63
+
64
+ <div class="divider">
65
+ <h2>The Story</h2>
66
+ </div>
67
+
68
+ <div class="row-fluid marketing container-narrow" style="margin: auto;">
69
+
70
+ <div class="span12" >
71
+ <div style="margin: 25px 0 25px 0;font-size: 18px;line-height:1.3;">
72
+ Since its beginning, GoodData was alway super adamant to have everything accessible over APIs. GoodData Ruby SDK is the most polished wrapper over them. It gives high level way to work with the most common tasks and provides low level plumbing to let you play with any API with ease. If you wanted to automate your latest project look no further.
73
+ </div>
74
+ </div>
75
+ </div>
@@ -0,0 +1,52 @@
1
+ <div class="container-narrow">
2
+ <ul class="posts">
3
+
4
+
5
+ <div>
6
+ <a href="/docs/file/doc/pages/tutorial/YOUR_FIRST_PROJECT.md"><h3>Your first project</h3></a>
7
+
8
+ <div>Let's spin up a project that will be the base for other tutorials. It will take only 5 mins. Promise.
9
+ </div>
10
+ </div>
11
+
12
+
13
+ <div>
14
+ <a href="/docs/file/doc/pages/tutorial/TEST_DRIVEN_DEVELOPMENT.md"><h3>Test driven
15
+ development</h3></a>
16
+
17
+ <div>Let's have a look how you can bump project development a little to achieve test driven development of
18
+ your reports and projects.
19
+ </div>
20
+ </div>
21
+
22
+
23
+ <div>
24
+ <a href="/docs/file/doc/pages/tutorial/CREATING_A_MODEL.md"><h3>Creating a model</h3></a>
25
+
26
+ <div>Model plays a huge role in the Reporting process. Let's have a look on how to create it using Ruby SDK
27
+ and compare it with other approaches.
28
+ </div>
29
+ </div>
30
+
31
+
32
+ <div>
33
+ <a href="/docs/file/doc/pages/tutorial/CRUNCHING_NUMBERS.md"><h3>Crunching numbers</h3></a>
34
+
35
+ <div>Regardless of how much other things there are in the project the most important thing is to get some
36
+ numbers out. Let's do it. With Ruby.
37
+ </div>
38
+ </div>
39
+
40
+
41
+ <div>
42
+ <a href="/docs/file/doc/pages/tutorial/ON_GOOD_DATA_PLATFORM.md"><h3>Executing ruby on GoodData plaform</h3>
43
+ </a>
44
+
45
+ <div>ETL is the back bone of every project. But project is not just about crunching numbers. What to do with
46
+ tasks that are very well suited for solving by a regular programming language, like Ruby?
47
+ </div>
48
+ </div>
49
+
50
+
51
+ </ul>
52
+ </div>