Class: RestClient::Resource

Inherits:
Object
  • Object
show all
Extended by:
Conjur::BuildFromResponse
Includes:
Conjur::Cast, Conjur::Escape, Conjur::LogSource
Defined in:
lib/conjur/api.rb

Instance Method Summary collapse

Methods included from Conjur::BuildFromResponse

build_from_response

Methods included from Conjur::LogSource

#log

Methods included from Conjur::Escape

#fully_escape, included, #path_escape, #query_escape

Instance Method Details

#conjur_apiObject



59
60
61
# File 'lib/conjur/api.rb', line 59

def conjur_api
  Conjur::API.new_from_token token
end

#core_conjur_accountObject



51
52
53
# File 'lib/conjur/api.rb', line 51

def 
  Conjur::Core::API.
end

#to_json(options = {}) ⇒ Object



55
56
57
# File 'lib/conjur/api.rb', line 55

def to_json(options = {})
  {}
end

#tokenObject



63
64
65
66
67
68
69
70
# File 'lib/conjur/api.rb', line 63

def token
  authorization = options[:headers][:authorization]
  if authorization && authorization.to_s[/^Token token="(.*)"/]
    JSON.parse(Base64.decode64($1))
  else
    raise AuthorizationError.new("Authorization missing")
  end
end

#usernameObject



72
73
74
# File 'lib/conjur/api.rb', line 72

def username
  options[:user] || options[:username]
end