Class: JazzHR::Client
- Inherits:
-
Object
- Object
- JazzHR::Client
- Defined in:
- lib/jazz_hr/client.rb
Constant Summary collapse
- BASE_URI =
"https://api.resumatorapi.com/v1".freeze
Instance Method Summary collapse
- #get(path:) ⇒ Object
-
#initialize(api_key:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key:) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/jazz_hr/client.rb', line 8 def initialize(api_key:) @api_key = api_key end |
Instance Method Details
#get(path:) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/jazz_hr/client.rb', line 12 def get(path:) json_string = Net::HTTP.get(uri_for(path: path)) response = JSON.parse(json_string) raise Error.new(response["error"]) if response.is_a?(Hash) && response["error"] response end |