gooddata 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.rdoc +97 -0
- data/VERSION +1 -0
- data/bin/gooddata +13 -0
- data/bin/igd.rb +33 -0
- data/lib/gooddata.rb +3 -0
- data/lib/gooddata/client.rb +196 -0
- data/lib/gooddata/command.rb +75 -0
- data/lib/gooddata/commands/api.rb +37 -0
- data/lib/gooddata/commands/auth.rb +74 -0
- data/lib/gooddata/commands/base.rb +80 -0
- data/lib/gooddata/commands/datasets.rb +228 -0
- data/lib/gooddata/commands/help.rb +104 -0
- data/lib/gooddata/commands/profile.rb +9 -0
- data/lib/gooddata/commands/projects.rb +51 -0
- data/lib/gooddata/commands/version.rb +7 -0
- data/lib/gooddata/connection.rb +220 -0
- data/lib/gooddata/extract.rb +13 -0
- data/lib/gooddata/helpers.rb +18 -0
- data/lib/gooddata/model.rb +558 -0
- data/lib/gooddata/models/links.rb +42 -0
- data/lib/gooddata/models/metadata.rb +82 -0
- data/lib/gooddata/models/profile.rb +32 -0
- data/lib/gooddata/models/project.rb +136 -0
- data/lib/gooddata/version.rb +3 -0
- data/test/helper.rb +10 -0
- data/test/test_commands.rb +85 -0
- data/test/test_guessing.rb +46 -0
- data/test/test_model.rb +63 -0
- data/test/test_rest_api_basic.rb +41 -0
- data/test/test_upload.rb +52 -0
- metadata +202 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
require 'gooddata/command'
|
5
|
+
|
6
|
+
GoodData.logger = Logger.new(STDOUT)
|
7
|
+
|
8
|
+
class TestRestApiBasic < Test::Unit::TestCase
|
9
|
+
context "GoodData REST Client" do
|
10
|
+
# Initialize a GoodData connection using the credential
|
11
|
+
# stored in ~/.gooddata
|
12
|
+
setup do
|
13
|
+
GoodData::Command::connect
|
14
|
+
end
|
15
|
+
|
16
|
+
should "get the FoodMartDemo" do
|
17
|
+
p_by_hash = GoodData::Project['FoodMartDemo']
|
18
|
+
p_by_uri = GoodData::Project['/gdc/projects/FoodMartDemo']
|
19
|
+
p_by_md_uri = GoodData::Project['/gdc/md/FoodMartDemo']
|
20
|
+
assert_not_nil p_by_hash
|
21
|
+
assert_equal p_by_hash.uri, p_by_uri.uri
|
22
|
+
assert_equal p_by_hash.title, p_by_uri.title
|
23
|
+
assert_equal p_by_hash.title, p_by_md_uri.title
|
24
|
+
end
|
25
|
+
|
26
|
+
should "connect to the FoodMartDemo" do
|
27
|
+
GoodData.use 'FoodMartDemo'
|
28
|
+
GoodData.project.datasets # should not fail on unknown project or access denied
|
29
|
+
# TODO: should be equal to Dataset.all once implemented
|
30
|
+
end
|
31
|
+
|
32
|
+
# Not supported yet
|
33
|
+
# should "fetch dataset by numerical or string identifier" do
|
34
|
+
# GoodData.use 'FoodMartDemo'
|
35
|
+
# ds_by_hash = Dataset['amJoIYHjgESv']
|
36
|
+
# ds_by_id = Dataset[34]
|
37
|
+
# assert_not_nil ds_by_hash
|
38
|
+
# assert_equal ds_by_hash.uri, ds_by_id.uri
|
39
|
+
# end
|
40
|
+
end
|
41
|
+
end
|
data/test/test_upload.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'fastercsv'
|
4
|
+
|
5
|
+
require 'helper'
|
6
|
+
require 'gooddata/model'
|
7
|
+
require 'gooddata/command'
|
8
|
+
|
9
|
+
GoodData.logger = Logger.new(STDOUT)
|
10
|
+
|
11
|
+
class TestModel < Test::Unit::TestCase
|
12
|
+
FILE = [
|
13
|
+
[ "cp", "a1", "a2", "f1", "f2" ],
|
14
|
+
[ 1, "a1.1", "a2.1", "0", "5" ],
|
15
|
+
[ 2, "a1.2", "a2.1", nil, 10 ],
|
16
|
+
[ 3, "a1.2", "a2.2", 1, nil ],
|
17
|
+
[ 4, "a1.3", "a2.2", 0, 0 ]
|
18
|
+
]
|
19
|
+
COLUMNS = [
|
20
|
+
{ 'type' => 'CONNECTION_POINT', 'name' => 'cp', 'title' => 'CP', 'folder' => 'test' },
|
21
|
+
{ 'type' => 'ATTRIBUTE', 'name' => 'a1', 'title' => 'A1', 'folder' => 'test' },
|
22
|
+
{ 'type' => 'ATTRIBUTE', 'name' => 'a2', 'title' => 'A2', 'folder' => 'test' },
|
23
|
+
{ 'type' => 'FACT', 'name' => 'f1', 'title' => 'F1', 'folder' => 'test' },
|
24
|
+
{ 'type' => 'FACT', 'name' => 'f2', 'title' => 'F2', 'folder' => 'test' },
|
25
|
+
]
|
26
|
+
SCHEMA = GoodData::Model::Schema.new 'title' => 'test', 'columns' => COLUMNS
|
27
|
+
|
28
|
+
context "GoodData model tools" do
|
29
|
+
# Initialize a GoodData connection using the credential
|
30
|
+
# stored in ~/.gooddata
|
31
|
+
#
|
32
|
+
# And create a temporary CSV file to test the upload
|
33
|
+
setup do
|
34
|
+
GoodData::Command::connect
|
35
|
+
@file = Tempfile.open 'test_csv'
|
36
|
+
FasterCSV.open @file.path, 'w' do |csv|
|
37
|
+
FILE.each { |row| csv << row }
|
38
|
+
end
|
39
|
+
@project = GoodData::Project.create :title => "gooddata-ruby test #{Time.now.to_i}"
|
40
|
+
end
|
41
|
+
|
42
|
+
teardown do
|
43
|
+
@file.unlink
|
44
|
+
@project.delete
|
45
|
+
end
|
46
|
+
|
47
|
+
should "upload CSV in a full mode" do
|
48
|
+
@project.add_dataset SCHEMA
|
49
|
+
@project.upload @file.path, SCHEMA
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gooddata
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Pavel Kolesnikov
|
14
|
+
- Thomas Watson Steen
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-05-10 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: thoughtbot-shoulda
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: parseconfig
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: json_pure
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rest-client
|
66
|
+
prerelease: false
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
type: :runtime
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: fastercsv
|
80
|
+
prerelease: false
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
type: :runtime
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: json
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
type: :runtime
|
105
|
+
version_requirements: *id006
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: rubyzip
|
108
|
+
prerelease: false
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
version: "0"
|
118
|
+
type: :runtime
|
119
|
+
version_requirements: *id007
|
120
|
+
description: Use the Gooddata::Client class to integrate GoodData into your own application or use the CLI to work with GoodData directly from the command line.
|
121
|
+
email: pavel@gooddata.com
|
122
|
+
executables:
|
123
|
+
- gooddata
|
124
|
+
- igd.rb
|
125
|
+
extensions: []
|
126
|
+
|
127
|
+
extra_rdoc_files:
|
128
|
+
- LICENSE
|
129
|
+
- README.rdoc
|
130
|
+
files:
|
131
|
+
- LICENSE
|
132
|
+
- README.rdoc
|
133
|
+
- VERSION
|
134
|
+
- bin/gooddata
|
135
|
+
- bin/igd.rb
|
136
|
+
- lib/gooddata.rb
|
137
|
+
- lib/gooddata/client.rb
|
138
|
+
- lib/gooddata/command.rb
|
139
|
+
- lib/gooddata/commands/api.rb
|
140
|
+
- lib/gooddata/commands/auth.rb
|
141
|
+
- lib/gooddata/commands/base.rb
|
142
|
+
- lib/gooddata/commands/datasets.rb
|
143
|
+
- lib/gooddata/commands/help.rb
|
144
|
+
- lib/gooddata/commands/profile.rb
|
145
|
+
- lib/gooddata/commands/projects.rb
|
146
|
+
- lib/gooddata/commands/version.rb
|
147
|
+
- lib/gooddata/connection.rb
|
148
|
+
- lib/gooddata/extract.rb
|
149
|
+
- lib/gooddata/helpers.rb
|
150
|
+
- lib/gooddata/model.rb
|
151
|
+
- lib/gooddata/models/links.rb
|
152
|
+
- lib/gooddata/models/metadata.rb
|
153
|
+
- lib/gooddata/models/profile.rb
|
154
|
+
- lib/gooddata/models/project.rb
|
155
|
+
- lib/gooddata/version.rb
|
156
|
+
- test/helper.rb
|
157
|
+
- test/test_commands.rb
|
158
|
+
- test/test_guessing.rb
|
159
|
+
- test/test_model.rb
|
160
|
+
- test/test_rest_api_basic.rb
|
161
|
+
- test/test_upload.rb
|
162
|
+
has_rdoc: true
|
163
|
+
homepage: http://github.com/gooddata/gooddata-ruby
|
164
|
+
licenses: []
|
165
|
+
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options:
|
168
|
+
- --charset=UTF-8
|
169
|
+
require_paths:
|
170
|
+
- lib
|
171
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
hash: 3
|
177
|
+
segments:
|
178
|
+
- 0
|
179
|
+
version: "0"
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
hash: 3
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
version: "0"
|
189
|
+
requirements: []
|
190
|
+
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 1.3.7
|
193
|
+
signing_key:
|
194
|
+
specification_version: 3
|
195
|
+
summary: A convenient Ruby wrapper around the GoodData RESTful API
|
196
|
+
test_files:
|
197
|
+
- test/helper.rb
|
198
|
+
- test/test_commands.rb
|
199
|
+
- test/test_guessing.rb
|
200
|
+
- test/test_model.rb
|
201
|
+
- test/test_rest_api_basic.rb
|
202
|
+
- test/test_upload.rb
|