Sha256: 3c23be0bb958380a6ea087ff0bd8f1c7946b53f9f417e0a233bece4a8d48078e

Contents?: true

Size: 1.74 KB

Versions: 58

Compression:

Stored size: 1.74 KB

Contents

# encoding: UTF-8
#
# 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 '../mixins/data_property_reader'
require_relative '../mixins/data_property_writer'

require_relative '../mixins/content_getter'

require_relative '../mixins/meta_getter'

require_relative '../mixins/meta_property_reader'
require_relative '../mixins/meta_property_writer'

require_relative '../mixins/root_key_getter'

require 'active_support/core_ext/object/blank'

module GoodData
  module Rest
    # Base class dealing with REST endpoints
    #
    # MUST Be interface for objects dealing with REST endpoints
    # MUST provide way to work with remote REST-like API in unified manner.
    # MUST NOT create new connections.
    class Object
      extend Mixin::DataPropertyReader
      extend Mixin::DataPropertyWriter

      extend Mixin::MetaPropertyReader
      extend Mixin::MetaPropertyWriter

      include Mixin::ContentGetter
      include Mixin::RootKeyGetter
      include Mixin::DataGetter
      include Mixin::MetaGetter

      attr_accessor :json
      alias_method :raw_data, :json
      alias_method :to_hash, :json

      alias_method :to_json, :json

      attr_writer :client
      attr_accessor :project

      def initialize(_opts = {})
        @client = nil
      end

      def client(opts = {})
        @client || GoodData::Rest::Object.client(opts)
      end

      def saved?
        !uri.blank?
      end

      class << self
        def default_client
        end

        def client(opts = { :client => GoodData.connection })
          opts[:client] # || GoodData.client
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
gooddata-2.3.1-java lib/gooddata/rest/object.rb
gooddata-2.3.1 lib/gooddata/rest/object.rb
gooddata-2.3.0-java lib/gooddata/rest/object.rb
gooddata-2.3.0 lib/gooddata/rest/object.rb
gooddata-2.2.0-java lib/gooddata/rest/object.rb
gooddata-2.2.0 lib/gooddata/rest/object.rb
gooddata-2.1.19-java lib/gooddata/rest/object.rb
gooddata-2.1.19 lib/gooddata/rest/object.rb
gooddata-2.1.17-java lib/gooddata/rest/object.rb
gooddata-2.1.17 lib/gooddata/rest/object.rb
gooddata-2.1.15-java lib/gooddata/rest/object.rb
gooddata-2.1.15 lib/gooddata/rest/object.rb
gooddata-2.1.14-java lib/gooddata/rest/object.rb
gooddata-2.1.14 lib/gooddata/rest/object.rb
gooddata-2.1.13-java lib/gooddata/rest/object.rb
gooddata-2.1.13 lib/gooddata/rest/object.rb
gooddata-2.1.12-java lib/gooddata/rest/object.rb
gooddata-2.1.12 lib/gooddata/rest/object.rb
gooddata-2.1.11-java lib/gooddata/rest/object.rb
gooddata-2.1.11 lib/gooddata/rest/object.rb