lib/gooddata/models/profile.rb in gooddata-0.6.15 vs lib/gooddata/models/profile.rb in gooddata-0.6.16

- old
+ new

@@ -71,18 +71,23 @@ # Creates new instance from hash with attributes # # @param attributes [Hash] Hash with initial attributes # @return [GoodData::Profile] New profile instance def create(attributes) - json = EMPTY_OBJECT.dup + res = create_object(attributes) + res.save! + res + end + + def create_object(attributes) + json = EMPTY_OBJECT.deep_dup + json['accountSetting']['links']['self'] = attributes[:uri] if attributes[:uri] res = client.create(GoodData::Profile, json) attributes.each do |k, v| res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k end - - res.save! res end def diff(item_1, item_2) x = diff_list([item_1], [item_2]) @@ -345,10 +350,9 @@ # Gets the resource REST URI # # @return [String] Resource URI def uri GoodData::Helpers.get_path(@json, %w(accountSetting links self)) - # @json['accountSetting']['links']['self'] end def data data = @json || {} data['accountSetting'] || {}