olap-xmla 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -2
- data/lib/olap/xmla.rb +1 -0
- data/lib/olap/xmla/client.rb +3 -1
- data/lib/olap/xmla/response.rb +3 -2
- data/lib/olap/xmla/version.rb +1 -1
- data/olap-xmla.gemspec +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc2cd44de638b059ce1100815698d3f1e1d0962a
|
4
|
+
data.tar.gz: 3bbb73dddf0bf85a518bff8560125910cb1cd3f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b9440192918d7fb3d8928bbbb92f405b78663001e7c833dab1160a4690d8a06b98d656870394e1724f76401f8f7485f9a3d0bf13a5478d3d746b02e241a866
|
7
|
+
data.tar.gz: 7e1d9984e6df9ac4dce511589fb6289e92cc3e3adfcdc4135db3942d47bcb9eb77c37c9101e283b79847fd405670c9a474eca0aa6f20df6a086630ba72e5ce8e
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ This allows to store MDX queries in constants, while execute them with dynamic p
|
|
78
78
|
Note, that you should never use these parameters directly from Rails request, as
|
79
79
|
this may create security breach!
|
80
80
|
|
81
|
-
###
|
81
|
+
### Response
|
82
82
|
|
83
83
|
|
84
84
|
You may use the response to render the results to user, or post-process it to analyse the data
|
@@ -99,9 +99,46 @@ response.column_values(column_num) # just one column of the response
|
|
99
99
|
|
100
100
|
```
|
101
101
|
|
102
|
+
### Example: rendering a table on web page
|
103
|
+
|
104
|
+
Typically, the request should be done in controller action, as simple as:
|
105
|
+
|
106
|
+
OlapController.erb
|
107
|
+
```ruby
|
108
|
+
def index
|
109
|
+
@response = Olap::Xmla.client.request 'WITH SET ... your mdx goes here';
|
110
|
+
%>
|
111
|
+
```
|
112
|
+
|
113
|
+
and in the HTML Erb view you use iteration over the response as:
|
114
|
+
|
115
|
+
index.html.erb
|
116
|
+
```ruby
|
117
|
+
<table>
|
118
|
+
<thead><tr>
|
119
|
+
<% for dim in @response.dimensions %><th><%= dim[:name] %></th><% end %>
|
120
|
+
<% for m in @response.measures %><th><%= m[:caption] %></th><% end %>
|
121
|
+
</tr></thead>
|
122
|
+
<tbody>
|
123
|
+
<% for row in @response.rows %>
|
124
|
+
<tr>
|
125
|
+
<% for label in row[:labels] %>
|
126
|
+
<td><%= label[:value] %></td>
|
127
|
+
<% end %>
|
128
|
+
<% for value in row[:values] %>
|
129
|
+
<td><%= value[:fmt_value] || value[:value] %></td>
|
130
|
+
<% end %>
|
131
|
+
</tr>
|
132
|
+
<% end %>
|
133
|
+
</tbody>
|
134
|
+
</table>
|
135
|
+
```
|
136
|
+
|
137
|
+
Have fun!
|
138
|
+
|
102
139
|
## Contributing
|
103
140
|
|
104
|
-
1. Fork it ( https://github.com/
|
141
|
+
1. Fork it ( https://github.com/Wondersoft/olap-xmla/fork )
|
105
142
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
106
143
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
107
144
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/olap/xmla.rb
CHANGED
@@ -38,6 +38,7 @@ module Olap
|
|
38
38
|
# * +:catalog+ - the name of catalog (required)
|
39
39
|
# * +:open_timeout+ - open timeout to connect to XMLA server, optional, default is 60 sec
|
40
40
|
# * +:read_timeout+ - open timeout to read data from XMLA server, optional, default is 300 sec
|
41
|
+
# * +:verbose+ - if set to true, write MDX requests to console. Default is false
|
41
42
|
#
|
42
43
|
#
|
43
44
|
def self.client connect_options = {}
|
data/lib/olap/xmla/client.rb
CHANGED
@@ -9,6 +9,7 @@ class Olap::Xmla::Client
|
|
9
9
|
|
10
10
|
@catalog = catalog
|
11
11
|
@data_source = data_source
|
12
|
+
@verbose = options[:verbose]
|
12
13
|
@client = Savon.client do
|
13
14
|
endpoint server
|
14
15
|
namespace "urn:schemas-microsoft-com:xml-analysis"
|
@@ -44,6 +45,7 @@ class Olap::Xmla::Client
|
|
44
45
|
def request mdx_request, parameters = {}
|
45
46
|
|
46
47
|
mdx = mdx_request.clone
|
48
|
+
puts mdx if @verbose
|
47
49
|
|
48
50
|
parameters.each{|k,v|
|
49
51
|
mdx.gsub!(k,v)
|
@@ -62,7 +64,7 @@ class Olap::Xmla::Client
|
|
62
64
|
raise "Error executing #{mdx} in #{catalog} #{data_source}: #{r.http_error} #{r.soap_fault}"
|
63
65
|
end
|
64
66
|
|
65
|
-
Olap::Xmla::Response.new r.body[:execute_response][:return][:root]
|
67
|
+
Olap::Xmla::Response.new r.body[:execute_response][:return][:root], mdx
|
66
68
|
|
67
69
|
end
|
68
70
|
|
data/lib/olap/xmla/response.rb
CHANGED
data/lib/olap/xmla/version.rb
CHANGED
data/olap-xmla.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Olap::Xmla::VERSION
|
9
9
|
spec.authors = ["studnev"]
|
10
10
|
spec.email = ["aleksey@wondersoft.ru"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{Can be used with any XMLA-compliant server, like Olaper or Mondrian.}
|
11
|
+
spec.summary = %q{OLAP XMLA gem}
|
12
|
+
spec.description = %q{Pure Ruby gem to make MDX queries on OLAP databases using XMLA connection. Can be used with any XMLA-compliant server, like Olaper or Mondrian.}
|
13
13
|
spec.homepage = "https://github.com/Wondersoft/olap-xmla"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: olap-xmla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- studnev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.5.1
|
69
|
-
description:
|
69
|
+
description: Pure Ruby gem to make MDX queries on OLAP databases using XMLA connection.
|
70
|
+
Can be used with any XMLA-compliant server, like Olaper or Mondrian.
|
70
71
|
email:
|
71
72
|
- aleksey@wondersoft.ru
|
72
73
|
executables: []
|
@@ -108,7 +109,7 @@ rubyforge_project:
|
|
108
109
|
rubygems_version: 2.2.2
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
|
-
summary:
|
112
|
+
summary: OLAP XMLA gem
|
112
113
|
test_files:
|
113
114
|
- spec/gem_spec.rb
|
114
115
|
- spec/spec_helper.rb
|