Skip to content

Commit ec8cd0a

Browse files
committed
Merge branch 'master' of github.com:gooddata/gooddata-ruby
Conflicts: .yardopts lib/gooddata/version.rb
2 parents 08b5ee1 + 95f5895 commit ec8cd0a

File tree

107 files changed

+1404
-1068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1404
-1068
lines changed

.autotest

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Customize autotest behavior here
2+

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ pkg
2424

2525
## PROJECT::SPECIFIC
2626
Gemfile.lock
27+
28+
# YARD
29+
.yardoc/

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: ruby
2+
rvm:
3+
- 1.9.3
4+
- 2.1.0
5+
- ruby-head
6+
7+
script: rake test:unit

.yardopts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--template-path doc/templates
2+
--plugin rspec
23
--template default
34
--protected
45
--no-private
@@ -15,7 +16,7 @@
1516
--output-dir doc/html
1617
lib/**/*.rb
1718
ext/**/*{.m,.c}
18-
spec/**/*.rb
19+
spec/**/*_spec.rb
1920
-
2021
README.md
2122
doc/pages/**/*.md

README.md

+8-145
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# GoodData Ruby wrapper and CLI
1+
# GoodData API Ruby wrapper and CLI
22

33
A convenient Ruby wrapper around the GoodData RESTful API. The gem comes in two flavors.
44
It has a CLI client and it is a library which you can integrate into your application.
55

66
The best documentation for the GoodData API can be found using these resources:
77

8+
* sdk.gooddata.com/gooddata-ruby/
89
* http://docs.gooddata.apiary.io/
910
* http://developer.gooddata.com/api
1011
* https://secure.gooddata.com/gdc
@@ -14,162 +15,24 @@ The best documentation for the GoodData API can be found using these resources:
1415
[![Gem Version](https://badge.fury.io/rb/gooddata.png)](http://badge.fury.io/rb/gooddata)
1516
[![Dependency Status](https://gemnasium.com/gooddata/gooddata-ruby.png)](https://gemnasium.com/gooddata/gooddata-ruby)
1617
[![Code Climate](https://codeclimate.com/github/gooddata/gooddata-ruby.png)](https://codeclimate.com/github/gooddata/gooddata-ruby)
18+
[![Build Status](https://travis-ci.org/korczis/gooddata-ruby.png?branch=refactor)](https://travis-ci.org/korczis/gooddata-ruby)
1719

1820
## Install
1921

20-
If you are using bundler. Add
22+
If you are using bundler. Add
2123

2224
gem "gooddata"
2325

24-
into Gemfile
26+
into Gemfile
2527

26-
and run
28+
and run
2729

2830
bundle install
2931

3032
If you are using gems just
3133

3234
gem install gooddata
3335

34-
35-
### Library usage
36-
37-
38-
In its most simple form GoodData gem just cares about the logging in and juggling the tokens that are needed for you to retrive information. It provides you the usual HTTP methods that you are used to. Couple of examples.
39-
40-
#### Authentiacation
41-
42-
GoodData.connect("login", "pass")
43-
44-
# Different server than the usual secure.gooddata.com
45-
GoodData.connect("login", "pass", "https://different.server.gooddata.com")
46-
47-
# the last argument is passed to underlying RestClient so you can specify other useful stuff there
48-
GoodData.connect("login", "pass", "https://different.server.gooddata.com", :timeout => 0)
49-
50-
51-
#### Basic requests
52-
53-
GoodData.get("/gdc/md")
54-
55-
# This post will not actually work it is just for the illustration
56-
GoodData.post("/gdc/md/#{project_id}", {:my_object => "some_date"})
57-
58-
# The same goes for put delete.
59-
# By default the response is decoded for you as json but sometimes you do not want that png or other stuff.
60-
# You will get the response object and you can query it further.
61-
response = GoodData.get("/gdc/md", :process => false)
62-
response.code == 400
63-
pp response.body
64-
65-
#### Loading of data
66-
67-
This library is able to load data but it is not used that much if at all. Since there is some data processing needed on the client side we rely on faster implementations in Java usually. Let us know if you would be interested. As the APIs improve we could bring it back.
68-
69-
#### Other stuff
70-
71-
The API is currently a little fragmented and we never had the guts to actually deal with all the ugliness and present nice object oriented API. Usually it is just better to deal with the ugly json as hashes. But there are couple of exceptions where we needed something better and we thought providing an abstraction is worth the hassle.
72-
73-
#### Working with obj
74-
75-
obj is a resource that is probably the oldest in all GoodData. Obj are all the objects that have something to do with the analytical engine (metrics, attributes, reports etc). You can find the docs here (Add link to apiary). There are coule of convenience methods to work with these
76-
77-
GoodData.connect("svarovsky@gooddata.com", "just_testing")
78-
GoodData.project="fill_in_your_project_pid"
79-
80-
# Access raw obj
81-
obj = GoodData::MdObject[obj_number]
82-
83-
# bunch of useful methods are defined on these
84-
obj.title
85-
obj.get_used_by
86-
obj.get_using
87-
obj.delete
88-
89-
90-
#### Working with reports
91-
92-
Sometimes it is useful to compute reports outside of UI so there are couple of convenience methods for that.
93-
94-
require 'pp'
95-
96-
GoodData.connect("svarovsky@gooddata.com", "just_testing")
97-
GoodData.project="fill_in_your_project_pid"
98-
99-
report = GoodData::Report[1231]
100-
result = report.execute
101-
pp result
102-
103-
File.open('png.png', 'w') do |f|
104-
f.write(report.export(:png))
105-
end
106-
107-
You can export even whole dashboards. Currently afaik reports can be exported either as xls and png and dashboards as pdf. Hopefully it will support more in the future.
108-
109-
dash = GoodData::Dashboard[33807]
110-
File.open('dash.pdf', 'w') do |f|
111-
f.write(dash.export(:pdf))
112-
end
113-
114-
You can specify which tab to export. By default it is the first
115-
116-
dash = GoodData::Dashboard[33807]
117-
File.open('dash.pdf', 'w') do |f|
118-
f.write(dash.export(:pdf, :tab => dash.tabs_ids.last))
119-
end
120-
121-
### CLI Usage
122-
123-
After installing the gooddata gem, GoodData is available from your command line using
124-
the `gooddata` command. To get a complete overview of possible options type:
125-
126-
gooddata help
127-
128-
The examples and descriptions below does not cover all the options available via the CLI.
129-
So remember to refer back to the `help` command.
130-
131-
Before you do anything else, a good idea is to see if your account is set up correctly and
132-
that you can log in. To do this, use the `api:test` command:
133-
134-
gooddata api:test
135-
136-
#### Authentication
137-
138-
As you saw if you ran the above test command <tt>gooddata</tt> will prompt you
139-
for your GoodData username and password. If you don't wish to write your
140-
credentials each time you connect to GoodData using <tt>gooddata</tt>, you can
141-
create a simple gooddata credentials file called <tt>.gooddata</tt> in the root
142-
of your home directory. To make it easy you can just run the credentials file
143-
generator command which will create the file for you:
144-
145-
gooddata auth:store
146-
147-
#### List available projects
148-
149-
To get a list of projects available to your GoodData user account, run:
150-
151-
gooddata projects
152-
153-
The output from the above command will look similar to this:
154-
155-
```
156-
521 Some project
157-
3521 Some other project
158-
3642 Some third project
159-
```
160-
161-
The first column contains the project-key. You need this if you wan't to either
162-
see more details about the project using the `projects:show` comamnd or
163-
if you wish to delete the project using the `projects:delete` command.
164-
165-
#### Create a new project
166-
167-
To create a new project under on the GoodData servers, run:
168-
169-
gooddata projects:create
170-
171-
You will then be asked about the desired project name and summary before it's created.
172-
17336
## Note on Patches/Pull Requests
17437

17538
* Fork the project.
@@ -182,10 +45,10 @@ You will then be asked about the desired project name and summary before it's cr
18245

18346
## Credits
18447

185-
This project is developed and maintained by Pavel Kolesnikov [ <mailto:pavel@gooddata.com> / [@koles](http://twitter.com/koles) ] and Tomas Svarovsky <mailto:svarovsky.tomas@gmail.com>
48+
This project is developed and maintained by Pavel Kolesnikov [ <mailto:pavel@gooddata.com> / [@koles](http://twitter.com/koles) ] and Tomas Svarovsky [<mailto:svarovsky.tomas@gmail.com> / [@fluke777](http://twitter.com/fluke777)]
18649

18750
Special thanks to Thomas Watson Steen [ <mailto:w@tson.dk> / [@wa7son](http://twitter.com/wa7son) ]
18851

18952
## Copyright
19053

191-
Copyright (c) 2010 - 2014 GoodData Corporation and Thomas Watson Steen. See LICENSE for details.
54+
Copyright (c) 2010 - 2014 GoodData Corporation and Thomas Watson Steen. See LICENSE for details.

Rakefile

+23-6
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,35 @@ require 'rspec/core/rake_task'
88

99
require 'yard'
1010

11-
RSpec::Core::RakeTask.new(:spec)
12-
1311
task :usage do
1412
puts "No rake task specified, use rake -T to list them"
1513
end
1614

17-
Rake::TestTask.new(:test) do |test|
18-
test.libs << 'lib' << 'test'
19-
test.pattern = 'test/**/test_*.rb'
20-
test.verbose = true
15+
RSpec::Core::RakeTask.new(:test)
16+
17+
namespace :test do
18+
desc "Run unit tests"
19+
RSpec::Core::RakeTask.new(:unit) do |t|
20+
t.pattern = 'spec/unit/**/*.rb'
21+
end
22+
23+
desc "Run integration tests"
24+
RSpec::Core::RakeTask.new(:integration) do |t|
25+
t.pattern = 'spec/integration/**/*.rb'
26+
end
27+
28+
# Rake::TestTask.new(:legacy) do |test|
29+
# test.libs << 'lib' << 'test'
30+
# test.pattern = 'test/**/test_*.rb'
31+
# test.verbose = true
32+
# end
33+
34+
task :all => [:unit, :integration]
2135
end
2236

37+
desc "Run all tests"
38+
task :test => 'test:all'
39+
2340
YARD::Rake::YardocTask.new
2441

2542
task :default => [:usage]

0 commit comments

Comments
 (0)