Class: HasHelpers::ServiceTrust::Client
- Inherits:
-
Object
- Object
- HasHelpers::ServiceTrust::Client
show all
- Defined in:
- lib/has_helpers/service_trust/client.rb,
lib/has_helpers/service_trust/client/retry.rb,
lib/has_helpers/service_trust/client/response.rb
Defined Under Namespace
Modules: Retry
Classes: Response
Constant Summary
collapse
- HTTP_METHODS =
{
get: Net::HTTP::Get,
post: Net::HTTP::Post,
put: Net::HTTP::Put,
delete: Net::HTTP::Delete
}.freeze
Instance Method Summary
collapse
-
#delete(path, capability: nil, headers: {}, query: nil) ⇒ Object
-
#get(path, capability: nil, headers: {}, query: nil) ⇒ Object
-
#initialize(audience:, base_url:, timeout: 5, retries: 3, retry_on_status: [502, 503, 504]) ⇒ Client
constructor
A new instance of Client.
-
#post(path, body:, capability: nil, headers: {}) ⇒ Object
-
#put(path, body:, capability: nil, headers: {}) ⇒ Object
Constructor Details
#initialize(audience:, base_url:, timeout: 5, retries: 3, retry_on_status: [502, 503, 504]) ⇒ Client
Returns a new instance of Client.
19
20
21
22
23
24
25
|
# File 'lib/has_helpers/service_trust/client.rb', line 19
def initialize(audience:, base_url:, timeout: 5, retries: 3, retry_on_status: [502, 503, 504])
@audience = audience
@base_url = base_url
@timeout = timeout
@retries = retries
@retry_on_status = retry_on_status
end
|
Instance Method Details
#delete(path, capability: nil, headers: {}, query: nil) ⇒ Object
39
40
41
|
# File 'lib/has_helpers/service_trust/client.rb', line 39
def delete(path, capability: nil, headers: {}, query: nil)
call(:delete, path, capability: capability, headers: , query: query)
end
|
#get(path, capability: nil, headers: {}, query: nil) ⇒ Object
27
28
29
|
# File 'lib/has_helpers/service_trust/client.rb', line 27
def get(path, capability: nil, headers: {}, query: nil)
call(:get, path, capability: capability, headers: , query: query)
end
|
#post(path, body:, capability: nil, headers: {}) ⇒ Object
31
32
33
|
# File 'lib/has_helpers/service_trust/client.rb', line 31
def post(path, body:, capability: nil, headers: {})
call(:post, path, capability: capability, headers: , body: body)
end
|
#put(path, body:, capability: nil, headers: {}) ⇒ Object
35
36
37
|
# File 'lib/has_helpers/service_trust/client.rb', line 35
def put(path, body:, capability: nil, headers: {})
call(:put, path, capability: capability, headers: , body: body)
end
|