gooddata 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +4 -0
  3. data/README.md +1 -0
  4. data/lib/gooddata/cli/commands/project_cmd.rb +2 -7
  5. data/lib/gooddata/client.rb +0 -2
  6. data/lib/gooddata/commands/project.rb +10 -0
  7. data/lib/gooddata/core/rest.rb +12 -2
  8. data/lib/gooddata/exceptions/attr_element_not_found.rb +12 -0
  9. data/lib/gooddata/extensions/enumerable.rb +12 -0
  10. data/lib/gooddata/helpers/global_helpers.rb +20 -0
  11. data/lib/gooddata/mixins/author.rb +16 -0
  12. data/lib/gooddata/mixins/content_getter.rb +11 -0
  13. data/lib/gooddata/mixins/content_property_reader.rb +13 -0
  14. data/lib/gooddata/mixins/content_property_writer.rb +13 -0
  15. data/lib/gooddata/mixins/contributor.rb +16 -0
  16. data/lib/gooddata/mixins/data_getter.rb +11 -0
  17. data/lib/gooddata/mixins/data_property_reader.rb +13 -0
  18. data/lib/gooddata/mixins/data_property_writer.rb +13 -0
  19. data/lib/gooddata/mixins/is_attribute.rb +13 -0
  20. data/lib/gooddata/mixins/is_fact.rb +13 -0
  21. data/lib/gooddata/mixins/is_label.rb +15 -0
  22. data/lib/gooddata/mixins/links.rb +11 -0
  23. data/lib/gooddata/mixins/md_finders.rb +36 -0
  24. data/lib/gooddata/mixins/md_id_to_uri.rb +29 -0
  25. data/lib/gooddata/mixins/md_json.rb +11 -0
  26. data/lib/gooddata/mixins/md_object_id.rb +11 -0
  27. data/lib/gooddata/mixins/md_object_indexer.rb +36 -0
  28. data/lib/gooddata/mixins/md_object_query.rb +83 -0
  29. data/lib/gooddata/mixins/md_relations.rb +39 -0
  30. data/lib/gooddata/mixins/meta_getter.rb +11 -0
  31. data/lib/gooddata/mixins/meta_property_reader.rb +13 -0
  32. data/lib/gooddata/mixins/meta_property_writer.rb +13 -0
  33. data/lib/gooddata/mixins/mixins.rb +15 -0
  34. data/lib/gooddata/mixins/not_attribute.rb +13 -0
  35. data/lib/gooddata/mixins/not_exportable.rb +11 -0
  36. data/lib/gooddata/mixins/not_fact.rb +13 -0
  37. data/lib/gooddata/mixins/not_label.rb +15 -0
  38. data/lib/gooddata/mixins/not_metric.rb +13 -0
  39. data/lib/gooddata/mixins/obj_id.rb +11 -0
  40. data/lib/gooddata/mixins/rest_getters.rb +13 -0
  41. data/lib/gooddata/mixins/rest_resource.rb +19 -0
  42. data/lib/gooddata/mixins/root_key_getter.rb +11 -0
  43. data/lib/gooddata/mixins/root_key_setter.rb +11 -0
  44. data/lib/gooddata/mixins/timestamps.rb +15 -0
  45. data/lib/gooddata/models/from_wire.rb +153 -0
  46. data/lib/gooddata/models/metadata.rb +28 -230
  47. data/lib/gooddata/models/metadata/attribute.rb +4 -6
  48. data/lib/gooddata/models/metadata/fact.rb +4 -6
  49. data/lib/gooddata/models/metadata/{display_form.rb → label.rb} +17 -11
  50. data/lib/gooddata/models/metadata/metric.rb +1 -1
  51. data/lib/gooddata/models/metadata/report_definition.rb +2 -2
  52. data/lib/gooddata/models/model.rb +55 -23
  53. data/lib/gooddata/models/models.rb +0 -2
  54. data/lib/gooddata/models/module_constants.rb +0 -2
  55. data/lib/gooddata/models/process.rb +1 -1
  56. data/lib/gooddata/models/project.rb +117 -76
  57. data/lib/gooddata/models/project_blueprint.rb +322 -42
  58. data/lib/gooddata/models/project_creator.rb +5 -4
  59. data/lib/gooddata/models/project_role.rb +20 -55
  60. data/lib/gooddata/models/schema_blueprint.rb +287 -84
  61. data/lib/gooddata/models/schema_builder.rb +0 -4
  62. data/lib/gooddata/models/to_manifest.rb +160 -0
  63. data/lib/gooddata/models/to_wire.rb +150 -0
  64. data/lib/gooddata/version.rb +1 -1
  65. data/spec/data/blueprint_invalid.json +3 -1
  66. data/spec/data/gd_gse_data_blueprint.json +1370 -0
  67. data/spec/data/gd_gse_data_manifest.json +1424 -0
  68. data/spec/data/gd_gse_data_model.json +1772 -0
  69. data/spec/data/manifest_test_project.json +116 -0
  70. data/spec/data/model_view.json +1772 -0
  71. data/spec/data/superfluous_titles_view.json +81 -0
  72. data/spec/data/test_project_model_spec.json +7 -4
  73. data/spec/data/wire_test_project.json +143 -0
  74. data/spec/helpers/crypto_helper.rb +9 -0
  75. data/spec/helpers/project_helper.rb +2 -0
  76. data/spec/integration/command_projects_spec.rb +4 -2
  77. data/spec/integration/full_project_spec.rb +51 -18
  78. data/spec/integration/partial_md_export_import_spec.rb +1 -1
  79. data/spec/spec_helper.rb +2 -1
  80. data/spec/unit/models/attribute_column_spec.rb +7 -7
  81. data/spec/unit/models/domain_spec.rb +2 -2
  82. data/spec/unit/models/from_wire_spec.rb +119 -0
  83. data/spec/unit/models/metadata_spec.rb +4 -2
  84. data/spec/unit/models/project_blueprint_spec.rb +32 -16
  85. data/spec/unit/models/project_role_spec.rb +6 -4
  86. data/spec/unit/models/project_spec.rb +26 -3
  87. data/spec/unit/models/schema_builder_spec.rb +5 -6
  88. data/spec/unit/models/to_manifest_spec.rb +24 -0
  89. data/spec/unit/models/to_wire_spec.rb +63 -0
  90. metadata +53 -29
  91. data/lib/gooddata/models/attributes/anchor.rb +0 -37
  92. data/lib/gooddata/models/attributes/attributes.rb +0 -8
  93. data/lib/gooddata/models/attributes/date_attribute.rb +0 -25
  94. data/lib/gooddata/models/attributes/time_attribute.rb +0 -24
  95. data/lib/gooddata/models/columns/attribute.rb +0 -71
  96. data/lib/gooddata/models/columns/columns.rb +0 -8
  97. data/lib/gooddata/models/columns/date_column.rb +0 -63
  98. data/lib/gooddata/models/columns/fact_model.rb +0 -54
  99. data/lib/gooddata/models/columns/label.rb +0 -55
  100. data/lib/gooddata/models/columns/reference.rb +0 -57
  101. data/lib/gooddata/models/facts/facts.rb +0 -8
  102. data/lib/gooddata/models/facts/time_fact.rb +0 -20
  103. data/lib/gooddata/models/folders/attribute_folder.rb +0 -20
  104. data/lib/gooddata/models/folders/fact_folder.rb +0 -20
  105. data/lib/gooddata/models/folders/folders.rb +0 -8
  106. data/lib/gooddata/models/metadata/column.rb +0 -61
  107. data/lib/gooddata/models/metadata/data_set.rb +0 -32
  108. data/lib/gooddata/models/metadata/date_dimension.rb +0 -26
  109. data/lib/gooddata/models/metadata/schema.rb +0 -227
  110. data/lib/gooddata/models/references/date_reference.rb +0 -44
  111. data/lib/gooddata/models/references/references.rb +0 -8
  112. data/lib/gooddata/models/references/time_reference.rb +0 -13
  113. data/spec/helpers/schema_helper.rb +0 -16
  114. data/spec/unit/models/anchor_spec.rb +0 -32
  115. data/spec/unit/models/tools_spec.rb +0 -95
  116. data/test/test_upload.rb +0 -79
@@ -0,0 +1,63 @@
1
+ # encoding: UTF-8
2
+ require 'gooddata'
3
+
4
+ include GoodData::Model
5
+
6
+ describe GoodData::Model::ProjectBlueprint do
7
+
8
+ before(:each) do
9
+ @spec = JSON.parse(File.read("./spec/data/test_project_model_spec.json"), :symbolize_names => true)
10
+ @result = JSON.parse(File.read("./spec/data/wire_test_project.json"), :symbolize_names => true)
11
+ end
12
+
13
+ it "should parse the model view and return the blueprint" do
14
+ expect(ToWire.to_wire(@spec)).to eq @result
15
+ end
16
+
17
+ it "should generate anchor" do
18
+
19
+ dataset_with_anchor = {
20
+ type: "dataset",
21
+ name: "repos",
22
+ columns: [{ type: "anchor", name: "repo_id"}]}
23
+
24
+ dataset_without_anchor = {
25
+ type: "dataset",
26
+ name: "repos",
27
+ columns: [{ type: "attribute", name: "repo_id"}]}
28
+
29
+ res = ToWire.anchor_to_wire(@spec, dataset_without_anchor)
30
+ expect(res).to eq({ attribute: { identifier: "attr.repos.factsof", title: "Records of Repos"}})
31
+
32
+ res = ToWire.anchor_to_wire(@spec, dataset_with_anchor)
33
+ expect(res).to eq({:attribute=>
34
+ {:identifier=>"attr.repos.repo_id",
35
+ :title=>"Repo",
36
+ :labels=>
37
+ [{:label=>
38
+ {:identifier=>"label.repos.repo_id",
39
+ :title=>"Repo",
40
+ :type=>nil,
41
+ :dataType=>nil}}],
42
+ :defaultLabel=>"label.repos.repo_id"}})
43
+ end
44
+
45
+ it "should parse the model view and return the blueprint" do
46
+ fact_table = {
47
+ :type=>"dataset",
48
+ :name=>"commits",
49
+ :columns=>
50
+ [{:type=>"reference",
51
+ :name=>"dev_id",
52
+ :dataset=>"devs",
53
+ :reference=>"dev_id"}]}
54
+ expect(ToWire.references_to_wire(@spec, fact_table)).to eq ["dataset.devs"]
55
+
56
+ fact_table = {
57
+ :type=>"dataset",
58
+ :name=>"commits",
59
+ :columns=>
60
+ [{:type=>"date", :name=>"committed_on", :dataset=>"committed_on"}]}
61
+ expect(ToWire.references_to_wire(@spec, fact_table)).to eq ["committed_on"]
62
+ end
63
+ end
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.4
4
+ version: 0.6.5
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-07-29 00:00:00.000000000 Z
14
+ date: 2014-08-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -523,55 +523,73 @@ files:
523
523
  - lib/gooddata/core/user.rb
524
524
  - lib/gooddata/data/data.rb
525
525
  - lib/gooddata/data/guesser.rb
526
+ - lib/gooddata/exceptions/attr_element_not_found.rb
526
527
  - lib/gooddata/exceptions/command_failed.rb
527
528
  - lib/gooddata/exceptions/exceptions.rb
528
529
  - lib/gooddata/exceptions/no_project_error.rb
529
530
  - lib/gooddata/exceptions/project_not_found.rb
530
531
  - lib/gooddata/exceptions/validation_error.rb
531
532
  - lib/gooddata/extensions/big_decimal.rb
533
+ - lib/gooddata/extensions/enumerable.rb
532
534
  - lib/gooddata/extensions/extensions.rb
533
535
  - lib/gooddata/extract.rb
534
536
  - lib/gooddata/goodzilla/goodzilla.rb
535
537
  - lib/gooddata/helpers/csv_helper.rb
536
538
  - lib/gooddata/helpers/global_helpers.rb
537
539
  - lib/gooddata/helpers/helpers.rb
538
- - lib/gooddata/models/attributes/anchor.rb
539
- - lib/gooddata/models/attributes/attributes.rb
540
- - lib/gooddata/models/attributes/date_attribute.rb
541
- - lib/gooddata/models/attributes/time_attribute.rb
542
- - lib/gooddata/models/columns/attribute.rb
543
- - lib/gooddata/models/columns/columns.rb
544
- - lib/gooddata/models/columns/date_column.rb
545
- - lib/gooddata/models/columns/fact_model.rb
546
- - lib/gooddata/models/columns/label.rb
547
- - lib/gooddata/models/columns/reference.rb
540
+ - lib/gooddata/mixins/author.rb
541
+ - lib/gooddata/mixins/content_getter.rb
542
+ - lib/gooddata/mixins/content_property_reader.rb
543
+ - lib/gooddata/mixins/content_property_writer.rb
544
+ - lib/gooddata/mixins/contributor.rb
545
+ - lib/gooddata/mixins/data_getter.rb
546
+ - lib/gooddata/mixins/data_property_reader.rb
547
+ - lib/gooddata/mixins/data_property_writer.rb
548
+ - lib/gooddata/mixins/is_attribute.rb
549
+ - lib/gooddata/mixins/is_fact.rb
550
+ - lib/gooddata/mixins/is_label.rb
551
+ - lib/gooddata/mixins/links.rb
552
+ - lib/gooddata/mixins/md_finders.rb
553
+ - lib/gooddata/mixins/md_id_to_uri.rb
554
+ - lib/gooddata/mixins/md_json.rb
555
+ - lib/gooddata/mixins/md_object_id.rb
556
+ - lib/gooddata/mixins/md_object_indexer.rb
557
+ - lib/gooddata/mixins/md_object_query.rb
558
+ - lib/gooddata/mixins/md_relations.rb
559
+ - lib/gooddata/mixins/meta_getter.rb
560
+ - lib/gooddata/mixins/meta_property_reader.rb
561
+ - lib/gooddata/mixins/meta_property_writer.rb
562
+ - lib/gooddata/mixins/mixins.rb
563
+ - lib/gooddata/mixins/not_attribute.rb
564
+ - lib/gooddata/mixins/not_exportable.rb
565
+ - lib/gooddata/mixins/not_fact.rb
566
+ - lib/gooddata/mixins/not_label.rb
567
+ - lib/gooddata/mixins/not_metric.rb
568
+ - lib/gooddata/mixins/obj_id.rb
569
+ - lib/gooddata/mixins/rest_getters.rb
570
+ - lib/gooddata/mixins/rest_resource.rb
571
+ - lib/gooddata/mixins/root_key_getter.rb
572
+ - lib/gooddata/mixins/root_key_setter.rb
573
+ - lib/gooddata/mixins/timestamps.rb
548
574
  - lib/gooddata/models/dashboard_builder.rb
549
575
  - lib/gooddata/models/data_result.rb
550
576
  - lib/gooddata/models/domain.rb
551
577
  - lib/gooddata/models/empty_result.rb
552
- - lib/gooddata/models/facts/facts.rb
553
- - lib/gooddata/models/facts/time_fact.rb
554
- - lib/gooddata/models/folders/attribute_folder.rb
555
- - lib/gooddata/models/folders/fact_folder.rb
556
- - lib/gooddata/models/folders/folders.rb
578
+ - lib/gooddata/models/from_wire.rb
557
579
  - lib/gooddata/models/invitation.rb
558
580
  - lib/gooddata/models/links.rb
559
581
  - lib/gooddata/models/md_object.rb
560
582
  - lib/gooddata/models/membership.rb
561
583
  - lib/gooddata/models/metadata.rb
562
584
  - lib/gooddata/models/metadata/attribute.rb
563
- - lib/gooddata/models/metadata/column.rb
564
585
  - lib/gooddata/models/metadata/dashboard.rb
565
- - lib/gooddata/models/metadata/data_set.rb
566
- - lib/gooddata/models/metadata/date_dimension.rb
567
- - lib/gooddata/models/metadata/display_form.rb
568
586
  - lib/gooddata/models/metadata/fact.rb
569
587
  - lib/gooddata/models/metadata/folder.rb
588
+ - lib/gooddata/models/metadata/label.rb
570
589
  - lib/gooddata/models/metadata/metadata.rb
571
590
  - lib/gooddata/models/metadata/metric.rb
572
591
  - lib/gooddata/models/metadata/report.rb
573
592
  - lib/gooddata/models/metadata/report_definition.rb
574
- - lib/gooddata/models/metadata/schema.rb
575
593
  - lib/gooddata/models/model.rb
576
594
  - lib/gooddata/models/models.rb
577
595
  - lib/gooddata/models/module_constants.rb
@@ -583,14 +601,13 @@ files:
583
601
  - lib/gooddata/models/project_creator.rb
584
602
  - lib/gooddata/models/project_metadata.rb
585
603
  - lib/gooddata/models/project_role.rb
586
- - lib/gooddata/models/references/date_reference.rb
587
- - lib/gooddata/models/references/references.rb
588
- - lib/gooddata/models/references/time_reference.rb
589
604
  - lib/gooddata/models/report_data_result.rb
590
605
  - lib/gooddata/models/schedule.rb
591
606
  - lib/gooddata/models/schema_blueprint.rb
592
607
  - lib/gooddata/models/schema_builder.rb
593
608
  - lib/gooddata/models/tab_builder.rb
609
+ - lib/gooddata/models/to_manifest.rb
610
+ - lib/gooddata/models/to_wire.rb
594
611
  - lib/gooddata/version.rb
595
612
  - lib/templates/bricks/brick.rb.erb
596
613
  - lib/templates/bricks/main.rb.erb
@@ -604,16 +621,23 @@ files:
604
621
  - spec/data/.gooddata
605
622
  - spec/data/additional_dataset_module.json
606
623
  - spec/data/blueprint_invalid.json
624
+ - spec/data/gd_gse_data_blueprint.json
625
+ - spec/data/gd_gse_data_manifest.json
626
+ - spec/data/gd_gse_data_model.json
627
+ - spec/data/manifest_test_project.json
607
628
  - spec/data/model_module.json
629
+ - spec/data/model_view.json
630
+ - spec/data/superfluous_titles_view.json
608
631
  - spec/data/test-ci-data.csv
609
632
  - spec/data/test_project_model_spec.json
610
633
  - spec/data/users.csv
634
+ - spec/data/wire_test_project.json
611
635
  - spec/helpers/blueprint_helper.rb
612
636
  - spec/helpers/cli_helper.rb
613
637
  - spec/helpers/connection_helper.rb
638
+ - spec/helpers/crypto_helper.rb
614
639
  - spec/helpers/csv_helper.rb
615
640
  - spec/helpers/project_helper.rb
616
- - spec/helpers/schema_helper.rb
617
641
  - spec/integration/command_projects_spec.rb
618
642
  - spec/integration/create_from_template_spec.rb
619
643
  - spec/integration/full_project_spec.rb
@@ -655,9 +679,9 @@ files:
655
679
  - spec/unit/godzilla/goodzilla_spec.rb
656
680
  - spec/unit/helpers/csv_helper_spec.rb
657
681
  - spec/unit/helpers_spec.rb
658
- - spec/unit/models/anchor_spec.rb
659
682
  - spec/unit/models/attribute_column_spec.rb
660
683
  - spec/unit/models/domain_spec.rb
684
+ - spec/unit/models/from_wire_spec.rb
661
685
  - spec/unit/models/invitation_spec.rb
662
686
  - spec/unit/models/md_object_spec.rb
663
687
  - spec/unit/models/membership_spec.rb
@@ -671,8 +695,8 @@ files:
671
695
  - spec/unit/models/project_spec.rb
672
696
  - spec/unit/models/schedule_spec.rb
673
697
  - spec/unit/models/schema_builder_spec.rb
674
- - spec/unit/models/tools_spec.rb
675
- - test/test_upload.rb
698
+ - spec/unit/models/to_manifest_spec.rb
699
+ - spec/unit/models/to_wire_spec.rb
676
700
  - tmp/.gitkeepme
677
701
  - yard-server.sh
678
702
  homepage: http://github.com/gooddata/gooddata-ruby
@@ -1,37 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative '../columns/attribute'
4
-
5
- module GoodData
6
- module Model
7
- ##
8
- # A GoodData attribute that represents a data set's connection point or a data set
9
- # without a connection point
10
- #
11
- class Anchor < Attribute
12
- def initialize(column, schema)
13
- if column
14
- super
15
- else
16
- super({ :type => 'anchor', :name => 'id' }, schema)
17
- @labels = []
18
- @primary_label = nil
19
- end
20
- end
21
-
22
- def table
23
- @table ||= 'f_' + @schema.name
24
- end
25
-
26
- def to_maql_create
27
- maql = super
28
- maql += "\n# Connect '#{title}' to all attributes of this data set\n"
29
- @schema.attributes.values.each do |c|
30
- maql += "ALTER ATTRIBUTE {#{c.identifier}} ADD KEYS " \
31
- + "{#{table}.#{c.key}};\n"
32
- end
33
- maql
34
- end
35
- end
36
- end
37
- end
@@ -1,8 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'pathname'
4
-
5
- base = Pathname(__FILE__).dirname.expand_path
6
- Dir.glob(base + '*.rb').each do |file|
7
- require file
8
- end
@@ -1,25 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative '../columns/attribute'
4
-
5
- module GoodData
6
- module Model
7
- ##
8
- # Date field that's not connected to a date dimension
9
- #
10
- class DateAttribute < Attribute
11
- def key
12
- "#{DATE_COLUMN_PREFIX}#{super}"
13
- end
14
-
15
- def to_manifest_part(mode)
16
- {
17
- 'populates' => ['label.stuff.mmddyy'],
18
- 'format' => 'unknown',
19
- 'mode' => mode,
20
- 'referenceKey' => 1
21
- }
22
- end
23
- end
24
- end
25
- end
@@ -1,24 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative '../columns/attribute'
4
-
5
- module GoodData
6
- module Model
7
- ##
8
- # Time field that's not connected to a time-of-a-day dimension
9
- #
10
- class TimeAttribute < Attribute
11
- def type_prefix
12
- TIME_ATTRIBUTE_PREFIX
13
- end
14
-
15
- def key
16
- "#{TIME_COLUMN_PREFIX}#{super}"
17
- end
18
-
19
- def table
20
- @table ||= "#{super}_tm"
21
- end
22
- end
23
- end
24
- end
@@ -1,71 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative '../metadata/column'
4
- require_relative 'label'
5
-
6
- module GoodData
7
- module Model
8
- ##
9
- # GoodData attribute abstraction
10
- #
11
- class Attribute < Column
12
- attr_reader :primary_label, :labels
13
-
14
- def type_prefix
15
- ATTRIBUTE_PREFIX
16
- end
17
-
18
- def folder_prefix
19
- ATTRIBUTE_FOLDER_PREFIX
20
- end
21
-
22
- def initialize(hash, schema)
23
- super hash, schema
24
- @labels = []
25
- @primary_label = Label.new hash, self, schema
26
- end
27
-
28
- def table
29
- @table ||= 'd_' + @schema.name + '_' + name
30
- end
31
-
32
- def key
33
- "#{@name}#{FK_SUFFIX}"
34
- end
35
-
36
- def to_maql_create
37
- maql = "CREATE ATTRIBUTE {#{identifier}} VISUAL (#{visual})" \
38
- + " AS KEYS {#{table}.#{Model::FIELD_PK}} FULLSET;\n"
39
- maql += @primary_label.to_maql_create if @primary_label
40
- maql
41
- end
42
-
43
- def to_manifest_part(mode)
44
- {
45
- 'referenceKey' => 1,
46
- 'populates' => [@primary_label.identifier],
47
- 'mode' => mode,
48
- 'columnName' => name
49
- }
50
- end
51
-
52
- def to_wire_model
53
- {
54
- 'attribute' => {
55
- 'identifier' => identifier,
56
- 'title' => title,
57
- 'labels' => labels.map do |l|
58
- {
59
- 'label' => {
60
- 'identifier' => l.identifier,
61
- 'title' => l.title,
62
- 'type' => 'GDC.text'
63
- }
64
- }
65
- end
66
- }
67
- }
68
- end
69
- end
70
- end
71
- end
@@ -1,8 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'pathname'
4
-
5
- base = Pathname(__FILE__).dirname.expand_path
6
- Dir.glob(base + '*.rb').each do |file|
7
- require file
8
- end
@@ -1,63 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require_relative '../attributes/attributes'
4
- require_relative '../metadata/column'
5
- require_relative '../references/references'
6
-
7
- module GoodData
8
- module Model
9
- ##
10
- # Date column. A container holding the following
11
- # parts: date fact, a date reference or attribute and an optional time component
12
- # that contains a time fact and a time reference or attribute.
13
- #
14
- class DateColumn < Column
15
- attr_reader :parts, :facts, :attributes, :references
16
-
17
- def initialize(column, schema)
18
- super column, schema
19
- @parts = {}
20
- @facts = []
21
- @attributes = []
22
- @references = []
23
-
24
- # @facts << @parts[:date_fact] = DateFact.new(column, schema)
25
- if column[:dataset]
26
- @parts[:date_ref] = DateReference.new column, schema
27
- @references << @parts[:date_ref]
28
- else
29
- @attributes << @parts[:date_attr] = DateAttribute.new(column, schema)
30
- end
31
- # if column['datetime'] then
32
- # puts "*** datetime"
33
- # @facts << @parts[:time_fact] = TimeFact.new(column, schema)
34
- # if column['schema_reference'] then
35
- # @parts[:time_ref] = TimeReference.new column, schema
36
- # else
37
- # @attributes << @parts[:time_attr] = TimeAttribute.new(column, schema)
38
- # end
39
- # end
40
- end
41
-
42
- def to_maql_create
43
- @parts.values.map { |v| v.to_maql_create }.join "\n"
44
- end
45
-
46
- def to_maql_drop
47
- @parts.values.map { |v| v.to_maql_drop }.join "\n"
48
- end
49
-
50
- def to_csv_header(row)
51
- SKIP_FIELD
52
- end
53
-
54
- def to_csv_data(headers, row)
55
- SKIP_FIELD
56
- end
57
-
58
- def to_manifest_part(mode)
59
- nil
60
- end
61
- end
62
- end
63
- end