lib/gooddata/models/segment.rb in gooddata-0.6.49 vs lib/gooddata/models/segment.rb in gooddata-0.6.50
- old
+ new
@@ -1,8 +1,8 @@
# 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_relative './client'
require_relative './domain'
@@ -71,11 +71,11 @@
# @return [GoodData::Segment] New Segment instance
def create(data = {}, options = {})
segment_id = data[:segment_id]
fail 'Custom ID has to be provided' if segment_id.blank?
client = options[:client]
- segment = client.create(GoodData::Segment, GoodData::Helpers.deep_stringify_keys(SEGMENT_TEMPLATE).merge('domain' => options[:domain]))
+ segment = client.create(GoodData::Segment, GoodData::Helpers.stringify_keys(SEGMENT_TEMPLATE).merge('domain' => options[:domain]))
segment.tap do |s|
s.segment_id = segment_id
s.master_project = data[:master_project]
end
end
@@ -139,10 +139,10 @@
end
alias_method :master, :master_project
def create_client(data)
- client = GoodData::Client.create(data, segment: self)
+ client = GoodData::Client.create(data, client: self.client, segment: self)
client.save
end
# Returns all the clients associated with the segment. Since this is potentially paging operation it returns an Enumerable.
#