class Trusona::Api::HTTPClient
An a wrapper around HTTParty
Constants
- CONTENT_TYPE
- DELETE
- GET
- PATCH
- POST
Public Class Methods
new(host = nil)
click to toggle source
# File lib/trusona/api/client.rb, line 15 def initialize(host = nil) @host = host || Trusona.config.api_host end
Public Instance Methods
delete(path, params = {})
click to toggle source
# File lib/trusona/api/client.rb, line 31 def delete(path, params = {}) execute(path, params, DELETE) end
get(path, params = {})
click to toggle source
# File lib/trusona/api/client.rb, line 27 def get(path, params = {}) execute(path, params, GET) end
patch(path, params = {})
click to toggle source
# File lib/trusona/api/client.rb, line 23 def patch(path, params = {}) execute(path, params, PATCH) end
post(path, params = {})
click to toggle source
# File lib/trusona/api/client.rb, line 19 def post(path, params = {}) execute(path, params, POST) end
Private Instance Methods
execute(path, params, method)
click to toggle source
# File lib/trusona/api/client.rb, line 37 def execute(path, params, method) request = Trusona::Api::SignedRequest.new(path, params, method, @host) # Power of ruby or hard to read? unverified = HTTParty.send( method.downcase, request.uri, body: request.body, headers: request.headers ) Trusona::Api::VerifiedResponse.new(unverified) end