Class: Zype::LoginClient

Inherits:
Client
  • Object
show all
Defined in:
lib/zype/client/login_client.rb

Constant Summary

Constants inherited from Client

Client::ERROR_TYPES

Instance Attribute Summary

Attributes inherited from Client

#headers

Instance Method Summary collapse

Methods inherited from Client

#delete, #get, #post, #put

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.
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