Class: KeyPayAPI::Client
- Inherits:
-
Object
- Object
- KeyPayAPI::Client
- Includes:
- HTTParty, Business, Connection, Employee
- Defined in:
- lib/keypay_api/client.rb,
lib/keypay_api/client/business.rb,
lib/keypay_api/client/employee.rb,
lib/keypay_api/client/connection.rb
Defined Under Namespace
Modules: Business, Connection, Employee
Instance Method Summary collapse
-
#initialize(api_key = nil) ⇒ Client
constructor
A new instance of Client.
Methods included from Business
Methods included from Employee
#create_employee, #get_employee, #get_employee_external_id, #list_employees, #onboard_employee
Methods included from Connection
Constructor Details
#initialize(api_key = nil) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 |
# File 'lib/keypay_api/client.rb', line 17 def initialize(api_key = nil) api_key ||= ENV["KEYPAY_API_KEY"] raise KeyPayAPI::Error('Must pass an API key') if api_key.nil? enc_key = Base64.encode64(api_key + ':').gsub(/\n/,'') self.class..merge!(headers: {'Authorization': "Basic #{enc_key}", 'Content-Type': 'application/json'}) end |