Class: Zype::LoginClient
- Defined in:
- lib/zype/client/login_client.rb
Constant Summary
Constants inherited from Client
Instance Attribute Summary
Attributes inherited from Client
Instance Method Summary collapse
- #execute(method:, path:, params: {}) ⇒ Object
-
#initialize(_ = '') ⇒ LoginClient
constructor
A new instance of LoginClient.
Methods inherited from Client
Constructor Details
#initialize(_ = '') ⇒ LoginClient
Returns a new instance of LoginClient.
3 4 5 6 |
# File 'lib/zype/client/login_client.rb', line 3 def initialize(_ = '') @headers = { 'Content-Type' => 'application/json' } self.class.base_uri Zype.configuration.login_host end |
Instance Method Details
#execute(method:, path:, params: {}) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/zype/client/login_client.rb', line 8 def execute(method:, path:, params: {}) resp = send(method, path: path, params: params) if resp.success? resp['response'].nil? ? resp.parsed_response : resp['response'] else error!(code: resp.code, message: resp['message']) end end |