Class: FabricCA::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/fabric_ca/client.rb

Instance Method Summary collapse

Methods included from Request

#delete, #get, #post, #put

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
14
# File 'lib/fabric_ca/client.rb', line 8

def initialize(options = {})
  options = FabricCA.options.merge(options)

  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#configObject



16
17
18
19
20
21
22
23
# File 'lib/fabric_ca/client.rb', line 16

def config
  conf = {}
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    conf[key] = send key
  end

  conf
end

#enroll(certificate_request, attrs = nil) ⇒ Object



25
26
27
28
29
# File 'lib/fabric_ca/client.rb', line 25

def enroll(certificate_request, attrs = nil)
  post 'enroll', certificate_request: certificate_request.to_s,
                 caName: ca_name,
                 attr_reqs: attrs
end

#list_affiliations(opts = {}) ⇒ Object



39
40
41
# File 'lib/fabric_ca/client.rb', line 39

def list_affiliations(opts = {})
  get 'affiliations', opts
end

#list_identities(opts = {}) ⇒ Object



35
36
37
# File 'lib/fabric_ca/client.rb', line 35

def list_identities(opts = {})
  get 'identities', opts
end

#register(params = {}) ⇒ Object



31
32
33
# File 'lib/fabric_ca/client.rb', line 31

def register(params = {})
  post 'register', params
end