Class: Shiro::Client
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path) ⇒ Object
-
#initialize(api_key = ENV["SHIRO_API_KEY"]) ⇒ Client
constructor
A new instance of Client.
- #patch(path, body = {}) ⇒ Object
- #post(path, body = {}) ⇒ Object
Constructor Details
#initialize(api_key = ENV["SHIRO_API_KEY"]) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/shiro/client.rb', line 8 def initialize(api_key = ENV["SHIRO_API_KEY"]) raise "API key not defined" unless api_key @api_key = api_key end |
Instance Method Details
#delete(path) ⇒ Object
25 26 27 |
# File 'lib/shiro/client.rb', line 25 def delete(path) self.class.delete(path, headers: auth_header) end |
#get(path) ⇒ Object
13 14 15 |
# File 'lib/shiro/client.rb', line 13 def get(path) self.class.get(path, headers: auth_header) end |
#patch(path, body = {}) ⇒ Object
21 22 23 |
# File 'lib/shiro/client.rb', line 21 def patch(path, body = {}) self.class.patch(path, body: body.to_json, headers: auth_header.merge("Content-Type" => "application/json")) end |
#post(path, body = {}) ⇒ Object
17 18 19 |
# File 'lib/shiro/client.rb', line 17 def post(path, body = {}) self.class.post(path, body: body.to_json, headers: auth_header.merge("Content-Type" => "application/json")) end |