gooddata 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ .bundle
18
+ coverage
19
+ rdoc
20
+ pkg
21
+
22
+ ## PROJECT::SPECIFIC
23
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gooddata (0.3.0)
5
+ fastercsv
6
+ gooddata
7
+ json
8
+ json_pure
9
+ parseconfig
10
+ rest-client
11
+ rubyzip
12
+
13
+ GEM
14
+ remote: http://rubygems.org/
15
+ specs:
16
+ fastercsv (1.5.4)
17
+ json (1.5.3)
18
+ json_pure (1.5.3)
19
+ mime-types (1.16)
20
+ parseconfig (0.5.2)
21
+ rest-client (1.6.7)
22
+ mime-types (>= 1.16)
23
+ rubyzip (0.9.4)
24
+ thoughtbot-shoulda (2.11.1)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ gooddata!
31
+ thoughtbot-shoulda
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |test|
5
+ test.libs << 'lib' << 'test'
6
+ test.pattern = 'test/**/test_*.rb'
7
+ test.verbose = true
8
+ end
data/TODO.md ADDED
@@ -0,0 +1,77 @@
1
+ # Caution: This file does not describe current status... YET<br>
2
+
3
+ The following examples of shell commands illustrate the desired use of the `gooddata` binary to be provided by this gem.<br>
4
+
5
+ This file is intended to be renamed to `README.md` in the future.<br>
6
+
7
+ $ **mkdir MyDataProject**<br>
8
+ $ **cd MyDataProject/**<br>
9
+
10
+ $ **gooddata configure-csv 'My Data Set' \--file=/tmp/mydataset.csv**<br>
11
+ _Setting up CSV connector to file /tmp/mydataset.csv<br>
12
+ Guessing data types for mydataset.csv column: <br>
13
+ &nbsp;id.......... connection point <br>
14
+ &nbsp;name .... attribute <br>
15
+ &nbsp;type....... attribute <br>
16
+ &nbsp;impact.... attribute <br>
17
+ &nbsp;created... date <br>
18
+ &nbsp;closed.... date <br>
19
+ &nbsp;value...... fact <br>
20
+ Writing guessed columns into model/MyDataSet.xml <br>
21
+ Done. <br>
22
+ ATTENTION: Don't forget to review guessed data types and edit the model/MyDataSet.xml when necessary\!_<br>
23
+
24
+ $ **vim model/MyDataSet.xml&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;** <font color="blue"><-\- _Note: would be nice to provide an option to open an editor automatically by the provious command_ </font><br>
25
+
26
+
27
+ $ **gooddata diff**<br>
28
+ _No remote project associated\!<br>
29
+ + MyDataSet.xml<br>
30
+ \+&nbsp;&nbsp; id: connection point<br>
31
+ \+&nbsp;&nbsp; name: attribute<br>
32
+ ...<br>
33
+ \+&nbsp;&nbsp; value: fact_<br>
34
+
35
+ $ **gooddata create-remote 'My Data Project'**<br>
36
+ _Creating remote project<br>
37
+ Project hash wrtqwtbenhac36thgsdghhhjhjjsdfa stored in model/remote/main.pid<br>
38
+ Creating data sets:<br>
39
+ &nbsp;'My Data Set' using model/MyDataSet.xml<br>
40
+ Populating data sets:<br>
41
+ &nbsp;'My Data Set' from /tmp/mydataset.csv (incremental)<br>
42
+ Done._<br>
43
+
44
+ $ **gooddata refresh**<br>
45
+ _Comparing the remote and local data sets.<br>
46
+ Populating data sets:<br>
47
+ &nbsp;'My Data Set' from /tmp/mydataset.csv (incremental)_<br>
48
+
49
+ $ **gooddata configure-csv 'My Data Set' \--file=/tmp/mydataset_enriched.csv**<br>
50
+ _'My Data Set' data set exists already, scanning for changes<br>
51
+ Removed fields<br>
52
+ &nbsp; impact<br>
53
+ Guessing data types for new fields:<br>
54
+ &nbsp; industry... attribute<br>
55
+ &nbsp; score....... fact<br>
56
+ Saving original version into model/bk/MyDataSet.xml.1<br>
57
+ Writing guessed columns into model/MyDataSet.xml<br>
58
+ Done.<br>
59
+ ATTENTION: Don't forget to review guessed data types and edit the model/MyDataSet.xml when necessary\!_<br>
60
+
61
+ $ **gooddata refresh 'My Data Set'**<br>
62
+ _Comparing the remote and local data sets.<br>
63
+ ERROR: We need to alter the structure of the server-side dataset. Consequently, we need to<br>
64
+ fully reload the data. Since you are updating the 'My Data Set' data set in the incremental mode,<br>
65
+ please use the \--full-load switch to confirm your data file contains the full load. Alternatively, you<br>
66
+ can specify an alternative data file using the \--file parameter<br>
67
+
68
+ Example: $ gooddata refresh 'My Data Set' \--full \--file=/tmp/full.csv_<br>
69
+
70
+ $ **gooddata refresh 'My Data Set' \--full \--file=/tmp/mydataset-full.csv**<br>
71
+ _Comparing the remote and local data sets.<br>
72
+ Generating remote model alteration script into<br>
73
+ Populating data sets:<br>
74
+ &nbsp;'My Data Set' from /tmp/mydataset.csv (incremental)<br>
75
+ Done._<br>
76
+
77
+ $<br>
data/examples.rb ADDED
@@ -0,0 +1,67 @@
1
+ # This file shows how the GoodData Ruby API could be used from
2
+ # a client code
3
+ #
4
+ # Caution: this is far from describing the current functionality!
5
+
6
+ require 'gooddata'
7
+
8
+ # Note: this call will store the connection in a thread-local
9
+ # variable so this construction and following static method
10
+ # calls can be used even in a multi-threaded environment
11
+ #
12
+ # The connect call is not necessary if credentials are already
13
+ # stored in ~/.gooddata (e.g. using bin/gooddata auth:store)
14
+
15
+ GoodData.connect 'test@example.org', '$3[r37'
16
+
17
+ # Connect to a specific project
18
+ GoodData.project = 'afawtv356b6usdfsdf34vt'
19
+
20
+ # ... or even during login time
21
+ GoodData.connect 'test@example.org', '$3[r37', 'afawtv356b6usdfsdf34vt'
22
+
23
+ # Get a metadata object
24
+ a = Attribute[123]
25
+ a = Attribute['attr.country']
26
+
27
+ # Guess a model from a CSV data set
28
+ Model.guess 'data.csv'
29
+ # > [ { "type" => "ATTRIBUTE", "title" => "Country" }, ... ]
30
+
31
+ Model.add_dataset "title" => "Test", "columns" => [
32
+ { "type" => "ATTRIBUTE", "title" => "Country" }
33
+ ]
34
+ # > Dataset<"dataset.test">
35
+
36
+ # Populate a data set from a file
37
+ Dataset['dataset.test'].load 'data.csv'
38
+
39
+ # The previous line is actually a short cut for the following call:
40
+ p1.datasets['dataset.test'].load GoodData::Source::CsvFile.new 'data.csv'
41
+
42
+ # Populate a data set from the result of a SalesForce query
43
+ Dataset['dataset.test'].load GoodData::Source::SalesForce.new {
44
+ :username => "test@example.org",
45
+ :password => "blahblah",
46
+ :key => "mkjlnlkh845n4lhasdsdagddddddfa",
47
+ :query => "SELECT Id, Name FROM Account"
48
+ }
49
+
50
+ # Get a representation of a specific project
51
+ p1 = Project['afawtv356b6usdfsdf34vt']
52
+ p2 = Project['/gdc/projects/afawtv356b6usdfsdf34vt']
53
+
54
+ # Get a specific object by id from a specific project
55
+ a = p1.objects[123]
56
+ # > Attribute<"attr.country">
57
+
58
+ # ... or by identifier
59
+ a = p1.objects['attr.country']
60
+ # > Attribute<"attr.country">
61
+
62
+ ##
63
+ # Create a data set from a model
64
+ p1.model.add_dataset "title" => "Test", "columns" => [
65
+ { "type" => "ATTRIBUTE", "title" => "Country" }
66
+ ]
67
+ # > Dataset<"dataset.test">
data/gooddata.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ $:.push File.expand_path("../lib/gooddata", __FILE__)
6
+ require "version"
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = %q{gooddata}
10
+ s.version = GoodData::VERSION
11
+
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
+ s.authors = ["Pavel Kolesnikov", "Thomas Watson Steen"]
14
+ s.summary = %q{A convenient Ruby wrapper around the GoodData RESTful API}
15
+ s.date = %q{2012-12-17}
16
+ s.description = %q{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.}
17
+ s.email = %q{pavel@gooddata.com}
18
+ s.executables = ["igd.rb", "gooddata"]
19
+ s.extra_rdoc_files = [
20
+ "LICENSE",
21
+ "README.rdoc"
22
+ ]
23
+ s.files = `git ls-files`.split($/)
24
+ s.homepage = %q{http://github.com/gooddata/gooddata-ruby}
25
+ s.require_paths = ["lib"]
26
+ s.rubygems_version = "1.3.7"
27
+
28
+ s.add_development_dependency "bundler", "~> 1.3"
29
+ s.add_development_dependency "thoughtbot-shoulda"
30
+ s.add_development_dependency "parseconfig"
31
+ s.add_development_dependency "json_pure"
32
+ s.add_development_dependency "rest-client"
33
+ s.add_development_dependency "json"
34
+ s.add_development_dependency "rubyzip"
35
+ end
36
+
@@ -224,6 +224,8 @@ module GoodData
224
224
  )
225
225
  end
226
226
  end
227
+ else
228
+ dir = "."
227
229
  end
228
230
 
229
231
  # Upload the file
@@ -8,16 +8,16 @@ module GoodData
8
8
  class << self
9
9
  def [](id)
10
10
  raise "Cannot search for nil #{self.class}" unless id
11
- if id.is_a? Integer or id =~ /^\d+$/
12
- uri = "#{GoodData.project.md.link(MD_OBJ_CTG)}/#{id}"
11
+ uri = if id.is_a? Integer or id =~ /^\d+$/
12
+ "#{GoodData.project.md.link(MD_OBJ_CTG)}/#{id}"
13
13
  elsif id !~ /\//
14
- uri = identifier_to_uri id
14
+ identifier_to_uri id
15
15
  elsif id =~ /^\//
16
- uri = id
16
+ id
17
17
  else
18
18
  raise "Unexpected object id format: expected numeric ID, identifier with no slashes or an URI starting with a slash"
19
19
  end
20
- self.new((GoodData.get uri).values[0])
20
+ self.new((GoodData.get uri).values[0]) unless uri.nil?
21
21
  end
22
22
 
23
23
  private
@@ -26,7 +26,11 @@ module GoodData
26
26
  raise NoProjectError.new "Connect to a project before searching for an object" unless GoodData.project
27
27
  uri = GoodData.project.md[IDENTIFIERS_CFG]
28
28
  response = GoodData.post uri, { 'identifierToUri' => [id ] }
29
- response['identifiers'][0]['uri']
29
+ if response['identifiers'].empty?
30
+ nil
31
+ else
32
+ response['identifiers'][0]['uri']
33
+ end
30
34
  end
31
35
  end
32
36
 
@@ -1,3 +1,3 @@
1
1
  module GoodData
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
metadata CHANGED
@@ -1,138 +1,152 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
- version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 5
9
- - 7
10
- version: 0.5.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.8
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Pavel Kolesnikov
14
9
  - Thomas Watson Steen
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2012-12-17 00:00:00 -08:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2012-12-17 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :development
23
24
  prerelease: false
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ version_requirements: !ruby/object:Gem::Requirement
25
26
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '1.3'
31
+ - !ruby/object:Gem::Dependency
33
32
  name: thoughtbot-shoulda
34
- requirement: *id001
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
35
39
  type: :development
36
- - !ruby/object:Gem::Dependency
37
40
  prerelease: false
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ version_requirements: !ruby/object:Gem::Requirement
39
42
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
47
48
  name: parseconfig
48
- requirement: *id002
49
- type: :runtime
50
- - !ruby/object:Gem::Dependency
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
51
56
  prerelease: false
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
53
58
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
61
64
  name: json_pure
62
- requirement: *id003
63
- type: :runtime
64
- - !ruby/object:Gem::Dependency
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
65
72
  prerelease: false
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
73
+ version_requirements: !ruby/object:Gem::Requirement
67
74
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
75
80
  name: rest-client
76
- requirement: *id004
77
- type: :runtime
78
- - !ruby/object:Gem::Dependency
79
- prerelease: false
80
- version_requirements: &id005 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
81
82
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- name: fastercsv
90
- requirement: *id005
91
- type: :runtime
92
- - !ruby/object:Gem::Dependency
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
93
88
  prerelease: false
94
- version_requirements: &id006 !ruby/object:Gem::Requirement
89
+ version_requirements: !ruby/object:Gem::Requirement
95
90
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
103
96
  name: json
104
- requirement: *id006
105
- type: :runtime
106
- - !ruby/object:Gem::Dependency
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
107
104
  prerelease: false
108
- version_requirements: &id007 !ruby/object:Gem::Requirement
105
+ version_requirements: !ruby/object:Gem::Requirement
109
106
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
117
112
  name: rubyzip
118
- requirement: *id007
119
- type: :runtime
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.
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ description: Use the Gooddata::Client class to integrate GoodData into your own application
128
+ or use the CLI to work with GoodData directly from the command line.
121
129
  email: pavel@gooddata.com
122
- executables:
130
+ executables:
123
131
  - igd.rb
124
132
  - gooddata
125
133
  extensions: []
126
-
127
- extra_rdoc_files:
134
+ extra_rdoc_files:
128
135
  - LICENSE
129
136
  - README.rdoc
130
- files:
137
+ files:
138
+ - .document
139
+ - .gitignore
140
+ - Gemfile
141
+ - Gemfile.lock
131
142
  - LICENSE
132
143
  - README.rdoc
133
- - VERSION
144
+ - Rakefile
145
+ - TODO.md
134
146
  - bin/gooddata
135
147
  - bin/igd.rb
148
+ - examples.rb
149
+ - gooddata.gemspec
136
150
  - lib/gooddata.rb
137
151
  - lib/gooddata/client.rb
138
152
  - lib/gooddata/command.rb
@@ -161,39 +175,28 @@ files:
161
175
  - test/test_model.rb
162
176
  - test/test_rest_api_basic.rb
163
177
  - test/test_upload.rb
164
- has_rdoc: true
165
178
  homepage: http://github.com/gooddata/gooddata-ruby
166
179
  licenses: []
167
-
168
180
  post_install_message:
169
181
  rdoc_options: []
170
-
171
- require_paths:
182
+ require_paths:
172
183
  - lib
173
- required_ruby_version: !ruby/object:Gem::Requirement
184
+ required_ruby_version: !ruby/object:Gem::Requirement
174
185
  none: false
175
- requirements:
176
- - - ">="
177
- - !ruby/object:Gem::Version
178
- hash: 3
179
- segments:
180
- - 0
181
- version: "0"
182
- required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
191
  none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 3
188
- segments:
189
- - 0
190
- version: "0"
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
191
196
  requirements: []
192
-
193
197
  rubyforge_project:
194
- rubygems_version: 1.3.7
198
+ rubygems_version: 1.8.25
195
199
  signing_key:
196
200
  specification_version: 3
197
201
  summary: A convenient Ruby wrapper around the GoodData RESTful API
198
202
  test_files: []
199
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.7