Class: TridentAssistant::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/trident_assistant/client.rb

Overview

HTTP client to trident server

Defined Under Namespace

Classes: HttpError, RequestError

Constant Summary collapse

ENDPOINT =
"https://thetrident.one"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Client

Returns a new instance of Client.



13
14
15
# File 'lib/trident_assistant/client.rb', line 13

def initialize(**kwargs)
  @endpoint = URI(kwargs[:endpoint] || ENDPOINT)
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



11
12
13
# File 'lib/trident_assistant/client.rb', line 11

def endpoint
  @endpoint
end

Instance Method Details

#get(path, **options) ⇒ Object



17
18
19
# File 'lib/trident_assistant/client.rb', line 17

def get(path, **options)
  request(:get, path, **options)
end

#post(path, **options) ⇒ Object



21
22
23
# File 'lib/trident_assistant/client.rb', line 21

def post(path, **options)
  request(:post, path, **options)
end

#put(path, **options) ⇒ Object



25
26
27
# File 'lib/trident_assistant/client.rb', line 25

def put(path, **options)
  request(:put, path, **options)
end