Class: DuoApi::Client
- Inherits:
-
Object
- Object
- DuoApi::Client
- Defined in:
- lib/duo-api/client.rb
Constant Summary collapse
- ATTRIBUTES =
%w[ integration_key secret_key app_secret hostname ]
Instance Method Summary collapse
- #get(path, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(path, options = {}) ⇒ Object
- #sign(user_key) ⇒ Object
- #verify(signed_response) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 21 |
# File 'lib/duo-api/client.rb', line 13 def initialize( = {}) .each do |key, value| if ATTRIBUTES.include?(key.to_s) instance_variable_set("@#{key}", value) else raise ArgumentError, "no attribute #{key}" end end end |
Instance Method Details
#get(path, options = {}) ⇒ Object
23 24 25 |
# File 'lib/duo-api/client.rb', line 23 def get(path, = {}) Request.request(self, path, { :method => "GET" }.merge()) end |
#post(path, options = {}) ⇒ Object
27 28 29 |
# File 'lib/duo-api/client.rb', line 27 def post(path, = {}) Request.request(self, path, { :method => "POST" }.merge()) end |
#sign(user_key) ⇒ Object
31 32 33 |
# File 'lib/duo-api/client.rb', line 31 def sign(user_key) signer.sign(user_key) end |
#verify(signed_response) ⇒ Object
35 36 37 |
# File 'lib/duo-api/client.rb', line 35 def verify(signed_response) signer.verify(signed_response) end |