Class: Keboola::GoodDataWriter::Client

Inherits:
Hurley::Client
  • Object
show all
Defined in:
lib/keboola/gooddata_writer/client.rb

Class Method Summary collapse

Class Method Details

.factory(endpoint: nil, token: nil) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/keboola/gooddata_writer/client.rb', line 7

def self.factory(endpoint: nil, token: nil)
  endpoint || raise(ArgumentError, "endpoint is required")
  token || raise(ArgumentError, "token is required")

  client = new(endpoint)
  client.header[:x_storageapi_token] = token
  client.header[:accept] = "application/json"
  client.request_options.redirection_limit = 5
  client.request_options.timeout = 5
  client
end