lib/gooddata/models/process.rb in gooddata-0.6.49 vs lib/gooddata/models/process.rb in gooddata-0.6.50

- old
+ new

@@ -1,12 +1,11 @@ # encoding: UTF-8 # -# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved. +# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -require 'pry' require 'zip' require 'uri' require_relative '../helpers/global_helpers' require_relative '../rest/resource' @@ -25,11 +24,11 @@ alias_method :to_hash, :data class << self def [](id, options = {}) project = options[:project] - c = client(options) + c = options[:client] || (project && project.client) if id == :all && project uri = "/gdc/projects/#{project.pid}/dataload/processes" data = c.get(uri) data['processes']['items'].map do |process_data| @@ -352,8 +351,16 @@ :execution => { :graph => executable.to_s, :params => GoodData::Helpers.encode_public_params(params), :hiddenParams => GoodData::Helpers.encode_hidden_params(hidden_params) }) + end + + def notification_rules + NotificationRule.all(project: project, process: self, client: client) + end + + def create_notification_rule(opts = {}) + NotificationRule.create(opts.merge(project: project, process: self, client: client)) end end end