Class: Shiro::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/shiro/client.rb

Instance Method Summary collapse

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