gooddata 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -1
  3. data/CHANGELOG.markdown +6 -0
  4. data/README.md +1 -0
  5. data/gooddata.gemspec +2 -1
  6. data/lib/gooddata.rb +4 -1
  7. data/lib/gooddata/bricks/base_downloader.rb +33 -19
  8. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +49 -25
  9. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +36 -33
  10. data/lib/gooddata/cli/commands/project_cmd.rb +6 -4
  11. data/lib/gooddata/client.rb +1 -1
  12. data/lib/gooddata/commands/api.rb +1 -1
  13. data/lib/gooddata/commands/auth.rb +1 -1
  14. data/lib/gooddata/connection.rb +13 -10
  15. data/lib/gooddata/core/connection.rb +1 -1
  16. data/lib/gooddata/core/user.rb +11 -3
  17. data/lib/gooddata/exceptions/validation_error.rb +12 -0
  18. data/lib/gooddata/extensions/extensions.rb +6 -0
  19. data/lib/gooddata/goodzilla/goodzilla.rb +2 -2
  20. data/lib/gooddata/helpers/csv_helper.rb +57 -0
  21. data/lib/gooddata/{helpers.rb → helpers/global_helpers.rb} +0 -0
  22. data/lib/gooddata/helpers/helpers.rb +6 -0
  23. data/lib/gooddata/models/domain.rb +134 -24
  24. data/lib/gooddata/models/membership.rb +402 -0
  25. data/lib/gooddata/models/metadata.rb +64 -7
  26. data/lib/gooddata/models/metadata/attribute.rb +27 -12
  27. data/lib/gooddata/models/metadata/column.rb +1 -1
  28. data/lib/gooddata/models/metadata/dashboard.rb +7 -6
  29. data/lib/gooddata/models/metadata/display_form.rb +17 -2
  30. data/lib/gooddata/models/metadata/fact.rb +13 -7
  31. data/lib/gooddata/models/metadata/metric.rb +9 -9
  32. data/lib/gooddata/models/metadata/report.rb +7 -8
  33. data/lib/gooddata/models/metadata/report_definition.rb +10 -11
  34. data/lib/gooddata/models/metadata/schema.rb +1 -1
  35. data/lib/gooddata/models/model.rb +1 -1
  36. data/lib/gooddata/models/process.rb +44 -25
  37. data/lib/gooddata/models/profile.rb +365 -13
  38. data/lib/gooddata/models/project.rb +245 -35
  39. data/lib/gooddata/models/project_blueprint.rb +42 -18
  40. data/lib/gooddata/models/project_creator.rb +4 -1
  41. data/lib/gooddata/models/project_role.rb +7 -7
  42. data/lib/gooddata/models/schedule.rb +17 -1
  43. data/lib/gooddata/models/schema_blueprint.rb +19 -2
  44. data/lib/gooddata/version.rb +1 -1
  45. data/out.txt +0 -0
  46. data/spec/data/users.csv +12 -0
  47. data/spec/helpers/connection_helper.rb +1 -0
  48. data/spec/helpers/csv_helper.rb +12 -0
  49. data/spec/helpers/project_helper.rb +1 -1
  50. data/spec/integration/full_project_spec.rb +136 -3
  51. data/spec/spec_helper.rb +9 -0
  52. data/spec/unit/commands/command_user_spec.rb +1 -1
  53. data/spec/unit/extensions/hash_spec.rb +19 -0
  54. data/spec/unit/godzilla/goodzilla_spec.rb +15 -0
  55. data/spec/unit/helpers/csv_helper_spec.rb +18 -0
  56. data/spec/unit/models/domain_spec.rb +47 -4
  57. data/spec/unit/models/md_object_spec.rb +8 -0
  58. data/spec/unit/models/membership_spec.rb +128 -0
  59. data/spec/unit/models/metadata_spec.rb +38 -0
  60. data/spec/unit/models/profile_spec.rb +212 -0
  61. data/spec/unit/models/project_blueprint_spec.rb +35 -8
  62. data/spec/unit/models/project_role_spec.rb +6 -6
  63. data/spec/unit/models/project_spec.rb +226 -13
  64. data/spec/unit/models/schedule_spec.rb +58 -0
  65. data/tmp/.gitkeepme +0 -0
  66. metadata +36 -11
  67. data/lib/gooddata/models/account_settings.rb +0 -124
  68. data/lib/gooddata/models/user.rb +0 -165
  69. data/spec/unit/models/account_settings_spec.rb +0 -28
  70. data/spec/unit/models/user_spec.rb +0 -16
File without changes
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.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-05-30 00:00:00.000000000 Z
14
+ date: 2014-07-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -350,19 +350,33 @@ dependencies:
350
350
  - !ruby/object:Gem::Version
351
351
  version: 1.1.0
352
352
  - !ruby/object:Gem::Dependency
353
- name: salesforce_bulk
353
+ name: salesforce_bulk_query
354
354
  requirement: !ruby/object:Gem::Requirement
355
355
  requirements:
356
356
  - - "~>"
357
357
  - !ruby/object:Gem::Version
358
- version: 1.0.3
358
+ version: '0.0'
359
359
  type: :runtime
360
360
  prerelease: false
361
361
  version_requirements: !ruby/object:Gem::Requirement
362
362
  requirements:
363
363
  - - "~>"
364
364
  - !ruby/object:Gem::Version
365
- version: 1.0.3
365
+ version: '0.0'
366
+ - !ruby/object:Gem::Dependency
367
+ name: aws-sdk
368
+ requirement: !ruby/object:Gem::Requirement
369
+ requirements:
370
+ - - "~>"
371
+ - !ruby/object:Gem::Version
372
+ version: '1.45'
373
+ type: :runtime
374
+ prerelease: false
375
+ version_requirements: !ruby/object:Gem::Requirement
376
+ requirements:
377
+ - - "~>"
378
+ - !ruby/object:Gem::Version
379
+ version: '1.45'
366
380
  description: Use the GoodData::Client class to integrate GoodData into your own application
367
381
  or use the CLI to work with GoodData directly from the command line.
368
382
  email: pavel@gooddata.com
@@ -380,6 +394,7 @@ files:
380
394
  - ".rubocop.yml"
381
395
  - ".travis.yml"
382
396
  - ".yardopts"
397
+ - CHANGELOG.markdown
383
398
  - CLI.md
384
399
  - Gemfile
385
400
  - LICENSE
@@ -512,11 +527,14 @@ files:
512
527
  - lib/gooddata/exceptions/exceptions.rb
513
528
  - lib/gooddata/exceptions/no_project_error.rb
514
529
  - lib/gooddata/exceptions/project_not_found.rb
530
+ - lib/gooddata/exceptions/validation_error.rb
515
531
  - lib/gooddata/extensions/big_decimal.rb
532
+ - lib/gooddata/extensions/extensions.rb
516
533
  - lib/gooddata/extract.rb
517
534
  - lib/gooddata/goodzilla/goodzilla.rb
518
- - lib/gooddata/helpers.rb
519
- - lib/gooddata/models/account_settings.rb
535
+ - lib/gooddata/helpers/csv_helper.rb
536
+ - lib/gooddata/helpers/global_helpers.rb
537
+ - lib/gooddata/helpers/helpers.rb
520
538
  - lib/gooddata/models/attributes/anchor.rb
521
539
  - lib/gooddata/models/attributes/attributes.rb
522
540
  - lib/gooddata/models/attributes/date_attribute.rb
@@ -539,6 +557,7 @@ files:
539
557
  - lib/gooddata/models/invitation.rb
540
558
  - lib/gooddata/models/links.rb
541
559
  - lib/gooddata/models/md_object.rb
560
+ - lib/gooddata/models/membership.rb
542
561
  - lib/gooddata/models/metadata.rb
543
562
  - lib/gooddata/models/metadata/attribute.rb
544
563
  - lib/gooddata/models/metadata/column.rb
@@ -572,7 +591,6 @@ files:
572
591
  - lib/gooddata/models/schema_blueprint.rb
573
592
  - lib/gooddata/models/schema_builder.rb
574
593
  - lib/gooddata/models/tab_builder.rb
575
- - lib/gooddata/models/user.rb
576
594
  - lib/gooddata/version.rb
577
595
  - lib/templates/bricks/brick.rb.erb
578
596
  - lib/templates/bricks/main.rb.erb
@@ -581,6 +599,7 @@ files:
581
599
  - lib/templates/project/data/devs.csv
582
600
  - lib/templates/project/data/repos.csv
583
601
  - lib/templates/project/model/model.rb.erb
602
+ - out.txt
584
603
  - spec/bricks/bricks_spec.rb
585
604
  - spec/data/.gooddata
586
605
  - spec/data/additional_dataset_module.json
@@ -588,9 +607,11 @@ files:
588
607
  - spec/data/model_module.json
589
608
  - spec/data/test-ci-data.csv
590
609
  - spec/data/test_project_model_spec.json
610
+ - spec/data/users.csv
591
611
  - spec/helpers/blueprint_helper.rb
592
612
  - spec/helpers/cli_helper.rb
593
613
  - spec/helpers/connection_helper.rb
614
+ - spec/helpers/csv_helper.rb
594
615
  - spec/helpers/project_helper.rb
595
616
  - spec/helpers/schema_helper.rb
596
617
  - spec/integration/command_projects_spec.rb
@@ -630,16 +651,20 @@ files:
630
651
  - spec/unit/core/project_spec.rb
631
652
  - spec/unit/core/rest_spec.rb
632
653
  - spec/unit/data/guesser_spec.rb
654
+ - spec/unit/extensions/hash_spec.rb
633
655
  - spec/unit/godzilla/goodzilla_spec.rb
656
+ - spec/unit/helpers/csv_helper_spec.rb
634
657
  - spec/unit/helpers_spec.rb
635
- - spec/unit/models/account_settings_spec.rb
636
658
  - spec/unit/models/anchor_spec.rb
637
659
  - spec/unit/models/attribute_column_spec.rb
638
660
  - spec/unit/models/domain_spec.rb
639
661
  - spec/unit/models/invitation_spec.rb
640
662
  - spec/unit/models/md_object_spec.rb
663
+ - spec/unit/models/membership_spec.rb
664
+ - spec/unit/models/metadata_spec.rb
641
665
  - spec/unit/models/metric.rb
642
666
  - spec/unit/models/model_spec.rb
667
+ - spec/unit/models/profile_spec.rb
643
668
  - spec/unit/models/project_blueprint_spec.rb
644
669
  - spec/unit/models/project_creator.rb
645
670
  - spec/unit/models/project_role_spec.rb
@@ -647,8 +672,8 @@ files:
647
672
  - spec/unit/models/schedule_spec.rb
648
673
  - spec/unit/models/schema_builder_spec.rb
649
674
  - spec/unit/models/tools_spec.rb
650
- - spec/unit/models/user_spec.rb
651
675
  - test/test_upload.rb
676
+ - tmp/.gitkeepme
652
677
  - yard-server.sh
653
678
  homepage: http://github.com/gooddata/gooddata-ruby
654
679
  licenses:
@@ -670,7 +695,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
670
695
  version: '0'
671
696
  requirements: []
672
697
  rubyforge_project:
673
- rubygems_version: 2.1.9
698
+ rubygems_version: 2.2.2
674
699
  signing_key:
675
700
  specification_version: 4
676
701
  summary: A convenient Ruby wrapper around the GoodData RESTful API
@@ -1,124 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative 'project'
4
-
5
- module GoodData
6
- # Account settings representation with some added sugar
7
- class AccountSettings
8
- attr_reader :json
9
-
10
- # Creates new instance
11
- #
12
- # @return [AccountSettings] New AccountSettings instance
13
- def initialize(json)
14
- @json = json
15
- end
16
-
17
- # Gets the company name
18
- #
19
- # @return [String] Company name
20
- def company
21
- @json['accountSetting']['companyName'] || ''
22
- end
23
-
24
- # Gets the country
25
- #
26
- # @return [String] Country
27
- def country
28
- @json['accountSetting']['country'] || ''
29
- end
30
-
31
- # Gets date when created
32
- #
33
- # @return [DateTime] Created date
34
- def created
35
- DateTime.parse(@json['accountSetting']['created'])
36
- end
37
-
38
- # Gets the email
39
- #
40
- # @return [String] Email address
41
- def email
42
- @json['accountSetting']['email'] || ''
43
- end
44
-
45
- # Gets the first name
46
- #
47
- # @return [String] First name
48
- def first_name
49
- @json['accountSetting']['firstName'] || ''
50
- end
51
-
52
- # Gets the last name
53
- #
54
- # @return [String] Last name
55
- def last_name
56
- @json['accountSetting']['lastName'] || ''
57
- end
58
-
59
- # Gets the login
60
- #
61
- # @return [String] Login
62
- def login
63
- @json['accountSetting']['login'] || ''
64
- end
65
-
66
- # Gets the resource identifier
67
- #
68
- # @return [String] Resource identifier
69
- def obj_id
70
- uri.split('/').last
71
- end
72
-
73
- alias_method :account_setting_id, :obj_id
74
-
75
- # Gets the phone
76
- #
77
- # @return [String] Phone
78
- def phone
79
- @json['accountSetting']['phone'] || ''
80
- end
81
-
82
- # Gets the position in company
83
- #
84
- # @return [String] Position in company
85
- def position
86
- @json['accountSetting']['position'] || ''
87
- end
88
-
89
- # Gets the array of projects
90
- #
91
- # @return [Array<GoodData::Project>] Array of project where account settings belongs to
92
- def projects
93
- res = []
94
-
95
- projects = GoodData.get @json['accountSetting']['links']['projects']
96
- projects['projects'].each do |project|
97
- res << GoodData::Project.new(project)
98
- end
99
-
100
- res
101
- end
102
-
103
- # Gets the preferred timezone
104
- #
105
- # @return [String] Preferred timezone
106
- def timezone
107
- @json['accountSetting']['timezone'] || ''
108
- end
109
-
110
- # Gets the date when updated
111
- #
112
- # @return [DateTime] Updated date
113
- def updated
114
- DateTime.parse(@json['accountSetting']['updated'])
115
- end
116
-
117
- # Gets the resource REST URI
118
- #
119
- # @return [String] Resource URI
120
- def uri
121
- DateTime.parse(@json['accountSetting']['links']['self'])
122
- end
123
- end
124
- end
@@ -1,165 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative 'project'
4
- require_relative 'project_role'
5
-
6
- module GoodData
7
- class User
8
- attr_reader :json
9
-
10
- def initialize(json)
11
- @json = json
12
- end
13
-
14
- # Gets author (person who created) of this object
15
- #
16
- # @return [String] Author
17
- def author
18
- # TODO: Return object instead
19
- @json['user']['meta']['author']
20
- end
21
-
22
- # Gets the contributor
23
- #
24
- # @return [String] Contributor
25
- def contributor
26
- # TODO: Return object instead
27
- @json['user']['meta']['contributor']
28
- end
29
-
30
- # Gets date when created
31
- #
32
- # @return [DateTime] Created date
33
- def created
34
- Time.parse(@json['user']['meta']['created'])
35
- end
36
-
37
- # Gets the email
38
- #
39
- # @return [String] Email address
40
- def email
41
- @json['user']['content']['email'] || ''
42
- end
43
-
44
- # Gets the first name
45
- #
46
- # @return [String] First name
47
- def first_name
48
- @json['user']['content']['firstname'] || ''
49
- end
50
-
51
- # Gets the invitations
52
- #
53
- # @return [Array<GoodData::Invitation>] List of invitations
54
- def invitations
55
- res = []
56
-
57
- tmp = GoodData.get @json['user']['links']['invitations']
58
- tmp['invitations'].each do |invitation|
59
- end
60
-
61
- res
62
- end
63
-
64
- # Gets the last name
65
- #
66
- # @return [String] Last name
67
- def last_name
68
- @json['user']['content']['lastname'] || ''
69
- end
70
-
71
- # Gets the login
72
- #
73
- # @return [String] Login
74
- def login
75
- @json['user']['content']['login'] || ''
76
- end
77
-
78
- # Gets user raw object ID
79
- #
80
- # @return [String] Raw Object ID
81
- def obj_id
82
- uri.split('/').last
83
- end
84
-
85
- # Gets the permissions
86
- #
87
- # @return [Hash] Hash with permissions
88
- def permissions
89
- res = {}
90
-
91
- tmp = GoodData.get @json['user']['links']['permissions']
92
- tmp['associatedPermissions']['permissions'].each do |permission_name, permission_value|
93
- res[permission_name] = permission_value
94
- end
95
-
96
- res
97
- end
98
-
99
- # Gets the phone number
100
- #
101
- # @return [String] Phone number
102
- def phone
103
- @json['user']['content']['phonenumber'] || ''
104
- end
105
-
106
- # Gets the projects of user
107
- #
108
- # @return [Array<GoodData::Project>] Array of projets
109
- def projects
110
- res = []
111
-
112
- tmp = GoodData.get @json['user']['links']['projects']
113
- tmp['projects'].each do |project_meta|
114
- project_uri = project_meta['project']['links']['self']
115
- project = GoodData.get project_uri
116
- res << GoodData::Project.new(project)
117
- end
118
-
119
- res
120
- end
121
-
122
- # Gets the project roles of user
123
- #
124
- # @return [Array<GoodData::ProjectRole>] Array of project roles
125
- def roles
126
- res = []
127
-
128
- tmp = GoodData.get @json['user']['links']['roles']
129
- tmp['associatedRoles']['roles'].each do |role_uri|
130
- role = GoodData.get role_uri
131
- res << GoodData::ProjectRole.new(role)
132
- end
133
-
134
- res
135
- end
136
-
137
- # Gets the status
138
- #
139
- # @return [String] Status
140
- def status
141
- @json['user']['content']['status'] || ''
142
- end
143
-
144
- # Gets the title
145
- #
146
- # @return [String] User title
147
- def title
148
- @json['user']['meta']['title'] || ''
149
- end
150
-
151
- # Gets the date when updated
152
- #
153
- # @return [DateTime] Date of last update
154
- def updated
155
- DateTime.parse(@json['user']['meta']['updated'])
156
- end
157
-
158
- # Gets the object URI
159
- #
160
- # @return [String] Object URI
161
- def uri
162
- @json['user']['links']['self']
163
- end
164
- end
165
- end
@@ -1,28 +0,0 @@
1
- # encoding: UTF-8
2
-
3
-
4
- require 'gooddata/models/account_settings'
5
- require 'gooddata/models/domain'
6
- require 'gooddata/models/project'
7
-
8
- describe GoodData::AccountSettings do
9
- before(:all) do
10
- ConnectionHelper.create_default_connection
11
- @user = GoodData::Domain.find_user_by_login(ConnectionHelper::DEFAULT_DOMAIN, ConnectionHelper::DEFAULT_USERNAME)
12
- end
13
-
14
- after(:all) do
15
- GoodData.disconnect
16
- end
17
-
18
- describe '#projects' do
19
- it 'Returns user projects as array of GoodData::Project' do
20
- projects = @user.projects
21
- expect(projects).to be_an_instance_of(Array)
22
-
23
- projects.each do |project|
24
- expect(project).to be_an_instance_of(GoodData::Project)
25
- end
26
- end
27
- end
28
- end