Class: MagicWrite::Client
- Inherits:
-
Object
- Object
- MagicWrite::Client
show all
- Includes:
- HTTP
- Defined in:
- lib/magicwrite/client.rb
Constant Summary
collapse
- CONFIG_KEYS =
%i[
access_token
uri_base
request_timeout
extra_headers
].freeze
Instance Method Summary
collapse
Methods included from HTTP
#delete, #get, #json_post, #json_put, #multipart_post
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
13
14
15
16
17
|
# File 'lib/magicwrite/client.rb', line 13
def initialize(config = {})
CONFIG_KEYS.each do |key|
instance_variable_set("@#{key}", config[key] || MagicWrite.configuration.send(key))
end
end
|
Instance Method Details
#agents ⇒ Object
19
20
21
|
# File 'lib/magicwrite/client.rb', line 19
def agents
@agents ||= MagicWrite::Agents.new(client: self)
end
|
#companies ⇒ Object
23
24
25
|
# File 'lib/magicwrite/client.rb', line 23
def companies
@companies ||= MagicWrite::Companies.new(client: self)
end
|
#completions ⇒ Object
27
28
29
|
# File 'lib/magicwrite/client.rb', line 27
def completions
@completions ||= MagicWrite::Completions.new(client: self)
end
|
#ingestions ⇒ Object
31
32
33
|
# File 'lib/magicwrite/client.rb', line 31
def ingestions
@ingestions ||= MagicWrite::Ingestions.new(client: self)
end
|
#memberships ⇒ Object
35
36
37
|
# File 'lib/magicwrite/client.rb', line 35
def memberships
@memberships ||= MagicWrite::Memberships.new(client: self)
end
|
#session ⇒ Object
39
40
41
|
# File 'lib/magicwrite/client.rb', line 39
def session
get(path: '/session')
end
|