gooddata 0.6.19 → 0.6.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/Rakefile +17 -3
  4. data/gooddata.gemspec +8 -7
  5. data/lib/gooddata/bricks/middleware/base_middleware.rb +1 -1
  6. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +2 -2
  7. data/lib/gooddata/cli/shared.rb +2 -1
  8. data/lib/gooddata/commands/auth.rb +58 -5
  9. data/lib/gooddata/commands/runners.rb +2 -6
  10. data/lib/gooddata/extensions/big_decimal.rb +4 -0
  11. data/lib/gooddata/extensions/false.rb +11 -0
  12. data/lib/gooddata/extensions/hash.rb +6 -17
  13. data/lib/gooddata/extensions/nil.rb +11 -0
  14. data/lib/gooddata/extensions/numeric.rb +11 -0
  15. data/lib/gooddata/extensions/object.rb +11 -0
  16. data/lib/gooddata/extensions/symbol.rb +11 -0
  17. data/lib/gooddata/extensions/true.rb +11 -0
  18. data/lib/gooddata/helpers/auth_helpers.rb +32 -2
  19. data/lib/gooddata/helpers/data_helper.rb +1 -1
  20. data/lib/gooddata/helpers/global_helpers.rb +98 -31
  21. data/lib/gooddata/mixins/md_finders.rb +15 -15
  22. data/lib/gooddata/mixins/md_object_query.rb +12 -2
  23. data/lib/gooddata/models/blueprint/blueprint_field.rb +2 -2
  24. data/lib/gooddata/models/blueprint/dataset_blueprint.rb +2 -2
  25. data/lib/gooddata/models/blueprint/project_blueprint.rb +3 -3
  26. data/lib/gooddata/models/blueprint/schema_blueprint.rb +1 -1
  27. data/lib/gooddata/models/datawarehouse.rb +1 -0
  28. data/lib/gooddata/models/domain.rb +13 -16
  29. data/lib/gooddata/models/from_wire.rb +0 -2
  30. data/lib/gooddata/models/membership.rb +1 -1
  31. data/lib/gooddata/models/metadata/attribute.rb +1 -1
  32. data/lib/gooddata/models/metadata/dashboard.rb +1 -1
  33. data/lib/gooddata/models/metadata/dataset.rb +1 -1
  34. data/lib/gooddata/models/metadata/dimension.rb +1 -1
  35. data/lib/gooddata/models/metadata/fact.rb +1 -1
  36. data/lib/gooddata/models/metadata/label.rb +16 -17
  37. data/lib/gooddata/models/metadata/metric.rb +1 -1
  38. data/lib/gooddata/models/metadata/report.rb +1 -1
  39. data/lib/gooddata/models/metadata/report_definition.rb +7 -7
  40. data/lib/gooddata/models/metadata/variable.rb +1 -1
  41. data/lib/gooddata/models/model.rb +2 -2
  42. data/lib/gooddata/models/profile.rb +2 -2
  43. data/lib/gooddata/models/project.rb +21 -23
  44. data/lib/gooddata/models/project_role.rb +3 -3
  45. data/lib/gooddata/models/schedule.rb +18 -4
  46. data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +12 -15
  47. data/lib/gooddata/models/user_filters/user_filter.rb +8 -8
  48. data/lib/gooddata/models/user_filters/user_filter_builder.rb +16 -13
  49. data/lib/gooddata/models/user_filters/variable_user_filter.rb +1 -1
  50. data/lib/gooddata/rest/client.rb +4 -2
  51. data/lib/gooddata/rest/connection.rb +37 -30
  52. data/lib/gooddata/rest/connections/rest_client_connection.rb +1 -1
  53. data/lib/gooddata/version.rb +1 -1
  54. data/spec/environment/develop.rb +4 -4
  55. data/spec/environment/hotfix.rb +1 -1
  56. data/spec/environment/release.rb +1 -1
  57. data/spec/integration/full_project_spec.rb +3 -3
  58. data/spec/integration/over_to_user_filters_spec.rb +1 -0
  59. data/spec/integration/project_spec.rb +1 -1
  60. data/spec/integration/user_filters_spec.rb +0 -1
  61. data/spec/unit/commands/command_auth_spec.rb +10 -0
  62. data/spec/unit/extensions/hash_spec.rb +1 -1
  63. data/spec/unit/helpers_spec.rb +0 -8
  64. data/spec/unit/models/domain_spec.rb +1 -9
  65. data/spec/unit/models/from_wire_spec.rb +1 -19
  66. data/spec/unit/models/membership_spec.rb +1 -1
  67. data/spec/unit/models/metadata_spec.rb +1 -1
  68. data/spec/unit/models/profile_spec.rb +23 -47
  69. data/spec/unit/models/schedule_spec.rb +47 -3
  70. metadata +174 -50
  71. data/lib/gooddata/models/from_wire_parse.rb +0 -125
@@ -1,125 +0,0 @@
1
- # # encoding: UTF-8
2
- #
3
- # module GoodData
4
- # module Model
5
- # module FromWire
6
- # # Converts anchor from wire format into an internal blueprint representation
7
- # #
8
- # # @param stuff [Hash] Whatever comes from wire
9
- # # @return [Hash] Manifest for a particular reference
10
- # def self.parse_anchor(stuff)
11
- # attribute = stuff['dataset']['anchor']['attribute']
12
- # if !attribute.key?('labels')
13
- # []
14
- # else
15
- # labels = attribute['labels'] || []
16
- # default_label = attribute['defaultLabel']
17
- # primary_label_name = attribute['identifier'].split('.').last
18
- # dataset_name = attribute['identifier'].split('.')[1]
19
- # primary_label_identifier = GoodData::Model.identifier_for({ name: dataset_name }, type: :primary_label, name: primary_label_name)
20
- # primary_labels, regular_labels = labels.partition { |x| x['label']['identifier'] == primary_label_identifier }
21
- # dl = primary_labels.map do |label|
22
- # parse_label(attribute, label, 'anchor', default_label)
23
- # end
24
- # rl = regular_labels.map do |label|
25
- # parse_label(attribute, label, 'label', default_label)
26
- # end
27
- # dl + rl
28
- # end
29
- # end
30
- #
31
- # # Converts attrbutes from wire format into an internal blueprint representation
32
- # #
33
- # # @param stuff [Hash] Whatever comes from wire
34
- # # @return [Hash] Manifest for a particular reference
35
- # def self.parse_attributes(stuff)
36
- # dataset = stuff['dataset']
37
- # attributes = dataset['attributes'] || []
38
- # attributes.mapcat do |a|
39
- # attribute = a['attribute']
40
- # labels = attribute['labels'] || []
41
- # default_label = attribute['defaultLabel']
42
- # primary_label_name = attribute['identifier'].split('.').last
43
- # dataset_name = attribute['identifier'].split('.')[1]
44
- # primary_label_identifier = GoodData::Model.identifier_for({ name: dataset_name }, type: :primary_label, name: primary_label_name)
45
- # primary_labels, regular_labels = labels.partition { |x| x['label']['identifier'] == primary_label_identifier }
46
- # dl = primary_labels.map do |label|
47
- # parse_label(attribute, label, 'attribute', default_label)
48
- # end
49
- # rl = regular_labels.map do |label|
50
- # parse_label(attribute, label, 'label', default_label)
51
- # end
52
- # dl + rl
53
- # end
54
- # end
55
- #
56
- # # Converts date dimensions from wire format into an internal blueprint representation
57
- # #
58
- # # @param stuff [Hash] Whatever comes from wire
59
- # # @return [Hash] Manifest for a particular reference
60
- # def self.parse_date_dimensions(stuff)
61
- # {}.tap do |d|
62
- # d[:type] = :date_dimension
63
- # # d[:urn] = :date_dimension
64
- # d[:name] = stuff['dateDimension']['name']
65
- # d[:title] = stuff['dateDimension']['title'] if stuff['dateDimension']['title'] != d[:name].titleize
66
- # end
67
- # end
68
- #
69
- # # Converts facts from wire format into an internal blueprint representation
70
- # #
71
- # # @param stuff [Hash] Whatever comes from wire
72
- # # @return [Hash] Manifest for a particular reference
73
- # def self.parse_facts(stuff)
74
- # facts = stuff['dataset']['facts'] || []
75
- # facts.map do |fact|
76
- # {}.tap do |f|
77
- # f[:type] = fact['fact']['identifier'] =~ /^dt\./ ? :date_fact : :fact
78
- # f[:name] = fact['fact']['identifier'].split('.').last
79
- # f[:title] = fact['fact']['title'] if fact['fact']['title'] != fact['fact']['identifier'].split('.').last.titleize
80
- # f[:gd_data_type] = fact['fact']['dataType'] if fact['fact'].key?('dataType')
81
- # end
82
- # end
83
- # end
84
- #
85
- # # Converts label from wire format into an internal blueprint representation
86
- # #
87
- # # @param stuff [Hash] Whatever comes from wire
88
- # # @return [Hash] Manifest for a particular reference
89
- # def self.parse_label(attribute, label, type, default_label = nil)
90
- # {}.tap do |l|
91
- # l[:type] = type
92
- # l[:reference] = attribute['identifier'].split('.').last if type == 'label'
93
- # l[:name] = label['label']['identifier'].split('.').last
94
- # l[:title] = label['label']['title'] if label['label']['title'] != label['label']['identifier'].split('.').last.titleize
95
- # l[:gd_data_type] = label['label']['dataType'] if label['label'].key?('dataType')
96
- # l[:gd_type] = label['label']['type'] if label['label'].key?('type')
97
- # l[:default_label] = true if default_label == label['label']['identifier']
98
- # end
99
- # end
100
- #
101
- # # Converts label from wire format into an internal blueprint representation
102
- # #
103
- # # @param stuff [Hash] Whatever comes from wire
104
- # # @return [Hash] Manifest for a particular reference
105
- # def self.parse_references(stuff)
106
- # references = stuff['dataset']['references'] || []
107
- # references.map do |ref|
108
- # if ref =~ /^dataset\./
109
- # {
110
- # :type => :reference,
111
- # :name => ref.gsub(/^dataset\./, ''),
112
- # :dataset => ref.gsub(/^dataset\./, '')
113
- # }
114
- # else
115
- # {
116
- # :type => :date,
117
- # :name => ref.gsub(/^dataset\./, ''),
118
- # :dataset => ref.gsub(/^dataset\./, '')
119
- # }
120
- # end
121
- # end
122
- # end
123
- # end
124
- # end
125
- # end