gooddata 0.6.49 → 0.6.50

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 (390) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -4
  3. data/CLI.md +0 -4
  4. data/DEPENDENCIES.md +0 -8
  5. data/Dockerfile.jruby +19 -0
  6. data/Dockerfile.ruby +19 -0
  7. data/LICENSE +2 -2
  8. data/LICENSE.rb +1 -1
  9. data/Rakefile +1 -1
  10. data/gooddata.gemspec +29 -28
  11. data/lib/gooddata.rb +2 -1
  12. data/lib/gooddata/app/app.rb +1 -1
  13. data/lib/gooddata/bricks/base_downloader.rb +1 -1
  14. data/lib/gooddata/bricks/brick.rb +3 -4
  15. data/lib/gooddata/bricks/bricks.rb +3 -1
  16. data/lib/gooddata/bricks/middleware/aws_middleware.rb +6 -8
  17. data/lib/gooddata/bricks/middleware/base_middleware.rb +2 -1
  18. data/lib/gooddata/bricks/middleware/bench_middleware.rb +2 -1
  19. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +3 -3
  20. data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +3 -2
  21. data/lib/gooddata/bricks/middleware/dwh_middleware.rb +28 -0
  22. data/lib/gooddata/bricks/middleware/fs_download_middleware.rb +2 -2
  23. data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +2 -2
  24. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +84 -21
  25. data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
  26. data/lib/gooddata/bricks/middleware/middleware.rb +1 -1
  27. data/lib/gooddata/bricks/middleware/params_inspect_middleware.rb +21 -0
  28. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +26 -26
  29. data/lib/gooddata/bricks/middleware/stdout_middleware.rb +1 -1
  30. data/lib/gooddata/bricks/middleware/twitter_middleware.rb +1 -1
  31. data/lib/gooddata/bricks/middleware/undot_params_middleware.rb +1 -1
  32. data/lib/gooddata/bricks/pipeline.rb +6 -13
  33. data/lib/gooddata/bricks/utils.rb +3 -3
  34. data/lib/gooddata/cli/cli.rb +1 -1
  35. data/lib/gooddata/cli/commands/auth_cmd.rb +1 -1
  36. data/lib/gooddata/cli/commands/domain_cmd.rb +1 -1
  37. data/lib/gooddata/cli/commands/project_cmd.rb +1 -18
  38. data/lib/gooddata/cli/hooks.rb +1 -2
  39. data/lib/gooddata/cli/shared.rb +1 -1
  40. data/lib/gooddata/cli/terminal.rb +1 -1
  41. data/lib/gooddata/client.rb +1 -1
  42. data/lib/gooddata/commands/api.rb +1 -1
  43. data/lib/gooddata/commands/auth.rb +1 -1
  44. data/lib/gooddata/commands/base.rb +1 -1
  45. data/lib/gooddata/commands/commands.rb +1 -1
  46. data/lib/gooddata/commands/datasets.rb +1 -1
  47. data/lib/gooddata/commands/datawarehouse.rb +1 -1
  48. data/lib/gooddata/commands/domain.rb +1 -1
  49. data/lib/gooddata/commands/process.rb +1 -1
  50. data/lib/gooddata/commands/project.rb +2 -31
  51. data/lib/gooddata/commands/projects.rb +1 -1
  52. data/lib/gooddata/commands/role.rb +1 -1
  53. data/lib/gooddata/commands/runners.rb +1 -1
  54. data/lib/gooddata/commands/scaffold.rb +1 -1
  55. data/lib/gooddata/commands/user.rb +1 -1
  56. data/lib/gooddata/connection.rb +1 -1
  57. data/lib/gooddata/core/core.rb +1 -1
  58. data/lib/gooddata/core/logging.rb +1 -1
  59. data/lib/gooddata/core/nil_logger.rb +1 -1
  60. data/lib/gooddata/core/project.rb +1 -1
  61. data/lib/gooddata/core/rest.rb +1 -1
  62. data/lib/gooddata/core/user.rb +1 -1
  63. data/lib/gooddata/data/data.rb +1 -1
  64. data/lib/gooddata/data/guesser.rb +1 -1
  65. data/lib/gooddata/exceptions/attr_element_not_found.rb +1 -1
  66. data/lib/gooddata/exceptions/command_failed.rb +1 -1
  67. data/lib/gooddata/exceptions/exceptions.rb +1 -1
  68. data/lib/gooddata/exceptions/execution_limit_exceeded.rb +1 -1
  69. data/lib/gooddata/exceptions/export_clone.rb +4 -0
  70. data/lib/gooddata/exceptions/filter_maqlization.rb +1 -1
  71. data/lib/gooddata/exceptions/import_clone.rb +4 -0
  72. data/lib/gooddata/exceptions/malformed_user.rb +1 -1
  73. data/lib/gooddata/exceptions/maql_execution.rb +1 -1
  74. data/lib/gooddata/exceptions/no_project_error.rb +1 -1
  75. data/lib/gooddata/exceptions/object_migration.rb +1 -1
  76. data/lib/gooddata/exceptions/project_not_found.rb +1 -1
  77. data/lib/gooddata/exceptions/segment_not_empty.rb +1 -1
  78. data/lib/gooddata/exceptions/uncomputable_report.rb +1 -1
  79. data/lib/gooddata/exceptions/user_in_different_domain.rb +1 -1
  80. data/lib/gooddata/exceptions/validation_error.rb +1 -1
  81. data/lib/gooddata/extensions/big_decimal.rb +1 -1
  82. data/lib/gooddata/extensions/class.rb +11 -0
  83. data/lib/gooddata/extensions/enumerable.rb +1 -1
  84. data/lib/gooddata/extensions/extensions.rb +1 -1
  85. data/lib/gooddata/extensions/false.rb +9 -1
  86. data/lib/gooddata/extensions/hash.rb +12 -1
  87. data/lib/gooddata/extensions/integer.rb +5 -0
  88. data/lib/gooddata/extensions/nil.rb +5 -1
  89. data/lib/gooddata/extensions/numeric.rb +1 -1
  90. data/lib/gooddata/extensions/object.rb +5 -1
  91. data/lib/gooddata/extensions/symbol.rb +1 -1
  92. data/lib/gooddata/extensions/true.rb +9 -1
  93. data/lib/gooddata/extract.rb +1 -1
  94. data/lib/gooddata/goodzilla/goodzilla.rb +1 -1
  95. data/lib/gooddata/helpers/auth_helpers.rb +1 -1
  96. data/lib/gooddata/helpers/csv_helper.rb +1 -1
  97. data/lib/gooddata/helpers/data_helper.rb +19 -10
  98. data/lib/gooddata/helpers/erb_helper.rb +23 -0
  99. data/lib/gooddata/helpers/global_helpers.rb +5 -73
  100. data/lib/gooddata/helpers/global_helpers_params.rb +73 -7
  101. data/lib/gooddata/helpers/helpers.rb +1 -1
  102. data/lib/gooddata/lcm/actions/actions.rb +12 -0
  103. data/lib/gooddata/lcm/actions/associate_clients.rb +46 -0
  104. data/lib/gooddata/lcm/actions/base_action.rb +23 -0
  105. data/lib/gooddata/lcm/actions/collect_clients.rb +89 -0
  106. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +103 -0
  107. data/lib/gooddata/lcm/actions/collect_segments.rb +59 -0
  108. data/lib/gooddata/lcm/actions/create_segment_masters.rb +167 -0
  109. data/lib/gooddata/lcm/actions/ensure_release_table.rb +56 -0
  110. data/lib/gooddata/lcm/actions/ensure_segments.rb +35 -0
  111. data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +66 -0
  112. data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +68 -0
  113. data/lib/gooddata/lcm/actions/ensure_titles.rb +54 -0
  114. data/lib/gooddata/lcm/actions/hello_world.rb +44 -0
  115. data/lib/gooddata/lcm/actions/print_actions.rb +61 -0
  116. data/lib/gooddata/lcm/actions/print_modes.rb +72 -0
  117. data/lib/gooddata/lcm/actions/print_types.rb +55 -0
  118. data/lib/gooddata/lcm/actions/provision_clients.rb +80 -0
  119. data/lib/gooddata/lcm/actions/purge_clients.rb +78 -0
  120. data/lib/gooddata/lcm/actions/segments_filter.rb +50 -0
  121. data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +60 -0
  122. data/lib/gooddata/lcm/actions/synchronize_clients.rb +87 -0
  123. data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +59 -0
  124. data/lib/gooddata/lcm/actions/synchronize_label_types.rb +61 -0
  125. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +64 -0
  126. data/lib/gooddata/lcm/actions/synchronize_meta.rb +55 -0
  127. data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +55 -0
  128. data/lib/gooddata/lcm/actions/synchronize_processes.rb +66 -0
  129. data/lib/gooddata/lcm/actions/synchronize_schedules.rb +81 -0
  130. data/lib/gooddata/lcm/actions/update_release_table.rb +80 -0
  131. data/lib/gooddata/lcm/data/create_lcm_release.sql.erb +5 -0
  132. data/lib/gooddata/lcm/data/insert_into_lcm_release.sql.erb +11 -0
  133. data/lib/gooddata/lcm/data/select_from_lcm_release.sql.erb +8 -0
  134. data/lib/gooddata/lcm/data/update_lcm_release.sql.erb +7 -0
  135. data/lib/gooddata/lcm/dsl/dsl.rb +50 -0
  136. data/lib/gooddata/lcm/dsl/params_dsl.rb +61 -0
  137. data/lib/gooddata/lcm/dsl/type_dsl.rb +61 -0
  138. data/lib/gooddata/lcm/helpers/check_helper.rb +37 -0
  139. data/lib/gooddata/lcm/helpers/helpers.rb +12 -0
  140. data/lib/gooddata/lcm/lcm.rb +161 -20
  141. data/lib/gooddata/lcm/lcm2.rb +260 -0
  142. data/lib/gooddata/lcm/types/base_type.rb +29 -0
  143. data/lib/gooddata/lcm/types/class/ads_client.rb +35 -0
  144. data/lib/gooddata/lcm/types/class/class.rb +21 -0
  145. data/lib/gooddata/lcm/types/class/gd_client.rb +35 -0
  146. data/lib/gooddata/lcm/types/class/types.rb +12 -0
  147. data/lib/gooddata/lcm/types/complex/complex.rb +33 -0
  148. data/lib/gooddata/lcm/types/complex/release_query.rb +35 -0
  149. data/lib/gooddata/lcm/types/complex/segment.rb +37 -0
  150. data/lib/gooddata/lcm/types/complex/synchronization_info.rb +32 -0
  151. data/lib/gooddata/lcm/types/complex/tokens.rb +31 -0
  152. data/lib/gooddata/lcm/types/complex/types.rb +12 -0
  153. data/lib/gooddata/lcm/types/complex/update_preference.rb +32 -0
  154. data/lib/gooddata/lcm/types/param.rb +16 -0
  155. data/lib/gooddata/lcm/types/scalar/bool.rb +22 -0
  156. data/lib/gooddata/lcm/types/scalar/hash.rb +22 -0
  157. data/lib/gooddata/lcm/types/scalar/integer.rb +22 -0
  158. data/lib/gooddata/lcm/types/scalar/object.rb +22 -0
  159. data/lib/gooddata/lcm/types/scalar/string.rb +22 -0
  160. data/lib/gooddata/lcm/types/scalar/types.rb +12 -0
  161. data/lib/gooddata/lcm/types/special/array.rb +35 -0
  162. data/lib/gooddata/lcm/types/special/enum.rb +17 -0
  163. data/lib/gooddata/lcm/types/special/types.rb +12 -0
  164. data/lib/gooddata/lcm/types/types.rb +12 -0
  165. data/lib/gooddata/mixins/author.rb +1 -1
  166. data/lib/gooddata/mixins/content_getter.rb +1 -1
  167. data/lib/gooddata/mixins/content_property_reader.rb +1 -1
  168. data/lib/gooddata/mixins/content_property_writer.rb +1 -1
  169. data/lib/gooddata/mixins/contributor.rb +1 -1
  170. data/lib/gooddata/mixins/data_getter.rb +1 -1
  171. data/lib/gooddata/mixins/data_property_reader.rb +1 -1
  172. data/lib/gooddata/mixins/data_property_writer.rb +1 -1
  173. data/lib/gooddata/mixins/inspector.rb +1 -1
  174. data/lib/gooddata/mixins/is_attribute.rb +1 -1
  175. data/lib/gooddata/mixins/is_dimension.rb +1 -1
  176. data/lib/gooddata/mixins/is_fact.rb +1 -1
  177. data/lib/gooddata/mixins/is_label.rb +1 -1
  178. data/lib/gooddata/mixins/links.rb +1 -1
  179. data/lib/gooddata/mixins/md_finders.rb +1 -1
  180. data/lib/gooddata/mixins/md_grantees.rb +1 -1
  181. data/lib/gooddata/mixins/md_id_to_uri.rb +9 -3
  182. data/lib/gooddata/mixins/md_json.rb +1 -1
  183. data/lib/gooddata/mixins/md_lock.rb +1 -1
  184. data/lib/gooddata/mixins/md_object_id.rb +1 -1
  185. data/lib/gooddata/mixins/md_object_indexer.rb +1 -1
  186. data/lib/gooddata/mixins/md_object_query.rb +1 -1
  187. data/lib/gooddata/mixins/md_relations.rb +1 -1
  188. data/lib/gooddata/mixins/meta_getter.rb +1 -1
  189. data/lib/gooddata/mixins/meta_property_reader.rb +1 -1
  190. data/lib/gooddata/mixins/meta_property_writer.rb +1 -1
  191. data/lib/gooddata/mixins/mixins.rb +1 -1
  192. data/lib/gooddata/mixins/not_attribute.rb +1 -1
  193. data/lib/gooddata/mixins/not_exportable.rb +1 -1
  194. data/lib/gooddata/mixins/not_fact.rb +1 -1
  195. data/lib/gooddata/mixins/not_group.rb +1 -1
  196. data/lib/gooddata/mixins/not_label.rb +1 -1
  197. data/lib/gooddata/mixins/not_metric.rb +1 -1
  198. data/lib/gooddata/mixins/obj_id.rb +1 -1
  199. data/lib/gooddata/mixins/rest_getters.rb +1 -1
  200. data/lib/gooddata/mixins/rest_resource.rb +1 -1
  201. data/lib/gooddata/mixins/root_key_getter.rb +1 -1
  202. data/lib/gooddata/mixins/root_key_setter.rb +1 -1
  203. data/lib/gooddata/mixins/timestamps.rb +1 -1
  204. data/lib/gooddata/models/ads_output_stage.rb +85 -0
  205. data/lib/gooddata/models/automated_data_distribution.rb +36 -0
  206. data/lib/gooddata/models/blueprint/anchor_field.rb +4 -3
  207. data/lib/gooddata/models/blueprint/attribute_field.rb +18 -2
  208. data/lib/gooddata/models/blueprint/blueprint.rb +1 -1
  209. data/lib/gooddata/models/blueprint/blueprint_field.rb +1 -1
  210. data/lib/gooddata/models/blueprint/dashboard_builder.rb +1 -1
  211. data/lib/gooddata/models/blueprint/dataset_blueprint.rb +6 -1
  212. data/lib/gooddata/models/blueprint/date_dimension.rb +1 -1
  213. data/lib/gooddata/models/blueprint/fact_field.rb +1 -1
  214. data/lib/gooddata/models/blueprint/label_field.rb +5 -1
  215. data/lib/gooddata/models/blueprint/project_blueprint.rb +1 -1
  216. data/lib/gooddata/models/blueprint/project_builder.rb +1 -1
  217. data/lib/gooddata/models/blueprint/reference_field.rb +1 -1
  218. data/lib/gooddata/models/blueprint/schema_blueprint.rb +1 -1
  219. data/lib/gooddata/models/blueprint/schema_builder.rb +1 -1
  220. data/lib/gooddata/models/blueprint/to_manifest.rb +7 -3
  221. data/lib/gooddata/models/blueprint/to_wire.rb +12 -1
  222. data/lib/gooddata/models/channel_configuration.rb +112 -0
  223. data/lib/gooddata/models/client.rb +42 -6
  224. data/lib/gooddata/models/client_synchronization_result.rb +1 -1
  225. data/lib/gooddata/models/client_synchronization_result_details.rb +1 -1
  226. data/lib/gooddata/models/datawarehouse.rb +25 -3
  227. data/lib/gooddata/models/domain.rb +29 -4
  228. data/lib/gooddata/models/execution.rb +1 -1
  229. data/lib/gooddata/models/execution_detail.rb +1 -1
  230. data/lib/gooddata/models/from_wire.rb +8 -1
  231. data/lib/gooddata/models/invitation.rb +1 -1
  232. data/lib/gooddata/models/links.rb +1 -1
  233. data/lib/gooddata/models/membership.rb +1 -1
  234. data/lib/gooddata/models/metadata.rb +3 -2
  235. data/lib/gooddata/models/metadata/attribute.rb +7 -1
  236. data/lib/gooddata/models/metadata/dashboard.rb +3 -3
  237. data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +1 -1
  238. data/lib/gooddata/models/metadata/dashboard/filter_apply_item.rb +2 -2
  239. data/lib/gooddata/models/metadata/dashboard/filter_item.rb +2 -2
  240. data/lib/gooddata/models/metadata/dashboard/geo_chart_item.rb +2 -2
  241. data/lib/gooddata/models/metadata/dashboard/headline_item.rb +2 -2
  242. data/lib/gooddata/models/metadata/dashboard/iframe_item.rb +2 -2
  243. data/lib/gooddata/models/metadata/dashboard/report_item.rb +2 -2
  244. data/lib/gooddata/models/metadata/dashboard/text_item.rb +2 -2
  245. data/lib/gooddata/models/metadata/dashboard_tab.rb +2 -2
  246. data/lib/gooddata/models/metadata/dataset.rb +1 -1
  247. data/lib/gooddata/models/metadata/dimension.rb +1 -1
  248. data/lib/gooddata/models/metadata/fact.rb +1 -1
  249. data/lib/gooddata/models/metadata/folder.rb +1 -1
  250. data/lib/gooddata/models/metadata/label.rb +1 -1
  251. data/lib/gooddata/models/metadata/metadata.rb +1 -1
  252. data/lib/gooddata/models/metadata/metric.rb +1 -1
  253. data/lib/gooddata/models/metadata/report.rb +1 -1
  254. data/lib/gooddata/models/metadata/report_definition.rb +1 -1
  255. data/lib/gooddata/models/metadata/scheduled_mail.rb +2 -2
  256. data/lib/gooddata/models/metadata/scheduled_mail/dashboard_attachment.rb +1 -1
  257. data/lib/gooddata/models/metadata/scheduled_mail/report_attachment.rb +1 -1
  258. data/lib/gooddata/models/metadata/variable.rb +1 -1
  259. data/lib/gooddata/models/model.rb +1 -1
  260. data/lib/gooddata/models/models.rb +1 -1
  261. data/lib/gooddata/models/module_constants.rb +1 -1
  262. data/lib/gooddata/models/notification_rule.rb +113 -0
  263. data/lib/gooddata/models/process.rb +10 -3
  264. data/lib/gooddata/models/profile.rb +9 -1
  265. data/lib/gooddata/models/project.rb +248 -50
  266. data/lib/gooddata/models/project_creator.rb +2 -2
  267. data/lib/gooddata/models/project_metadata.rb +1 -1
  268. data/lib/gooddata/models/project_role.rb +1 -1
  269. data/lib/gooddata/models/report_data_result.rb +1 -1
  270. data/lib/gooddata/models/schedule.rb +49 -13
  271. data/lib/gooddata/models/segment.rb +3 -3
  272. data/lib/gooddata/models/style_setting.rb +71 -0
  273. data/lib/gooddata/models/subscription.rb +181 -0
  274. data/lib/gooddata/models/tab_builder.rb +1 -1
  275. data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +1 -1
  276. data/lib/gooddata/models/user_filters/user_filter.rb +1 -1
  277. data/lib/gooddata/models/user_filters/user_filter_builder.rb +11 -5
  278. data/lib/gooddata/models/user_filters/user_filters.rb +1 -1
  279. data/lib/gooddata/models/user_filters/variable_user_filter.rb +1 -1
  280. data/lib/gooddata/models/user_group.rb +19 -12
  281. data/lib/gooddata/rest/client.rb +9 -1
  282. data/lib/gooddata/rest/connection.rb +18 -9
  283. data/lib/gooddata/rest/object.rb +1 -1
  284. data/lib/gooddata/rest/object_factory.rb +1 -1
  285. data/lib/gooddata/rest/resource.rb +1 -1
  286. data/lib/gooddata/rest/rest.rb +1 -1
  287. data/lib/gooddata/version.rb +2 -2
  288. data/spec/.rubocop.yml +16 -0
  289. data/spec/bricks/bricks_spec.rb +13 -15
  290. data/spec/data/blueprints/attribute_sort_order_blueprint.json +72 -0
  291. data/spec/data/gooddata_version_process/gooddata_version.rb +1 -1
  292. data/spec/data/hello_world_process/hello_world.rb +2 -2
  293. data/spec/data/ruby_params_process/ruby_params.rb +1 -1
  294. data/spec/data/ruby_process/process.rb +2 -2
  295. data/spec/data/wire_models/attribute_sort_by_model.json +73 -0
  296. data/spec/environment/default.rb +14 -13
  297. data/spec/environment/develop.rb +26 -11
  298. data/spec/environment/environment.rb +2 -1
  299. data/spec/environment/hotfix.rb +15 -7
  300. data/spec/environment/production.rb +6 -14
  301. data/spec/environment/staging.rb +9 -10
  302. data/spec/helpers/blueprint_helper.rb +11 -10
  303. data/spec/helpers/cli_helper.rb +26 -24
  304. data/spec/helpers/connection_helper.rb +28 -26
  305. data/spec/helpers/crypto_helper.rb +8 -6
  306. data/spec/helpers/csv_helper.rb +7 -5
  307. data/spec/helpers/process_helper.rb +13 -11
  308. data/spec/helpers/project_helper.rb +36 -34
  309. data/spec/helpers/schedule_helper.rb +13 -11
  310. data/spec/helpers/spec_helper.rb +8 -6
  311. data/spec/integration/ads_output_stage_spec.rb +55 -0
  312. data/spec/integration/blueprint_updates_spec.rb +22 -16
  313. data/spec/integration/blueprint_with_grain_spec.rb +5 -3
  314. data/spec/integration/channel_configuration_spec.rb +67 -0
  315. data/spec/integration/clients_spec.rb +31 -22
  316. data/spec/integration/command_datawarehouse_spec.rb +4 -4
  317. data/spec/integration/command_projects_spec.rb +6 -6
  318. data/spec/integration/create_from_template_spec.rb +4 -3
  319. data/spec/integration/create_project_spec.rb +7 -4
  320. data/spec/integration/date_dim_switch_spec.rb +25 -28
  321. data/spec/integration/deprecated_load_spec.rb +11 -9
  322. data/spec/integration/full_process_schedule_spec.rb +82 -13
  323. data/spec/integration/full_project_spec.rb +67 -45
  324. data/spec/integration/lcm_spec.rb +41 -0
  325. data/spec/integration/over_to_user_filters_spec.rb +14 -10
  326. data/spec/integration/partial_md_export_import_spec.rb +3 -4
  327. data/spec/integration/project_spec.rb +101 -42
  328. data/spec/integration/rest_spec.rb +5 -4
  329. data/spec/integration/schedule_spec.rb +28 -39
  330. data/spec/integration/segments_spec.rb +42 -31
  331. data/spec/integration/subscription_spec.rb +63 -0
  332. data/spec/integration/user_filters_spec.rb +49 -39
  333. data/spec/integration/user_group_spec.rb +25 -5
  334. data/spec/integration/variables_spec.rb +34 -32
  335. data/spec/logging_in_logging_out_spec.rb +6 -8
  336. data/spec/spec_helper.rb +3 -3
  337. data/spec/unit/bricks/bricks_spec.rb +3 -4
  338. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +8 -15
  339. data/spec/unit/bricks/middleware/bench_middleware_spec.rb +2 -2
  340. data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +2 -2
  341. data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +2 -2
  342. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +2 -2
  343. data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +3 -3
  344. data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +3 -3
  345. data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +3 -3
  346. data/spec/unit/cli/cli_spec.rb +3 -3
  347. data/spec/unit/cli/commands/cmd_auth_spec.rb +2 -2
  348. data/spec/unit/commands/command_projects_spec.rb +3 -3
  349. data/spec/unit/core/connection_spec.rb +3 -4
  350. data/spec/unit/core/logging_spec.rb +2 -5
  351. data/spec/unit/core/nil_logger_spec.rb +2 -2
  352. data/spec/unit/core/project_spec.rb +4 -4
  353. data/spec/unit/extensions/hash_spec.rb +3 -4
  354. data/spec/unit/godzilla/goodzilla_spec.rb +22 -26
  355. data/spec/unit/helpers/csv_helper_spec.rb +3 -3
  356. data/spec/unit/helpers/data_helper_spec.rb +6 -18
  357. data/spec/unit/helpers/global_helpers_spec.rb +112 -28
  358. data/spec/unit/helpers_spec.rb +139 -2
  359. data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +20 -0
  360. data/spec/unit/models/blueprint/attributes_spec.rb +1 -2
  361. data/spec/unit/models/blueprint/dataset_spec.rb +2 -3
  362. data/spec/unit/models/blueprint/labels_spec.rb +1 -2
  363. data/spec/unit/models/blueprint/project_blueprint_spec.rb +34 -35
  364. data/spec/unit/models/blueprint/reference_spec.rb +1 -2
  365. data/spec/unit/models/blueprint/schema_builder_spec.rb +5 -7
  366. data/spec/unit/models/blueprint/to_wire_spec.rb +76 -55
  367. data/spec/unit/models/domain_spec.rb +4 -5
  368. data/spec/unit/models/execution_spec.rb +16 -15
  369. data/spec/unit/models/from_wire_spec.rb +24 -19
  370. data/spec/unit/models/invitation_spec.rb +1 -1
  371. data/spec/unit/models/membership_spec.rb +36 -41
  372. data/spec/unit/models/metadata_spec.rb +20 -18
  373. data/spec/unit/models/metric_spec.rb +67 -55
  374. data/spec/unit/models/model_spec.rb +32 -37
  375. data/spec/unit/models/params_spec.rb +1 -1
  376. data/spec/unit/models/profile_spec.rb +40 -45
  377. data/spec/unit/models/project_creator_spec.rb +27 -29
  378. data/spec/unit/models/project_role_spec.rb +1 -1
  379. data/spec/unit/models/project_spec.rb +65 -2
  380. data/spec/unit/models/report_result_data_spec.rb +7 -12
  381. data/spec/unit/models/schedule_spec.rb +71 -35
  382. data/spec/unit/models/to_manifest_spec.rb +69 -4
  383. data/spec/unit/models/unit_project_spec.rb +12 -12
  384. data/spec/unit/models/user_filters_spec.rb +40 -40
  385. data/spec/unit/models/variable_spec.rb +108 -93
  386. data/spec/unit/rest/polling_spec.rb +7 -7
  387. data/spec/unit/rest/resource_spec.rb +2 -2
  388. metadata +145 -228
  389. data/spec/environment/release.rb +0 -21
  390. data/spec/environment/staging_3.rb +0 -36
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -8,8 +8,8 @@ require 'gooddata/bricks/brick'
8
8
  require 'gooddata/bricks/bricks'
9
9
  require 'gooddata/bricks/middleware/restforce_middleware'
10
10
 
11
- describe GoodData::Bricks::RestForceMiddleware do
11
+ describe GoodData::Bricks::RestForceMiddleware do
12
12
  it "Has GoodData::Bricks::RestForceMiddleware class" do
13
- GoodData::Bricks::RestForceMiddleware.should_not == nil
13
+ GoodData::Bricks::RestForceMiddleware.should_not be(nil)
14
14
  end
15
15
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -8,8 +8,8 @@ require 'gooddata/bricks/brick'
8
8
  require 'gooddata/bricks/bricks'
9
9
  require 'gooddata/bricks/middleware/stdout_middleware'
10
10
 
11
- describe GoodData::Bricks::STDOUTLoggingMiddleware do
11
+ describe GoodData::Bricks::STDOUTLoggingMiddleware do
12
12
  it "Has GoodData::Bricks::STDOUTLoggingMiddleware class" do
13
- GoodData::Bricks::STDOUTLoggingMiddleware.should_not == nil
13
+ GoodData::Bricks::STDOUTLoggingMiddleware.should_not be(nil)
14
14
  end
15
15
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -8,8 +8,8 @@ require 'gooddata/bricks/brick'
8
8
  require 'gooddata/bricks/bricks'
9
9
  require 'gooddata/bricks/middleware/twitter_middleware'
10
10
 
11
- describe GoodData::Bricks::TwitterMiddleware do
11
+ describe GoodData::Bricks::TwitterMiddleware do
12
12
  it "Has GoodData::Bricks::TwitterMiddleware class" do
13
- GoodData::Bricks::TwitterMiddleware.should_not == nil
13
+ GoodData::Bricks::TwitterMiddleware.should_not be(nil)
14
14
  end
15
15
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -8,10 +8,10 @@ require 'gooddata/cli/cli'
8
8
 
9
9
  describe GoodData::CLI do
10
10
  it 'Has GoodData::CLI class' do
11
- GoodData::CLI.should_not == nil
11
+ expect(GoodData::CLI).not_to be_nil
12
12
  end
13
13
 
14
14
  it 'Has GoodData::CLI::main() working' do
15
15
  run_cli
16
16
  end
17
- end
17
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -14,4 +14,4 @@ describe 'GoodData::CLI - auth', :broken => true do
14
14
  run_cli(args)
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -16,7 +16,7 @@ describe GoodData::Command::Project do
16
16
  end
17
17
 
18
18
  it "Is Possible to create GoodData::Command::Project instance" do
19
- cmd = GoodData::Command::Project.new()
19
+ cmd = GoodData::Command::Project.new
20
20
  cmd.should be_a(GoodData::Command::Project)
21
21
  end
22
- end
22
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -45,7 +45,7 @@ describe GoodData::Rest::Connection do
45
45
 
46
46
  # generate a request id, and pass it to a request
47
47
  id = c.generate_request_id
48
- resp = c.get('/gdc/md', :request_id => id)
48
+ c.get('/gdc/md', :request_id => id)
49
49
 
50
50
  id.should be_a(String)
51
51
  id.should_not be_empty
@@ -53,5 +53,4 @@ describe GoodData::Rest::Connection do
53
53
  c.disconnect
54
54
  end
55
55
  end
56
-
57
- end
56
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -36,8 +36,6 @@ class TestLogger < Logger
36
36
  end
37
37
  end
38
38
 
39
-
40
-
41
39
  describe 'GoodData - logging' do
42
40
  TEST_MESSAGE = 'Hello World!'
43
41
 
@@ -102,7 +100,6 @@ describe 'GoodData - logging' do
102
100
  end
103
101
  end
104
102
 
105
-
106
103
  describe '#logging_on' do
107
104
  it 'Enables logging' do
108
105
  GoodData.logging_on
@@ -130,4 +127,4 @@ describe 'GoodData - logging' do
130
127
  test_warn
131
128
  end
132
129
  end
133
- end
130
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -10,4 +10,4 @@ describe GoodData::NilLogger do
10
10
  it "Has GoodData::NilLogger class" do
11
11
  GoodData::NilLogger.should_not be(nil)
12
12
  end
13
- end
13
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -38,10 +38,10 @@ describe 'GoodData - project' do
38
38
  describe '#project' do
39
39
  it 'Returns project assigned' do
40
40
  GoodData.project = nil
41
- GoodData.project.should == nil
41
+ expect(GoodData.project).to be_nil
42
42
 
43
43
  GoodData.use ProjectHelper::PROJECT_ID, client: @client
44
- GoodData.project.should_not == nil
44
+ expect(GoodData.project).not_to be_nil
45
45
  end
46
46
  end
47
47
 
@@ -51,4 +51,4 @@ describe 'GoodData - project' do
51
51
  end
52
52
  end
53
53
  end
54
- end
54
+ end
@@ -1,11 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
7
  describe Hash do
8
-
9
8
  describe '#deep_dup' do
10
9
  it 'should crete a deep copy' do
11
10
  x = {
@@ -16,8 +15,8 @@ describe Hash do
16
15
  y = x.dup
17
16
  deep_y = GoodData::Helpers.deep_dup(x)
18
17
 
19
- y[:a].object_id.should === x[:a].object_id
20
- deep_y[:a].object_id.should_not === x[:a].object_id
18
+ expect(y[:a].object_id).to be == x[:a].object_id
19
+ expect(deep_y[:a].object_id).not_to be == x[:a].object_id
21
20
  end
22
21
  end
23
22
  end
@@ -1,13 +1,12 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
7
  require 'gooddata'
8
8
 
9
9
  describe GoodData::SmallGoodZilla do
10
-
11
10
  MAQL_EXAMPLE = 'SELECT SUM(#"Amount") WHERE @"Date"=#"X" AND ?"Snapshot EOP"=1'
12
11
  FACTS = {
13
12
  "Amount" => "a",
@@ -22,42 +21,40 @@ describe GoodData::SmallGoodZilla do
22
21
  DICT = {
23
22
  :facts => FACTS,
24
23
  :attributes => ATTRIBUTES,
25
- :metrics => METRICS,
24
+ :metrics => METRICS
26
25
  }
27
-
26
+
28
27
  it "should parse metrics out of the string" do
29
- x = GoodData::SmallGoodZilla.get_facts(MAQL_EXAMPLE)
30
- x.should == ["Amount", "X"]
28
+ expect(GoodData::SmallGoodZilla.get_facts(MAQL_EXAMPLE)).to eq %w(Amount X)
31
29
  end
32
30
 
33
31
  it "should parse attributes out of the string" do
34
- x = GoodData::SmallGoodZilla.get_attributes(MAQL_EXAMPLE)
35
- x.should == ["Date"]
32
+ expect(GoodData::SmallGoodZilla.get_attributes(MAQL_EXAMPLE)).to eq %w(Date)
36
33
  end
37
34
 
38
35
  it "should parse metrics out of the string" do
39
- x = GoodData::SmallGoodZilla.get_metrics(MAQL_EXAMPLE)
40
- x.should == ["Snapshot EOP"]
36
+ expect(GoodData::SmallGoodZilla.get_metrics(MAQL_EXAMPLE)).to eq ["Snapshot EOP"]
41
37
  end
42
38
 
43
39
  it "should interpolate the values" do
44
-
45
- interpolated = GoodData::SmallGoodZilla.interpolate({
46
- :facts => ["Amount", "X"],
47
- :attributes => ["Date"],
48
- :metrics => ["Snapshot EOP"]
49
- }, DICT)
50
-
51
- interpolated.should == {
52
- :facts => [["Amount", "a"], ["X", "x"]],
53
- :attributes => [["Date", "d"]],
40
+ interpolated = GoodData::SmallGoodZilla.interpolate(
41
+ {
42
+ :facts => %w(Amount X),
43
+ :attributes => ["Date"],
44
+ :metrics => ["Snapshot EOP"]
45
+ },
46
+ DICT
47
+ )
48
+
49
+ expect(interpolated).to eq(
50
+ :facts => [%w(Amount a), %w(X x)],
51
+ :attributes => [%w(Date d)],
54
52
  :metrics => [["Snapshot EOP", "snap"]]
55
- }
53
+ )
56
54
  end
57
55
 
58
56
  it "should return interpolated metric" do
59
- interpolated = GoodData::SmallGoodZilla.interpolate_metric(MAQL_EXAMPLE, DICT)
60
- interpolated.should == "SELECT SUM([a]) WHERE [d]=[x] AND [snap]=1"
57
+ expect(GoodData::SmallGoodZilla.interpolate_metric(MAQL_EXAMPLE, DICT)).to eq "SELECT SUM([a]) WHERE [d]=[x] AND [snap]=1"
61
58
  end
62
59
 
63
60
  it "should be able to parse several ids correctly." do
@@ -67,12 +64,11 @@ describe GoodData::SmallGoodZilla do
67
64
  WHEN ![attr.customer_profiles.profile_id] = [/gdc/md/pxa3aic06undadkc5s7t5lxpne11vgyt/obj/257/elements?id=50] THEN ![fact.perfomance_by_campaign_id.general_score_5]
68
65
  WHEN ![attr.customer_profiles.profile_id] = [/gdc/md/pxa3aic06undadkc5s7t5lxpne11vgyt/obj/257/elements?id=20] THEN ![fact.perfomance_by_campaign_id.general_score_12]
69
66
  END)"
70
- GoodData::SmallGoodZilla.get_ids(metric).should == [
67
+ expect(GoodData::SmallGoodZilla.get_ids(metric)).to eq [
71
68
  "attr.customer_profiles.profile_id",
72
69
  "fact.perfomance_by_campaign_id.general_score_1",
73
70
  "fact.perfomance_by_campaign_id.general_score_5",
74
71
  "fact.perfomance_by_campaign_id.general_score_12"
75
72
  ]
76
73
  end
77
-
78
- end
74
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -9,7 +9,7 @@ require 'gooddata/helpers/csv_helper'
9
9
  describe GoodData::Helpers::Csv do
10
10
  describe '#read' do
11
11
  it 'Reads data from CSV file' do
12
- data = GoodData::Helpers::Csv.read(:path => CsvHelper::CSV_PATH_IMPORT)
12
+ GoodData::Helpers::Csv.read(:path => CsvHelper::CSV_PATH_IMPORT)
13
13
  end
14
14
  end
15
15
 
@@ -19,4 +19,4 @@ describe GoodData::Helpers::Csv do
19
19
  GoodData::Helpers::Csv.write(:path => CsvHelper::CSV_PATH_EXPORT, :data => data)
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -18,11 +18,7 @@ describe GoodData::Helpers::DataSource do
18
18
  allow(@bucket).to receive(:objects) { @objects }
19
19
  allow(@objects).to receive(:[]) { StringIO.new('aaa') }
20
20
 
21
- @ds = GoodData::Helpers::DataSource.new({
22
- type: :s3,
23
- bucket: 'some_bucket',
24
- key: 'some_key'
25
- })
21
+ @ds = GoodData::Helpers::DataSource.new(type: :s3, bucket: 'some_bucket', key: 'some_key')
26
22
  end
27
23
 
28
24
  it 'should be able to handle AWS' do
@@ -34,17 +30,12 @@ describe GoodData::Helpers::DataSource do
34
30
 
35
31
  it 'should gracefully handle missing aws client' do
36
32
  expect do
37
- @ds.realize({
38
- 'aws_client' => nil
39
- })
33
+ @ds.realize('aws_client' => nil)
40
34
  end.to raise_exception "AWS client not present. Perhaps S3Middleware is missing in the brick definition?"
41
35
  end
42
36
 
43
37
  it 'should gracefully handle missing data source params - bucket' do
44
- ds = GoodData::Helpers::DataSource.new({
45
- type: :s3,
46
- key: 'some_key'
47
- })
38
+ ds = GoodData::Helpers::DataSource.new(type: :s3, key: 'some_key')
48
39
  params = { 'aws_client' => { 's3_client' => @s3_client } }
49
40
  expect do
50
41
  ds.realize(params)
@@ -52,13 +43,10 @@ describe GoodData::Helpers::DataSource do
52
43
  end
53
44
 
54
45
  it 'should gracefully handle missing data source params - key' do
55
- ds = GoodData::Helpers::DataSource.new({
56
- type: :s3,
57
- bucket: 'some_bucket'
58
- })
46
+ ds = GoodData::Helpers::DataSource.new(type: :s3, bucket: 'some_bucket')
59
47
  params = { 'aws_client' => { 's3_client' => @s3_client } }
60
48
  expect do
61
49
  ds.realize(params)
62
50
  end.to raise_exception 'Key "key" is missing in S3 datasource'
63
51
  end
64
- end
52
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #
3
- # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
@@ -8,9 +8,7 @@ require 'gooddata/helpers/csv_helper'
8
8
 
9
9
  describe GoodData::Helpers do
10
10
  describe '#diff' do
11
-
12
11
  before :each do
13
-
14
12
  @old_tomas = { id: 1, name: 'Tomas', age: 28 }
15
13
  @new_tomas = { id: 1, name: "Lil'Tomas", age: 28 }
16
14
  @patrick = { id: 4, name: 'Patrick', age: 24 }
@@ -32,8 +30,8 @@ describe GoodData::Helpers do
32
30
  expect(diff[:changed]).to eq([
33
31
  {
34
32
  old_obj: @old_tomas,
35
- new_obj: @new_tomas,
36
- diff: { name: "Lil'Tomas"}
33
+ new_obj: @new_tomas,
34
+ diff: { name: "Lil'Tomas" }
37
35
  },
38
36
  {
39
37
  old_obj: @old_korczis,
@@ -59,38 +57,27 @@ describe GoodData::Helpers do
59
57
  end
60
58
 
61
59
  it 'should encode params and preserve the nil in hidden' do
62
- x = GoodData::Helpers.decode_params({ "x" => "y", GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => '{"a":{"b": "c"}}'})
63
- expect(x).to eq({"x"=>"y", "a"=>{"b"=>"c"}, "gd_encoded_hidden_params"=>nil})
60
+ x = GoodData::Helpers.decode_params("x" => "y", GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => '{"a":{"b": "c"}}')
61
+ expect(x).to eq("x" => "y", "a" => { "b" => "c" }, "gd_encoded_hidden_params" => nil)
64
62
  end
65
63
 
66
64
  it 'should encode params and preserve the nil in hidden' do
67
- x = GoodData::Helpers.decode_params({GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => nil})
68
- expect(x).to eq({"gd_encoded_hidden_params" =>nil})
65
+ x = GoodData::Helpers.decode_params(GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => nil)
66
+ expect(x).to eq("gd_encoded_hidden_params" => nil)
69
67
  end
70
68
 
71
69
  it 'should encode params and preserve the nil in hidden' do
72
- x = GoodData::Helpers.decode_params({
70
+ x = GoodData::Helpers.decode_params(
73
71
  "x" => "y",
74
72
  GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b": "c"}}',
75
73
  GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => '{"a":{"b": "c"}}'
76
- })
77
- expect(x).to eq({
78
- "x"=>"y",
79
- "a"=>{"b"=>"c"},
80
- "d" => {"b" => "c"},
81
- "gd_encoded_hidden_params"=>nil
82
- })
74
+ )
75
+ expect(x).to eq("x" => "y", "a" => { "b" => "c" }, "d" => { "b" => "c" }, "gd_encoded_hidden_params" => nil)
83
76
  end
84
77
 
85
78
  it 'should encode params and note preserve the nil in public' do
86
- x = GoodData::Helpers.decode_params({
87
- "x" => "y",
88
- GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b": "c"}}'
89
- })
90
- expect(x).to eq({
91
- "x"=>"y",
92
- "d" => {"b" => "c"}
93
- })
79
+ x = GoodData::Helpers.decode_params("x" => "y", GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b": "c"}}')
80
+ expect(x).to eq("x" => "y", "d" => { "b" => "c" })
94
81
  end
95
82
 
96
83
  it 'should be abe to join datasets' do
@@ -102,10 +89,107 @@ describe GoodData::Helpers do
102
89
  { id: 2, y: 'BAR' }]
103
90
 
104
91
  results = GoodData::Helpers.join(master, lookup, [:x], [:id])
105
- expect(results).to eq [{:id=>"a", :y=>"FOO", :x=>1},
106
- {:id=>"b", :y=>"FOO", :x=>1},
107
- {:id=>"c", :y=>"BAR", :x=>2}]
92
+ expect(results).to eq [{ :id => "a", :y => "FOO", :x => 1 },
93
+ { :id => "b", :y => "FOO", :x => 1 },
94
+ { :id => "c", :y => "BAR", :x => 2 }]
95
+ end
96
+
97
+ it 'should encode secure params' do
98
+ x = GoodData::Helpers.decode_params(
99
+ "x" => "y",
100
+ "d|b|foo" => "bar",
101
+ "d|b|e|w" => "z",
102
+ GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b":{"c": "a"}}}',
103
+ GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => '{"d":{"b":{"e":{"f": "g"}}}}'
104
+ )
105
+ expect(x).to eq(
106
+ "x" => "y",
107
+ "d" => { "b" => { "c" => "a", "e" => { "f" => "g", "w" => "z" }, "foo" => "bar" } },
108
+ "gd_encoded_hidden_params" => nil
109
+ )
110
+ end
111
+
112
+ it 'should encode reference parameters in gd_encoded_params' do
113
+ params = {
114
+ 'x' => 'y',
115
+ 'ads_password' => 'ads_123',
116
+ 'my_password' => 'login_123',
117
+ 'gd_encoded_params' => '{"login_username": "login_user", "login_password": "abc_${my_password}_123"}'
118
+ }
119
+ expected_result = {
120
+ 'x' => 'y',
121
+ 'ads_password' => 'ads_123',
122
+ 'my_password' => 'login_123',
123
+ 'login_username' => 'login_user',
124
+ 'login_password' => 'abc_login_123_123'
125
+ }
126
+ result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
127
+ expect(result).to eq(expected_result)
108
128
  end
109
129
 
130
+ it 'should encode escape reference parameters in gd_encoded_params' do
131
+ params = {
132
+ 'x' => 'y',
133
+ 'ads_password' => 'ads_123',
134
+ 'my_password' => 'login_123',
135
+ 'gd_encoded_params' => '{"login_username": "login_user", "data01": "\\${abc}"}'
136
+ }
137
+ expected_result = {
138
+ 'x' => 'y',
139
+ 'ads_password' => 'ads_123',
140
+ 'my_password' => 'login_123',
141
+ 'login_username' => 'login_user',
142
+ 'data01' => '${abc}'
143
+ }
144
+ result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
145
+ expect(result).to eq(expected_result)
146
+ end
147
+
148
+ it 'should encode reference parameters in nested block in gd_encoded_params' do
149
+ params = {
150
+ 'x' => 'y',
151
+ 'ads_password' => 'ads_123',
152
+ 'my_password' => 'login_123',
153
+ 'gd_encoded_params' => '{"login_username": "login_user", "ads_client": {"username": "ads_user", "password": "${ads_password}"}}'
154
+ }
155
+ expected_result = {
156
+ 'x' => 'y',
157
+ 'ads_password' => 'ads_123',
158
+ 'my_password' => 'login_123',
159
+ 'login_username' => 'login_user',
160
+ 'ads_client' => {
161
+ 'username' => 'ads_user',
162
+ 'password' => 'ads_123'
163
+ }
164
+ }
165
+ result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
166
+ expect(result).to eq(expected_result)
167
+ end
168
+ end
169
+
170
+ describe '.interpolate_error_message' do
171
+ let(:error_message) { { 'error' => { 'message' => 'foo %s', 'parameters' => ['bar'] } } }
172
+
173
+ before do
174
+ @message = GoodData::Helpers.interpolate_error_message(error_message)
175
+ end
176
+
177
+ it 'interpolates parameters' do
178
+ expect(@message).to eq('foo bar')
179
+ end
180
+
181
+ context 'when error parameter is empty' do
182
+ let(:error_message) { {} }
183
+ it 'returns nil' do
184
+ expect(@message).to be_nil
185
+ end
186
+ end
187
+
188
+ context 'when error key is empty' do
189
+ let(:error_message) { { 'error' => {} } }
190
+ it 'returns nil' do
191
+ expect(@message).to be_nil
192
+ end
193
+ end
110
194
  end
111
195
  end