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 = {}) ⇒ Client
Returns a new instance of Client.
11
12
13
14
15
16
|
# File 'lib/minds/client.rb', line 11
def initialize(options = {})
CONFIG_KEYS.each do |key|
instance_variable_set "@#{key}", options[key] || Client.config.send(key)
end
end
|
Class Method Details
.config ⇒ Object
19
20
21
|
# File 'lib/minds/client.rb', line 19
def config
@config ||= Config::Base.new
end
|
23
24
25
|
# File 'lib/minds/client.rb', line 23
def configure
yield(config) if block_given?
end
|
Instance Method Details
#datasources ⇒ Object
28
29
30
|
# File 'lib/minds/client.rb', line 28
def datasources
@datasources ||= Datasources.new(client: self)
end
|
#inspect ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/minds/client.rb', line 36
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
32
33
34
|
# File 'lib/minds/client.rb', line 32
def minds
@minds ||= Minds.new(client: self)
end
|