Class: Minds::Client
Constant Summary
collapse
- SENSITIVE_ATTRIBUTES =
%i[@base_url @api_key].freeze
- CONFIG_KEYS =
%i[base_url api_key log_errors api_version].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from RestClient
#delete, #get, #patch, #post, #put
Constructor Details
#initialize(options = {}, &faraday_middleware) ⇒ Client
Returns a new instance of Client.
11
12
13
14
15
16
17
18
|
# File 'lib/minds/client.rb', line 11
def initialize(options = {}, &faraday_middleware)
CONFIG_KEYS.each do |key|
instance_variable_set "@#{key}", options[key] || Client.config.send(key)
end
@faraday_middleware = faraday_middleware
end
|
Class Method Details
.config ⇒ Object
21
22
23
|
# File 'lib/minds/client.rb', line 21
def config
@config ||= Config::Base.new
end
|
25
26
27
|
# File 'lib/minds/client.rb', line 25
def configure
yield(config) if block_given?
end
|
Instance Method Details
#datasources ⇒ Object
30
31
32
|
# File 'lib/minds/client.rb', line 30
def datasources
@datasources ||= Datasources.new(client: self)
end
|
#inspect ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/minds/client.rb', line 38
def inspect
vars = instance_variables.map do |var|
value = instance_variable_get(var)
SENSITIVE_ATTRIBUTES.include?(var) ? "#{var}=[FILTERED]" : "#{var}=#{value.inspect}"
end
"#<#{self.class}:0x#{object_id.to_s(16)} #{vars.join(', ')}>"
end
|
#minds ⇒ Object
34
35
36
|
# File 'lib/minds/client.rb', line 34
def minds
@minds ||= Minds.new(client: self)
end
|