Class: MemoriClient::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/memori_client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace:, kind:, uri:, api_root:) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
# File 'lib/memori_client/client.rb', line 6

def initialize(namespace:, kind:, uri:, api_root:)
  @namespace = namespace
  @kind = kind
  @uri = uri
  @api_root = api_root
  @version_proxies = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



42
43
44
45
46
47
48
# File 'lib/memori_client/client.rb', line 42

def method_missing(method, *args, &block)
  if @version_proxies.key?(method.to_s)
    @version_proxies[method.to_s]
  else
    super
  end
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



5
6
7
# File 'lib/memori_client/client.rb', line 5

def kind
  @kind
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



4
5
6
# File 'lib/memori_client/client.rb', line 4

def namespace
  @namespace
end

#version_proxiesObject (readonly)

Returns the value of attribute version_proxies.



3
4
5
# File 'lib/memori_client/client.rb', line 3

def version_proxies
  @version_proxies
end

Instance Method Details

#load_swagger_specObject



14
15
16
17
18
19
20
21
# File 'lib/memori_client/client.rb', line 14

def load_swagger_spec
  if @swagger.nil?
    @swagger = MemoriClient::Swagger::ProcessSpecification.new(uri: @uri, kind: @kind).call
    @swagger.each do |key, list|
      register_resource(key, list)
    end
  end
end