memori-client 0.1.9 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/backend_overrides.jsonc +4 -0
  3. data/engine_overrides.jsonc +3 -0
  4. data/lib/memori_client/client.rb +49 -0
  5. data/lib/memori_client/client_factory.rb +105 -0
  6. data/lib/memori_client/engine/hmac_helper.rb +1 -1
  7. data/lib/memori_client/http_client.rb +4 -17
  8. data/lib/memori_client/operation.rb +132 -0
  9. data/lib/memori_client/proxy/client.rb +115 -0
  10. data/lib/memori_client/resource.rb +174 -26
  11. data/lib/memori_client/resource_proxy.rb +25 -0
  12. data/lib/memori_client/response.rb +48 -0
  13. data/lib/memori_client/swagger/errors.rb +5 -0
  14. data/lib/memori_client/swagger/get_module_and_method.rb +44 -0
  15. data/lib/memori_client/swagger/process_specification.rb +125 -0
  16. data/lib/memori_client/swagger/schema_store.rb +26 -0
  17. data/lib/memori_client.rb +15 -42
  18. data/lib/tasks/memori_client.rake +0 -7
  19. metadata +18 -90
  20. data/doc/MemoriClient::Backend::V1::Asset.md +0 -117
  21. data/doc/MemoriClient::Backend::V2::ActionLog.md +0 -37
  22. data/doc/MemoriClient::Backend::V2::Analysis.md +0 -39
  23. data/doc/MemoriClient::Backend::V2::Asset.md +0 -102
  24. data/doc/MemoriClient::Backend::V2::Badge.md +0 -64
  25. data/doc/MemoriClient::Backend::V2::CompletionConfig.md +0 -115
  26. data/doc/MemoriClient::Backend::V2::ConsumptionLog.md +0 -57
  27. data/doc/MemoriClient::Backend::V2::ImportExport.md +0 -180
  28. data/doc/MemoriClient::Backend::V2::Integration.md +0 -117
  29. data/doc/MemoriClient::Backend::V2::Invitation.md +0 -179
  30. data/doc/MemoriClient::Backend::V2::Memori.md +0 -394
  31. data/doc/MemoriClient::Backend::V2::MemoriList.md +0 -147
  32. data/doc/MemoriClient::Backend::V2::Notification.md +0 -31
  33. data/doc/MemoriClient::Backend::V2::Process.md +0 -64
  34. data/doc/MemoriClient::Backend::V2::Tenant.md +0 -142
  35. data/doc/MemoriClient::Backend::V2::User.md +0 -647
  36. data/doc/MemoriClient::Engine::V2::ChatLog.md +0 -82
  37. data/doc/MemoriClient::Engine::V2::ContextVar.md +0 -46
  38. data/doc/MemoriClient::Engine::V2::CorrelationPair.md +0 -72
  39. data/doc/MemoriClient::Engine::V2::CustomDictionary.md +0 -108
  40. data/doc/MemoriClient::Engine::V2::Dialog.md +0 -152
  41. data/doc/MemoriClient::Engine::V2::EventLog.md +0 -85
  42. data/doc/MemoriClient::Engine::V2::ExpertReference.md +0 -116
  43. data/doc/MemoriClient::Engine::V2::Function.md +0 -140
  44. data/doc/MemoriClient::Engine::V2::Intent.md +0 -225
  45. data/doc/MemoriClient::Engine::V2::LocalizationKey.md +0 -105
  46. data/doc/MemoriClient::Engine::V2::Medium.md +0 -118
  47. data/doc/MemoriClient::Engine::V2::Memory.md +0 -244
  48. data/doc/MemoriClient::Engine::V2::NLP.md +0 -100
  49. data/doc/MemoriClient::Engine::V2::Person.md +0 -114
  50. data/doc/MemoriClient::Engine::V2::Search.md +0 -151
  51. data/doc/MemoriClient::Engine::V2::Session.md +0 -55
  52. data/doc/MemoriClient::Engine::V2::Stat.md +0 -18
  53. data/doc/MemoriClient::Engine::V2::Topic.md +0 -80
  54. data/doc/MemoriClient::Engine::V2::UnansweredQuestion.md +0 -75
  55. data/doc/MemoriClient::Engine::V2::User.md +0 -140
  56. data/doc/MemoriClient::Engine::V2::WebHook.md +0 -67
  57. data/lib/memori_client/backend/resource.rb +0 -39
  58. data/lib/memori_client/backend/resources.rb +0 -16
  59. data/lib/memori_client/backend/v1/asset.rb +0 -120
  60. data/lib/memori_client/backend/v2/action_log.rb +0 -44
  61. data/lib/memori_client/backend/v2/analysis.rb +0 -54
  62. data/lib/memori_client/backend/v2/asset.rb +0 -130
  63. data/lib/memori_client/backend/v2/badge.rb +0 -77
  64. data/lib/memori_client/backend/v2/completion_config.rb +0 -202
  65. data/lib/memori_client/backend/v2/consumption_log.rb +0 -70
  66. data/lib/memori_client/backend/v2/import_export.rb +0 -327
  67. data/lib/memori_client/backend/v2/integration.rb +0 -180
  68. data/lib/memori_client/backend/v2/invitation.rb +0 -252
  69. data/lib/memori_client/backend/v2/memori.rb +0 -954
  70. data/lib/memori_client/backend/v2/memori_list.rb +0 -152
  71. data/lib/memori_client/backend/v2/notification.rb +0 -32
  72. data/lib/memori_client/backend/v2/process.rb +0 -70
  73. data/lib/memori_client/backend/v2/tenant.rb +0 -293
  74. data/lib/memori_client/backend/v2/user.rb +0 -1520
  75. data/lib/memori_client/configuration.rb +0 -20
  76. data/lib/memori_client/engine/resource.rb +0 -13
  77. data/lib/memori_client/engine/resources.rb +0 -21
  78. data/lib/memori_client/engine/v2/chat_log.rb +0 -92
  79. data/lib/memori_client/engine/v2/completion_log.rb +0 -17
  80. data/lib/memori_client/engine/v2/context_var.rb +0 -48
  81. data/lib/memori_client/engine/v2/correlation_pair.rb +0 -99
  82. data/lib/memori_client/engine/v2/custom_dictionary.rb +0 -152
  83. data/lib/memori_client/engine/v2/dialog.rb +0 -223
  84. data/lib/memori_client/engine/v2/event_log.rb +0 -98
  85. data/lib/memori_client/engine/v2/expert_reference.rb +0 -176
  86. data/lib/memori_client/engine/v2/function.rb +0 -220
  87. data/lib/memori_client/engine/v2/intent.rb +0 -336
  88. data/lib/memori_client/engine/v2/localization_key.rb +0 -144
  89. data/lib/memori_client/engine/v2/medium.rb +0 -178
  90. data/lib/memori_client/engine/v2/memori.rb +0 -329
  91. data/lib/memori_client/engine/v2/memory.rb +0 -477
  92. data/lib/memori_client/engine/v2/nlp.rb +0 -137
  93. data/lib/memori_client/engine/v2/person.rb +0 -170
  94. data/lib/memori_client/engine/v2/private/memori.rb +0 -17
  95. data/lib/memori_client/engine/v2/private/memori_block.rb +0 -24
  96. data/lib/memori_client/engine/v2/prompted_question.rb +0 -121
  97. data/lib/memori_client/engine/v2/search.rb +0 -318
  98. data/lib/memori_client/engine/v2/session.rb +0 -80
  99. data/lib/memori_client/engine/v2/stat.rb +0 -20
  100. data/lib/memori_client/engine/v2/topic.rb +0 -88
  101. data/lib/memori_client/engine/v2/unanswered_question.rb +0 -108
  102. data/lib/memori_client/engine/v2/user.rb +0 -152
  103. data/lib/memori_client/engine/v2/web_hook.rb +0 -128
@@ -1,57 +1,205 @@
1
1
  class MemoriClient::Resource
2
- def self.build_arguments(the_binding)
3
- the_binding.local_variables.each_with_object({}) do |key, acc|
4
- value = the_binding.local_variable_get(key)
5
- acc[key] = value
2
+ attr_reader :operations
3
+
4
+ def initialize(key, api_root:, version:)
5
+ @key = key
6
+ @api_root = api_root
7
+ @version = version
8
+ @operations = {}
9
+ end
10
+
11
+ def register_operation(item)
12
+ method_name = item[:method_name]
13
+ @operations[method_name] ||= MemoriClient::Operation.new(item, version: @version, key: @key)
14
+ end
15
+
16
+ def markdown_documentation
17
+ <<~MARKDOWN
18
+ # #{@version}.#{@key.downcase}
19
+
20
+ #{@operations.map { |key, operation| operation.markdown_documentation }.join("\n")}
21
+ MARKDOWN
22
+ end
23
+
24
+ def method_missing(method, *args, &block)
25
+ if @operations.key?(method.to_s)
26
+ invoke_endpoint(method, *args, &block)
27
+ elsif method.to_s.end_with?('_documentation')
28
+ documentation = @operations[method.to_s.chomp('_documentation')]
29
+
30
+ # Add the request body schema to the documentation
31
+ schema_ref = documentation[:spec]['requestBody']['content']['application/json']['schema']['$ref']
32
+ key = schema_ref.split('/').last
33
+ schema = Swagger::SchemaStore.instance.get(key)
34
+ documentation[:request_body_schema] = schema
35
+
36
+ documentation
37
+ else
38
+ super
6
39
  end
7
40
  end
8
41
 
9
- def self.exec_http_request(method, path, args)
10
- headers = args[:headers] || {}
42
+ private
43
+
44
+ def build_path(spec, args)
11
45
  stop = false
12
46
  processed_tokens = []
13
- path.split('/').each do |token|
47
+ spec[:path].split('/').each do |token|
14
48
  break if stop == true
15
49
  if token =~ /^{.*}$/
16
50
  param_name = token.match(/^{(.*)}$/).captures.first
17
- if args[param_name.to_sym].blank?
51
+ param_value = args[param_name.to_sym]
52
+ if param_value.nil? || param_value.empty?
18
53
  stop = true
19
54
  else
20
- processed_tokens << args[param_name.to_sym]
55
+ processed_tokens << param_value
21
56
  end
22
57
  else
23
58
  processed_tokens << token
24
59
  end
25
60
  end
26
61
 
27
- url = processed_tokens.join('/')
28
- url = build_url(url)
62
+ processed_tokens.join('/')
63
+ end
64
+
65
+ def build_url(path)
66
+ [@api_root, path].join('')
67
+ end
68
+
69
+ def invoke_endpoint(method_name, *args, &block)
70
+ operation = @operations[method_name.to_s]
71
+ spec = operation.spec
72
+ parameters, payload = validate_input!(spec, args)
73
+
74
+ path = build_path(spec, parameters)
75
+ headers = args[0][:headers] || {}
76
+ url = build_url(path)
29
77
  http = MemoriClient::HttpClient.new
30
78
 
31
- case method
79
+ http_method = spec[:method]
80
+ case http_method
32
81
  when 'get'
33
- status, body = http.get(url, headers: headers)
82
+ http.get(url, headers: headers)
34
83
  else
35
- status, body = http.send(method, url, payload: args[:payload], headers: headers)
84
+ payload = payload
85
+ http.send(http_method, url, payload: payload, headers: headers)
36
86
  end
37
-
38
- [status, body]
39
87
  end
40
88
 
41
- def self.build_url(_url)
42
- raise NotImplementedError
43
- end
89
+ def validate_input!(spec, args)
90
+ args = [{}] if args.size == 0
91
+ input_payload = args[0][:payload] || {}
92
+ input_parameters = args[0].with_indifferent_access
93
+
94
+ parameters = spec[:spec]['parameters'] || []
44
95
 
45
- def self.validate_payload!(payload, keys:, required:)
46
- bad_names = []
47
- payload.each do |k, v|
48
- unless keys.include?(k.to_s)
49
- bad_names << k
96
+ parameters_map = {}
97
+ required_parameters = []
98
+ parameters.each do |parameter|
99
+ key = parameter['name']
100
+ parameters_map[key] = parameter
101
+ required_parameters << key if parameter['required'] == true
102
+ end
103
+
104
+ missing_parameters = required_parameters - input_parameters.keys
105
+ if missing_parameters.size > 0
106
+ raise ArgumentError.new "Missing required parameters: #{missing_parameters.join(', ')}"
107
+ end
108
+
109
+ unknown_parameters = []
110
+ skippable_parameters = [:payload, :headers, 'payload', 'headers']
111
+ input_parameters.each do |key, value|
112
+ next if skippable_parameters.include?(key)
113
+
114
+ if parameters_map[key].nil?
115
+ unknown_parameters << key
116
+ end
117
+ end
118
+
119
+ if unknown_parameters.size > 0
120
+ raise ArgumentError.new "Unknown parameters: #{unknown_parameters.join(', ')}"
121
+ end
122
+
123
+ # But watch out, payload is not here!
124
+ payload_keys = []
125
+ payload_required_keys = []
126
+ required_keys = []
127
+ if spec[:spec]['requestBody']
128
+ request_body_schema_ref = spec[:spec]['requestBody']['content']['application/json']['schema']['$ref']
129
+ key = request_body_schema_ref.split('/').last
130
+ schema = MemoriClient::Swagger::SchemaStore.instance.get(key)
131
+
132
+ required_keys = schema['required'] || []
133
+
134
+ schema['properties'].each do |key, value|
135
+ required = value['nullable'] == false || required_keys.include?(key)
136
+ payload_keys << key
137
+ payload_required_keys << key if required
50
138
  end
51
139
  end
52
140
 
53
- if bad_names.size > 0
54
- raise ArgumentError.new "Found invalid keys: #{bad_names.join(', ')}"
141
+ missing_payload_keys = payload_required_keys - input_payload.keys
142
+ puts "missing_payload_keys: #{missing_payload_keys} => #{payload_required_keys} - #{input_payload.keys}"
143
+ if missing_payload_keys.size > 0
144
+ raise ArgumentError.new "Missing required payload keys: #{missing_payload_keys.join(', ')}"
55
145
  end
146
+
147
+ [input_parameters, input_payload]
56
148
  end
149
+
150
+ # def self.build_arguments(the_binding)
151
+ # the_binding.local_variables.each_with_object({}) do |key, acc|
152
+ # value = the_binding.local_variable_get(key)
153
+ # acc[key] = value
154
+ # end
155
+ # end
156
+
157
+ # def self.exec_http_request(method, path, args)
158
+ # headers = args[:headers] || {}
159
+ # stop = false
160
+ # processed_tokens = []
161
+ # path.split('/').each do |token|
162
+ # break if stop == true
163
+ # if token =~ /^{.*}$/
164
+ # param_name = token.match(/^{(.*)}$/).captures.first
165
+ # if args[param_name.to_sym].blank?
166
+ # stop = true
167
+ # else
168
+ # processed_tokens << args[param_name.to_sym]
169
+ # end
170
+ # else
171
+ # processed_tokens << token
172
+ # end
173
+ # end
174
+
175
+ # url = processed_tokens.join('/')
176
+ # url = build_url(url)
177
+ # http = MemoriClient::HttpClient.new
178
+
179
+ # case method
180
+ # when 'get'
181
+ # status, body = http.get(url, headers: headers)
182
+ # else
183
+ # status, body = http.send(method, url, payload: args[:payload], headers: headers)
184
+ # end
185
+
186
+ # [status, body]
187
+ # end
188
+
189
+ # def self.build_url(_url)
190
+ # raise NotImplementedError
191
+ # end
192
+
193
+ # def self.validate_payload!(payload, keys:, required:)
194
+ # bad_names = []
195
+ # payload.each do |k, v|
196
+ # unless keys.include?(k.to_s)
197
+ # bad_names << k
198
+ # end
199
+ # end
200
+
201
+ # if bad_names.size > 0
202
+ # raise ArgumentError.new "Found invalid keys: #{bad_names.join(', ')}"
203
+ # end
204
+ # end
57
205
  end
@@ -0,0 +1,25 @@
1
+ module MemoriClient
2
+ class ResourceProxy
3
+ attr_reader :resources
4
+
5
+ def initialize(api_root:, version:)
6
+ @api_root = api_root
7
+ @version = version
8
+ @resources = {}
9
+ end
10
+
11
+ def register_resource(klass)
12
+ @resources[klass] ||= MemoriClient::Resource.new(klass, api_root: @api_root, version: @version)
13
+ end
14
+
15
+ private
16
+
17
+ def method_missing(method, *args, &block)
18
+ if @resources.key?(method.to_s)
19
+ @resources[method.to_s]
20
+ else
21
+ super
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ # Wraps the response from the API
2
+ module MemoriClient
3
+ class Response
4
+ def initialize(response, request: nil)
5
+ @response = response
6
+ @request = request
7
+ end
8
+
9
+ def as_json
10
+ {
11
+ status: status,
12
+ success: success?,
13
+ error: error?,
14
+ parsed_body: parsed_body
15
+ }
16
+ end
17
+
18
+ def status
19
+ @response.code.to_i
20
+ end
21
+
22
+ def success?
23
+ @response.code.to_i == 200
24
+ end
25
+
26
+ def error?
27
+ !success?
28
+ end
29
+
30
+ def parsed_body
31
+ return @parsed_body if @parsed_body
32
+
33
+ body = @response.read_body
34
+
35
+ if @request['Content-Type'] == 'application/json' || @response.content_type == 'application/json'
36
+ if body.nil? || body == ''
37
+ @parsed_body = {}
38
+ else
39
+ @parsed_body = JSON.parse(body)
40
+ end
41
+ else
42
+ @parsed_body = body
43
+ end
44
+
45
+ @parsed_body
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,5 @@
1
+ module MemoriClient
2
+ module Swagger
3
+ class MethodCollisionError < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,44 @@
1
+ module MemoriClient
2
+ module Swagger
3
+ class GetModuleAndMethod
4
+ def initialize(namespace, method, path, endpoint_data)
5
+ @endpoint_data = endpoint_data
6
+ @namespace = namespace
7
+ @method = method
8
+ @path = path
9
+ end
10
+
11
+ def call
12
+ # Load using gem path as root
13
+ gem_path = Gem.loaded_specs['memori-client'].full_gem_path
14
+ # Not sure if this is visible after gem release.
15
+ overrides_path = File.join(gem_path, "#{@namespace}_overrides.jsonc")
16
+ if File.exist?(overrides_path)
17
+ overrides = JSON.parse(File.open(overrides_path).read)
18
+ else
19
+ raise "No overrides found for #{@namespace}"
20
+ end
21
+ # overrides = JSON.parse(File.open("#{@namespace}_overrides.jsonc").read)
22
+ key = [@method, @path].join(' ')
23
+ if overrides.key?(key)
24
+ # puts "THERE IS AN OVERRIDE FOR #{key}. Operation id is #{@endpoint_data['operationId']}"
25
+ value = overrides[key]
26
+ return value.split('#')
27
+ end
28
+
29
+ if @endpoint_data.key?('operationId')
30
+ version = @path.split('/').find { |t| t =~ /v\d+/ }
31
+ controller, action = @endpoint_data['operationId'].split('-')
32
+ mod = [
33
+ 'MemoriClient',
34
+ @namespace.titleize,
35
+ version.upcase,
36
+ controller.singularize
37
+ ].join('::')
38
+
39
+ return [mod, action.underscore]
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,125 @@
1
+ module MemoriClient
2
+ module Swagger
3
+ class ProcessSpecification
4
+ attr_reader :swagger_spec
5
+ def initialize(uri:, kind:)
6
+ @uri = uri
7
+ @kind = kind
8
+ @result = {}
9
+ @endpoints = {}
10
+ @methods = {}
11
+ @methods_collisions = []
12
+ end
13
+
14
+ def call
15
+ data = URI.open(@uri).read
16
+ parsed = JSON.parse(data)
17
+ @swagger_spec = parsed
18
+ paths = parsed['paths']
19
+ # routes = collect_routes(paths)
20
+ # puts JSON.pretty_generate(routes)
21
+ paths.each do |path, path_data|
22
+ path_data.each do |method, endpoint|
23
+ module_name, info = analyze_path(method, path, endpoint)
24
+ unless module_name.nil?
25
+ @result[module_name] ||= []
26
+ @result[module_name] << info
27
+ end
28
+ end
29
+ end
30
+
31
+ # Verify collisions
32
+ @methods.keys.sort.each do |m|
33
+ @methods_collisions << m if @methods[m].size > 1
34
+ end
35
+
36
+ if @methods_collisions.any?
37
+ details = @methods_collisions.map do |m|
38
+ endpoints = @methods[m].map { |e| " #{e}" }.join("\n")
39
+ " - #{m} (#{@methods[m].size} endpoints):\n#{endpoints}"
40
+ end.join("\n")
41
+
42
+ raise MemoriClient::Swagger::MethodCollisionError, <<~MSG
43
+ Cannot process '#{@kind}' spec from #{@uri}: #{@methods_collisions.size} method collision(s) detected.
44
+ Two or more endpoints generate the same method name. Add an override entry in
45
+ '#{@kind}_overrides.jsonc' with key "<http_method> <path>" and value "Module#method"
46
+ to disambiguate one of the conflicting endpoints.
47
+ Collisions detected:
48
+ #{details}
49
+ MSG
50
+ end
51
+
52
+ @result
53
+ end
54
+
55
+ private
56
+
57
+ def analyze_path(method, path, endpoint_data)
58
+ re = /\/(memori|api)\/(v\d+)\/.*$/
59
+ version = path.match(re).captures[1].upcase
60
+
61
+ # cleaned_path = get_cleaned_path(path)
62
+
63
+ endpoint_key = [method, path].join(' ')
64
+ @endpoints[endpoint_key] ||= 0
65
+ @endpoints[endpoint_key] += 1
66
+
67
+ module_name, method_name = GetModuleAndMethod.new(@kind, method, path, endpoint_data).call
68
+ return if module_name.nil?
69
+
70
+ method_qname = [module_name, method_name].join('.')
71
+ @methods[method_qname] ||= []
72
+ @methods[method_qname] << endpoint_key
73
+
74
+ params = {}
75
+ unless endpoint_data['parameters'].nil?
76
+ endpoint_data['parameters'].each do |param|
77
+ k = param['name']
78
+ params[k] = param['required'] == true
79
+ end
80
+ end
81
+
82
+ data = {
83
+ method: method,
84
+ version: version,
85
+ path: path,
86
+ module: module_name,
87
+ method_name: method_name,
88
+ params: params,
89
+ request_body: !endpoint_data['requestBody'].nil?,
90
+ summary: endpoint_data['summary'],
91
+ spec: endpoint_data
92
+ }
93
+
94
+ if endpoint_data['requestBody']
95
+ request_body_schema_ref = endpoint_data['requestBody']['content']['application/json']['schema']['$ref']
96
+ key = request_body_schema_ref.split('/').last
97
+ schema = @swagger_spec['components']['schemas'][key]
98
+
99
+ SchemaStore.instance.add(key, schema)
100
+ end
101
+
102
+ [module_name, data]
103
+ end
104
+
105
+ def collect_routes(paths)
106
+ routes = {}
107
+ paths.each do |path, path_data|
108
+ path_data.each do |method, endpoint|
109
+ k = [method, path].join(' ')
110
+
111
+ re = /\/(memori|api)\/(v\d+)\/.*$/
112
+ tag = endpoint['tags'].first.singularize
113
+ puts path.inspect
114
+ version = path.match(re).captures[1].upcase
115
+ next if version == 'v1'
116
+
117
+ main = path.split('/')[3].underscore
118
+ routes[k] = "MemoriClient::#{@kind.titleize}::#{version}::#{tag}##{main}"
119
+ end
120
+ end
121
+ routes
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,26 @@
1
+ # Holds the schema for the swagger spec
2
+ #
3
+ # It is used to validate the payload against the schema
4
+ #
5
+ # It is also used to generate the documentation
6
+
7
+ require 'singleton'
8
+ module MemoriClient
9
+ module Swagger
10
+ class SchemaStore
11
+ include Singleton
12
+
13
+ def initialize
14
+ @schemas = {}
15
+ end
16
+
17
+ def add(key, schema)
18
+ @schemas[key] = schema
19
+ end
20
+
21
+ def get(key)
22
+ @schemas[key]
23
+ end
24
+ end
25
+ end
26
+ end
data/lib/memori_client.rb CHANGED
@@ -1,48 +1,17 @@
1
1
  module MemoriClient
2
- module Backend
3
- module V1
4
-
5
- end
6
-
7
- module V2
8
-
9
- end
10
- end
11
-
12
2
  module Engine
13
- module V1
14
-
15
- end
16
-
17
- module V2
18
- module Private
19
-
20
- end
21
- end
22
3
  end
23
4
 
24
- class << self
25
- # Instantiate the Configuration singleton
26
- # or return it. Remember that the instance
27
- # has attribute readers so that we can access
28
- # the configured values
29
- def configuration
30
- @configuration ||= Configuration.new
31
- end
5
+ module Proxy
6
+ end
32
7
 
33
- # This is the configure block definition.
34
- # The configuration method will return the
35
- # Configuration singleton, which is then yielded
36
- # to the configure block. Then it's just a matter
37
- # of using the attribute accessors we previously defined
38
- def configure
39
- yield(configuration)
40
- end
8
+ module Swagger
41
9
  end
42
10
  end
43
11
 
44
12
  require 'securerandom'
45
13
  require 'uri'
14
+ require 'open-uri'
46
15
  require 'json'
47
16
 
48
17
  if defined?(::Rails)
@@ -50,16 +19,20 @@ if defined?(::Rails)
50
19
  require 'memori_client/railtie'
51
20
  end
52
21
 
53
- require 'memori_client/configuration'
22
+ require 'memori_client/swagger/errors'
23
+ require 'memori_client/swagger/process_specification'
24
+ require 'memori_client/swagger/get_module_and_method'
25
+ require 'memori_client/swagger/schema_store'
26
+
27
+ require 'memori_client/client_factory'
28
+ require 'memori_client/client'
54
29
  require "memori_client/http_client"
30
+ require "memori_client/response"
55
31
  require "memori_client/resource"
56
- require "memori_client/backend/resource"
57
- require "memori_client/backend/resources"
32
+ require "memori_client/resource_proxy"
33
+ require "memori_client/operation"
58
34
  require "memori_client/engine/hmac_helper"
59
- require "memori_client/engine/resource"
60
- require "memori_client/engine/resources"
35
+ require "memori_client/proxy/client"
61
36
 
62
- require "memori_client/engine/v2/private/memori"
63
- require "memori_client/engine/v2/private/memori_block"
64
37
 
65
38
 
@@ -5,11 +5,4 @@ namespace :memori_client do
5
5
  MemoriClient::Utils::Rails.copy_docs
6
6
  end
7
7
  end
8
-
9
- namespace :config do
10
- desc "Copy MemoriClient initializer to Rails config/initializers"
11
- task :copy_initializer do
12
- MemoriClient::Utils::Rails.copy_initializer
13
- end
14
- end
15
8
  end