Method: GoodData::Rest::Client#initialize

Defined in:
lib/gooddata/rest/client.rb

#initialize(opts) ⇒ Client

Constructor of client

Parameters:

  • opts (Hash)

    Client options

Options Hash (opts):

  • :username (String)

    Username used for authentication

  • :password (String)

    Password used for authentication

  • :connection_factory (Object)

    Object able to create new instances of GoodData::Rest::Connection

  • :connection (GoodData::Rest::Connection)

    Existing GoodData::Rest::Connection



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/gooddata/rest/client.rb', line 153

def initialize(opts)
  # TODO: Decide if we want to pass the options directly or not
  @opts = opts

  @connection_factory = @opts[:connection_factory] || DEFAULT_CONNECTION_IMPLEMENTATION

  # TODO: See previous TODO
  # Create connection
  @connection = opts[:connection] || @connection_factory.new(opts)

  # Connect
  connect

  # Create factory bound to previously created connection
  @factory = ObjectFactory.new(self)
end