gooddata 0.6.0.pre4 → 0.6.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gooddata/bricks/brick.rb +2 -0
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +28 -0
- data/lib/gooddata/client.rb +0 -7
- data/lib/gooddata/models/project.rb +2 -0
- data/lib/gooddata/models/project_metadata.rb +43 -0
- data/lib/gooddata/version.rb +1 -1
- metadata +3 -3
- data/Gemfile +0 -4
@@ -4,6 +4,8 @@ require 'gooddata/bricks/middleware/bench_middleware'
|
|
4
4
|
require 'gooddata/bricks/middleware/gooddata_middleware'
|
5
5
|
require 'gooddata/bricks/middleware/logger_middleware'
|
6
6
|
require 'gooddata/bricks/middleware/stdout_middleware'
|
7
|
+
require 'gooddata/bricks/middleware/restforce_middleware'
|
8
|
+
require 'gooddata/bricks/middleware/twitter_middleware'
|
7
9
|
|
8
10
|
module GoodData
|
9
11
|
module Bricks
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'gooddata'
|
2
|
+
|
3
|
+
module GoodData::Bricks
|
4
|
+
class RestForceMiddleware < GoodData::Bricks::Middleware
|
5
|
+
|
6
|
+
def call(params)
|
7
|
+
|
8
|
+
username = params[:salesforce_username]
|
9
|
+
password = params[:salesforce_password]
|
10
|
+
token = params[:salesforce_token]
|
11
|
+
client_id = params[:salesforce_client_id]
|
12
|
+
client_secret = params[:salesforce_client_secret]
|
13
|
+
|
14
|
+
Restforce.log = true if params[:salesforce_client_logger]
|
15
|
+
|
16
|
+
client = Restforce.new(
|
17
|
+
:username => username,
|
18
|
+
:password => password,
|
19
|
+
:security_token => token,
|
20
|
+
|
21
|
+
:client_id => client_id,
|
22
|
+
:client_secret => client_secret)
|
23
|
+
|
24
|
+
@app.call(params.merge(:salesforce_client => client))
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/gooddata/client.rb
CHANGED
@@ -123,13 +123,6 @@ module GoodData
|
|
123
123
|
old_project = GoodData.project
|
124
124
|
begin
|
125
125
|
GoodData.use(project)
|
126
|
-
server_url = case GoodData.project.data["content"]["cluster"]
|
127
|
-
when "na1"
|
128
|
-
"https://na1.gooddata.com"
|
129
|
-
else
|
130
|
-
"https://secure.gooddata.com"
|
131
|
-
end
|
132
|
-
connection.url = server_url
|
133
126
|
bl.call(project)
|
134
127
|
rescue Exception => e
|
135
128
|
fail e
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GoodData
|
2
|
+
class ProjectMetadata
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def [](key)
|
6
|
+
if key == :all
|
7
|
+
GoodData.get("/gdc/projects/#{GoodData.project.pid}/dataload/metadata")
|
8
|
+
else
|
9
|
+
res = GoodData.get("/gdc/projects/#{GoodData.project.pid}/dataload/metadata/#{key}")
|
10
|
+
res["metadataItem"]["value"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def has_key?(key)
|
15
|
+
begin
|
16
|
+
ProjectMetadata[key]
|
17
|
+
true
|
18
|
+
rescue RestClient::ResourceNotFound => e
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def []=(key, val)
|
24
|
+
data = {
|
25
|
+
:metadataItem => {
|
26
|
+
:key => key,
|
27
|
+
:value => val
|
28
|
+
}
|
29
|
+
}
|
30
|
+
uri = "/gdc/projects/#{GoodData.project.pid}/dataload/metadata/"
|
31
|
+
update_uri = uri + key
|
32
|
+
|
33
|
+
if has_key?(key)
|
34
|
+
GoodData.put(update_uri, data)
|
35
|
+
else
|
36
|
+
GoodData.post(uri, data)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/lib/gooddata/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gooddata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0.
|
4
|
+
version: 0.6.0.pre5
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -264,8 +264,6 @@ extra_rdoc_files:
|
|
264
264
|
files:
|
265
265
|
- .document
|
266
266
|
- .gitignore
|
267
|
-
- Gemfile
|
268
|
-
- Gemfile.lock
|
269
267
|
- LICENSE
|
270
268
|
- README.rdoc
|
271
269
|
- Rakefile
|
@@ -279,6 +277,7 @@ files:
|
|
279
277
|
- lib/gooddata/bricks/middleware/gooddata_middleware.rb
|
280
278
|
- lib/gooddata/bricks/middleware/logger_middleware.rb
|
281
279
|
- lib/gooddata/bricks/middleware/middleware.rb
|
280
|
+
- lib/gooddata/bricks/middleware/restforce_middleware.rb
|
282
281
|
- lib/gooddata/bricks/middleware/stdout_middleware.rb
|
283
282
|
- lib/gooddata/bricks/middleware/twitter_middleware.rb
|
284
283
|
- lib/gooddata/bricks/utils.rb
|
@@ -309,6 +308,7 @@ files:
|
|
309
308
|
- lib/gooddata/models/process.rb
|
310
309
|
- lib/gooddata/models/profile.rb
|
311
310
|
- lib/gooddata/models/project.rb
|
311
|
+
- lib/gooddata/models/project_metadata.rb
|
312
312
|
- lib/gooddata/models/report.rb
|
313
313
|
- lib/gooddata/models/report_definition.rb
|
314
314
|
- lib/gooddata/version.rb
|
data/Gemfile
DELETED