Method: PropelAuth::Client.fetch_org

Defined in:
lib/propelauth/client.rb

.fetch_org(org_id) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/propelauth/client.rb', line 31

def fetch_org(org_id)
  response = connection.get("/api/backend/v1/org/#{org_id}", {}, { "Authorization" => "Bearer #{api_key}" })
  if response.status == 200
    response.body
  elsif response.status == 404
    nil
  elsif response.status == 401
    raise PropelAuth::InvalidApiKey.new
  elsif response.status == 426
    raise PropelAuth::B2BSupportDisabled.new
  else
    raise PropelAuth::UnexpectedError.new
  end
end