GooderData
GoodData API ruby client
Installation
Add this line to your application's Gemfile:
gem 'gooder_data'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install gooder_data
Usage
Execute a process
project = GooderData::Project.new(project_id: "#{ project_id }")
process_id = project.execute_process("#{ process_id }", "#{ my_project_name/graph/graph_name.grf }")
Embedding GoodData Dashboard iFrame with SSO
# Controller
dashboard_url = GooderData::Project::Dashboard.new('my-dashboard-id', project_id: 'my-project-id').url
iframe_url = GooderData::SSO.new("my.app.user@email.com", organization_name: 'my-organization').url(dashboard_url)
# index.html.erb
<iframe src="<%= iframe_url -%>"/>
Creating and assigning Mandatory User Filter (MUF)
project = GooderData::Project.new(project_id: 'my-project-id')
attribute = project.query_attributes.find(identifier: 'my_dataset.my_attribute')
values = attribute.values.where { |value| value.title.to_i > 5 }
query = GooderData::Project::Query.new(attribute).in(*values)
filter_id = project.create_mandatory_user_filter('My filter name', query)
project.bind_mandatory_user_filter(filter_id, 'my-user-profile-id')
GoodData API Client and using non implemented api calls
client = GooderData::ApiClient.new
client.connect!("my.gd.project.admin.user@email.com", "my_password")
client.api_to("execute process and return the execution details link") do |options|
post("/projects/#{ project_id }/dataload/processes/#{ process_id }/executions", {
execution: {
executable: executable_graph_path
}
})
end.that_responds do |response|
response['executionTask']['links']['details'] rescue ''
end
Link for GoodData Api of the implementation above
Configurations and default values
GooderData.configure do |c|
# default = 36 hours
# 10 min < expiration < 36 hours;
# https://developer.gooddata.com/article/gooddata-pgp-single-sign-on
c.signature_expiration_in_seconds = 3600 # 1 hour
# default nil, :required
c.project_id = "my-prioject-id"
# default nil
c.user_email = "gd.project.admin.user@domain.com"
# default nil, :required
c.user_password = "mY-h4RD p@55w0rD_"
# default nil
# gets first GPG signature if nil
c.sso_signer_email = "pgp.secret.signature.email@domain.com"
# default nil
# no passphrase signature if nil
c.sso_signer_password = 'secretpassword'
end
Maintainers
@dougpetronilio - douglas.petronilio@resultadosdigitais.com.br
Contributing
- Fork it ( http://github.com/ResultadosDigitais/gooder_data/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Stage your changes (
git add -A
) - Commit your changes (
git commit
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request