trophonius 1.4.5.5 → 2.1.5
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.
- checksums.yaml +4 -4
- data/lib/{trophonius_config.rb → config.rb} +10 -3
- data/lib/{trophonius_connection.rb → connectors/connection.rb} +115 -101
- data/lib/connectors/connection_manager.rb +39 -0
- data/lib/connectors/database_request.rb +151 -0
- data/lib/{trophonius_redis_manager.rb → connectors/redis_manager.rb} +9 -8
- data/lib/debug_printer.rb +11 -0
- data/lib/{trophonius_error.rb → error.rb} +3 -3
- data/lib/{trophonius_date.rb → fm_date.rb} +1 -1
- data/lib/fm_time.rb +11 -0
- data/lib/generators/trophonius_generator.rb +1 -0
- data/lib/model.rb +394 -0
- data/lib/{trophonius_query.rb → query.rb} +44 -57
- data/lib/{trophonius_record.rb → record.rb} +104 -116
- data/lib/{trophonius_recordset.rb → recordset.rb} +5 -6
- data/lib/{trophonius_single.rb → single.rb} +13 -59
- data/lib/translator.rb +15 -0
- data/lib/trophonius.rb +14 -8
- metadata +19 -16
- data/lib/trophonius_model.rb +0 -511
- data/lib/trophonius_request.rb +0 -173
- data/lib/trophonius_time.rb +0 -6
- /data/lib/{trophonius_date_time.rb → fm_date_time.rb} +0 -0
@@ -1,28 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# require 'time'
|
4
|
+
# require 'date_time'
|
5
|
+
# require 'date'
|
6
|
+
require 'active_support/inflector'
|
3
7
|
require 'json'
|
4
|
-
require '
|
8
|
+
require 'config'
|
9
|
+
require 'translator'
|
5
10
|
|
6
11
|
module Trophonius
|
7
12
|
# This class will hold a singular record
|
8
13
|
#
|
9
14
|
# A Record is contained in a RecordSet and has methods to retrieve data from the fields inside the Record-hash
|
10
|
-
class
|
15
|
+
class Record < Hash
|
16
|
+
include Trophonius::Translator
|
11
17
|
attr_accessor :record_id, :model_name, :layout_name, :modifiable_fields, :modified_fields
|
12
18
|
|
13
19
|
##
|
14
20
|
# Initializes a new Record
|
15
|
-
def initialize(model = '')
|
21
|
+
def initialize(fm_record = {}, model = '')
|
16
22
|
@modifiable_fields = {}
|
17
23
|
@modified_fields = {}
|
18
|
-
model_name = model
|
24
|
+
@model_name = model
|
19
25
|
@model = ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.classify(ActiveSupport::Inflector.singularize(model_name)))
|
20
|
-
|
21
|
-
|
26
|
+
@layout_name = @model.layout_name
|
27
|
+
define_field_methods(fm_record)
|
28
|
+
define_portal_methods(fm_record)
|
29
|
+
super()
|
22
30
|
end
|
23
31
|
|
24
32
|
def []=(field, new_val)
|
25
33
|
modifiable_fields[field] = new_val
|
34
|
+
modified_fields[field] = new_val
|
26
35
|
super
|
27
36
|
end
|
28
37
|
|
@@ -36,16 +45,7 @@ module Trophonius
|
|
36
45
|
layout = model.layout_name
|
37
46
|
model.create_translations if model.translations.keys.empty?
|
38
47
|
|
39
|
-
|
40
|
-
url =
|
41
|
-
URI(
|
42
|
-
uri.escape(
|
43
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
44
|
-
Trophonius.config.database
|
45
|
-
}/layouts/#{layout}/_find"
|
46
|
-
)
|
47
|
-
)
|
48
|
-
|
48
|
+
url = "/layouts/#{layout}/_find"
|
49
49
|
foreign_key_field = if model.translations.key?(relation[:foreign_key])
|
50
50
|
model.translations[relation[:foreign_key]].to_s
|
51
51
|
else
|
@@ -59,7 +59,7 @@ module Trophonius
|
|
59
59
|
end
|
60
60
|
|
61
61
|
body = { query: [{ foreign_key_field => self[primary_key_field].to_s }], limit: 100_000 }.to_json
|
62
|
-
response =
|
62
|
+
response = DatabaseRequest.make_request(url, 'post', body)
|
63
63
|
|
64
64
|
if response['messages'][0]['code'] == '0'
|
65
65
|
r_results = response['response']['data']
|
@@ -75,7 +75,7 @@ module Trophonius
|
|
75
75
|
|
76
76
|
else
|
77
77
|
if response['messages'][0]['code'] == '102'
|
78
|
-
results =
|
78
|
+
results = DatabaseRequest.retrieve_first(layout)
|
79
79
|
if results['messages'][0]['code'] == '0'
|
80
80
|
r_results = results['response']['data']
|
81
81
|
ret_val = r_results.empty? ? Error.throw_error('102') : r_results[0]['fieldData']
|
@@ -97,15 +97,7 @@ module Trophonius
|
|
97
97
|
layout = pk_model.layout_name
|
98
98
|
pk_model.create_translations if pk_model.translations.keys.empty?
|
99
99
|
|
100
|
-
|
101
|
-
url =
|
102
|
-
URI(
|
103
|
-
uri.escape(
|
104
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
105
|
-
Trophonius.config.database
|
106
|
-
}/layouts/#{layout}/_find"
|
107
|
-
)
|
108
|
-
)
|
100
|
+
url = "/layouts/#{layout}/_find"
|
109
101
|
|
110
102
|
foreign_key_field = if fk_model.translations.key?(relation[:foreign_key])
|
111
103
|
fk_model.translations[relation[:foreign_key]].to_s
|
@@ -121,7 +113,7 @@ module Trophonius
|
|
121
113
|
|
122
114
|
body = { query: [{ primary_key_field => self[foreign_key_field].to_s }], limit: 1 }.to_json
|
123
115
|
|
124
|
-
response =
|
116
|
+
response = DatabaseRequest.make_request(url, 'post', body)
|
125
117
|
if response['messages'][0]['code'] == '0'
|
126
118
|
r_results = response['response']['data']
|
127
119
|
ret_val = RecordSet.new(layout, pk_model.non_modifiable_fields)
|
@@ -136,7 +128,7 @@ module Trophonius
|
|
136
128
|
|
137
129
|
else
|
138
130
|
if response['messages'][0]['code'] == '102'
|
139
|
-
results =
|
131
|
+
results = DatabaseRequest.retrieve_first(layout)
|
140
132
|
if results['messages'][0]['code'] == '0'
|
141
133
|
r_results = results['response']['data']
|
142
134
|
ret_val = r_results.empty? ? Error.throw_error('102') : r_results[0]['fieldData']
|
@@ -169,17 +161,8 @@ module Trophonius
|
|
169
161
|
#
|
170
162
|
# @return [String]: string representing the script result returned by FileMaker
|
171
163
|
def run_script(script: '', scriptparameter: '')
|
172
|
-
|
173
|
-
url
|
174
|
-
URI(
|
175
|
-
uri.escape(
|
176
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
177
|
-
Trophonius.config.database
|
178
|
-
}/layouts/#{layout_name}/records/#{record_id}?script=#{script}&script.param=#{scriptparameter}"
|
179
|
-
)
|
180
|
-
)
|
181
|
-
|
182
|
-
result = Request.make_request(url, "Bearer #{Request.get_token}", 'get', '{}')
|
164
|
+
url = "layouts/#{layout_name}/records/#{record_id}?script=#{script}&script.param=#{scriptparameter}"
|
165
|
+
result = DatabaseRequest.make_request(url, 'get', '{}')
|
183
166
|
|
184
167
|
if result['messages'][0]['code'] != '0'
|
185
168
|
Error.throw_error(result['messages'][0]['code'])
|
@@ -197,17 +180,10 @@ module Trophonius
|
|
197
180
|
#
|
198
181
|
# @return [True] if successful
|
199
182
|
def save
|
200
|
-
|
201
|
-
|
202
|
-
URI(
|
203
|
-
uri.escape(
|
204
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
205
|
-
Trophonius.config.database
|
206
|
-
}/layouts/#{layout_name}/records/#{record_id}"
|
207
|
-
)
|
208
|
-
)
|
183
|
+
url = "layouts/#{layout_name}/records/#{record_id}"
|
184
|
+
|
209
185
|
body = "{\"fieldData\": #{modified_fields.to_json}}"
|
210
|
-
response =
|
186
|
+
response = DatabaseRequest.make_request(url, 'patch', body)
|
211
187
|
response['messages'][0]['code'] == '0' ? true : Error.throw_error(response['messages'][0]['code'])
|
212
188
|
end
|
213
189
|
|
@@ -217,16 +193,9 @@ module Trophonius
|
|
217
193
|
#
|
218
194
|
# @return [True] if successful
|
219
195
|
def delete
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
uri.escape(
|
224
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
225
|
-
Trophonius.config.database
|
226
|
-
}/layouts/#{layout_name}/records/#{record_id}"
|
227
|
-
)
|
228
|
-
)
|
229
|
-
response = Request.make_request(url, "Bearer #{Request.get_token}", 'delete', '{}')
|
196
|
+
url = "layouts/#{layout_name}/records/#{record_id}"
|
197
|
+
|
198
|
+
response = DatabaseRequest.make_request(url, 'delete', '{}')
|
230
199
|
response['messages'][0]['code'] == '0' ? true : Error.throw_error(response['messages'][0]['code'])
|
231
200
|
end
|
232
201
|
|
@@ -238,56 +207,32 @@ module Trophonius
|
|
238
207
|
#
|
239
208
|
# @return [True] if successful
|
240
209
|
def update(field_data, portal_data: {})
|
241
|
-
|
242
|
-
url =
|
243
|
-
URI(
|
244
|
-
uri.escape(
|
245
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
246
|
-
Trophonius.config.database
|
247
|
-
}/layouts/#{layout_name}/records/#{record_id}"
|
248
|
-
)
|
249
|
-
)
|
210
|
+
url = "layouts/#{layout_name}/records/#{record_id}"
|
250
211
|
field_data.each_key { |field| modifiable_fields[field] = field_data[field] }
|
251
|
-
|
252
|
-
portal_data.each do |portal_name, portal_values|
|
253
|
-
new_portal_data.merge!(
|
254
|
-
portal_name =>
|
255
|
-
portal_values.map do |record|
|
256
|
-
record.each_with_object({}) do |(key, value), new_hash|
|
257
|
-
if key.to_s.downcase.include?('id') && key.to_s.downcase.include?('record')
|
258
|
-
new_hash['recordId'] = value
|
259
|
-
else
|
260
|
-
new_hash["#{portal_name}::#{key}"] = value
|
261
|
-
end
|
262
|
-
end
|
263
|
-
end
|
264
|
-
)
|
265
|
-
end
|
266
|
-
body =
|
267
|
-
if new_portal_data == {}
|
268
|
-
"{\"fieldData\": #{field_data.to_json} }"
|
269
|
-
else
|
270
|
-
"{\"fieldData\": #{field_data.to_json}, \"portalData\": #{new_portal_data.to_json}}"
|
271
|
-
end
|
212
|
+
field_data.transform_keys! { |k| (@model.translations[k.to_s] || k).to_s }
|
272
213
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
r_results = results['response']['data']
|
282
|
-
Error.throw_error('102') if r_results.empty?
|
283
|
-
ret_val = r_results[0]['fieldData']
|
284
|
-
Error.throw_error('102', (field_data.keys.map { |key| key.to_s.downcase } - ret_val.keys.map(&:downcase)).flatten.join(', '), layout_name)
|
285
|
-
else
|
286
|
-
Error.throw_error('102')
|
214
|
+
portal_data.each do |portal_name, values|
|
215
|
+
values.map do |record|
|
216
|
+
record.transform_keys! do |k|
|
217
|
+
if k.to_s.downcase.include?('id') && k.to_s.downcase.include?('record')
|
218
|
+
'recordId'
|
219
|
+
else
|
220
|
+
"#{portal_name}::#{k}"
|
221
|
+
end
|
287
222
|
end
|
288
223
|
end
|
289
|
-
Error.throw_error(response['messages'][0]['code'])
|
290
224
|
end
|
225
|
+
|
226
|
+
body = { fieldData: field_data }
|
227
|
+
body.merge!({ portalData: portal_data }) if portal_data.present?
|
228
|
+
|
229
|
+
response = DatabaseRequest.make_request(url, 'patch', body.to_json)
|
230
|
+
code = response['messages'][0]['code']
|
231
|
+
|
232
|
+
return throw_field_missing(field_data) if code == '102'
|
233
|
+
return Error.throw_error(code) if code != '0'
|
234
|
+
|
235
|
+
true
|
291
236
|
end
|
292
237
|
|
293
238
|
##
|
@@ -300,18 +245,61 @@ module Trophonius
|
|
300
245
|
#
|
301
246
|
# @return [True] if successful
|
302
247
|
def upload(container_name:, file:, container_repetition: 1)
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
uri.escape(
|
307
|
-
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
|
308
|
-
Trophonius.config.database
|
309
|
-
}/layouts/#{layout_name}/records/#{record_id}/containers/#{container_name}/#{container_repetition}"
|
310
|
-
)
|
311
|
-
)
|
312
|
-
|
313
|
-
response = Request.upload_file_request(url, "Bearer #{Request.get_token}", file)
|
248
|
+
url = "layouts/#{layout_name}/records/#{record_id}/containers/#{container_name}/#{container_repetition}"
|
249
|
+
|
250
|
+
response = DatabaseRequest.upload_file_request(url, file)
|
314
251
|
response['messages'][0]['code'] == '0' ? true : Error.throw_error(response['messages'][0]['code'])
|
315
252
|
end
|
253
|
+
|
254
|
+
private
|
255
|
+
|
256
|
+
def define_field_assignment(field_name, key)
|
257
|
+
define_singleton_method("#{field_name}=") do |new_val|
|
258
|
+
self[key] = new_val
|
259
|
+
modifiable_fields[key] = new_val
|
260
|
+
modified_fields[key] = new_val
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def define_field_methods(fm_record)
|
265
|
+
@record_id = fm_record['recordId']
|
266
|
+
|
267
|
+
fm_record['fieldData'].each_key do |key|
|
268
|
+
method_name = methodize_field(key)
|
269
|
+
define_singleton_method(method_name) { self[key] }
|
270
|
+
merge!({ key => fm_record['fieldData'][key] })
|
271
|
+
|
272
|
+
next if @model.non_modifiable_fields.include?(key)
|
273
|
+
|
274
|
+
modifiable_fields.merge!({ key => fm_record['fieldData'][key] })
|
275
|
+
define_field_assignment(method_name, key)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def define_portal_methods(fm_record)
|
280
|
+
fm_record['portalData'].each_key do |key|
|
281
|
+
method_name = methodize_field(key)
|
282
|
+
define_singleton_method(method_name) { self[key] }
|
283
|
+
fm_record['portalData'][key].each do |portal_record|
|
284
|
+
portal_record.each_key do |inner_key|
|
285
|
+
inner_method = methodize_portal_field(inner_key)
|
286
|
+
portal_record.send(:define_singleton_method, inner_method.to_s) { portal_record[inner_key] }
|
287
|
+
portal_record.send(:define_singleton_method, 'record_id') { portal_record['recordId'] }
|
288
|
+
end
|
289
|
+
end
|
290
|
+
merge!({ key => fm_record['portalData'][key] })
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
def throw_field_missing(field_data)
|
295
|
+
results = DatabaseRequest.retrieve_first(layout_name)
|
296
|
+
if results['messages'][0]['code'] == '0' && !results['response']['data'].empty?
|
297
|
+
r_results = results['response']['data']
|
298
|
+
ret_val = r_results[0]['fieldData']
|
299
|
+
Error.throw_error('102', (field_data.keys.map(&:downcase) - ret_val.keys.map(&:downcase)).flatten.join(', '), layout_name)
|
300
|
+
else
|
301
|
+
Error.throw_error('102')
|
302
|
+
end
|
303
|
+
end
|
316
304
|
end
|
317
305
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'json'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
2
|
+
require 'config'
|
3
|
+
require 'model'
|
4
|
+
require 'connectors/connection'
|
5
5
|
|
6
6
|
module Trophonius
|
7
7
|
# A RecordSet contains all records, as Record, retrieved from the FileMaker database
|
8
|
-
class
|
8
|
+
class RecordSet < Array
|
9
9
|
attr_accessor :result_count, :layout_name, :non_modifiable_fields, :records
|
10
10
|
|
11
11
|
class EmptyParameterError < ArgumentError; end # :nodoc:
|
@@ -38,8 +38,7 @@ module Trophonius
|
|
38
38
|
|
39
39
|
temp = Trophonius::Model
|
40
40
|
temp.config layout_name: layout_name, non_modifiable_fields: non_modifiable_fields
|
41
|
-
|
42
|
-
retval
|
41
|
+
temp.where(fielddata)
|
43
42
|
end
|
44
43
|
|
45
44
|
##
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require 'trophonius_record'
|
5
|
-
require 'trophonius_recordset'
|
1
|
+
require 'error'
|
2
|
+
require 'record'
|
3
|
+
require 'recordset'
|
6
4
|
|
7
5
|
module Trophonius
|
8
|
-
class
|
6
|
+
class Single
|
9
7
|
attr_reader :query
|
10
8
|
|
11
9
|
def initialize(config:)
|
@@ -116,56 +114,9 @@ module Trophonius
|
|
116
114
|
private
|
117
115
|
|
118
116
|
def build_result(result)
|
119
|
-
hash = Trophonius::Record.new
|
120
|
-
|
121
|
-
|
122
|
-
hash.model_name = 'Single'
|
123
|
-
|
124
|
-
result['fieldData'].keys.each do |key|
|
125
|
-
# unless key[/\s/] || key[/\W/]
|
126
|
-
@translations.merge!(
|
127
|
-
{ ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_').downcase.to_s => key.to_s }
|
128
|
-
)
|
129
|
-
hash.send(:define_singleton_method, ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_')) do
|
130
|
-
hash[key]
|
131
|
-
end
|
132
|
-
unless @config[:non_modifiable_fields]&.include?(key)
|
133
|
-
@all_fields.merge!(
|
134
|
-
ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_').downcase =>
|
135
|
-
ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_')
|
136
|
-
)
|
137
|
-
hash.send(
|
138
|
-
:define_singleton_method,
|
139
|
-
"#{ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_')}="
|
140
|
-
) do |new_val|
|
141
|
-
hash[key] = new_val
|
142
|
-
hash.modifiable_fields[key] = new_val
|
143
|
-
hash.modified_fields[key] = new_val
|
144
|
-
end
|
145
|
-
end
|
146
|
-
# end
|
147
|
-
hash.merge!({ key => result['fieldData'][key] })
|
148
|
-
hash.modifiable_fields.merge!({ key => result['fieldData'][key] }) unless @config[:non_modifiable_fields]&.include?(key)
|
149
|
-
end
|
150
|
-
result['portalData'].keys.each do |key|
|
151
|
-
unless key[/\s/] || key[/\W/]
|
152
|
-
hash.send(:define_singleton_method, ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(key.to_s), separator: '_')) do
|
153
|
-
hash[key]
|
154
|
-
end
|
155
|
-
end
|
156
|
-
result['portalData'][key].each do |inner_hash|
|
157
|
-
inner_hash.keys.each do |inner_key|
|
158
|
-
inner_method =
|
159
|
-
ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(inner_key.gsub(/\w+::/, '').to_s), separator: '_')
|
160
|
-
unless inner_method[/\s/] || inner_method[/\W/]
|
161
|
-
inner_hash.send(:define_singleton_method, inner_method.to_s) { inner_hash[inner_key] }
|
162
|
-
inner_hash.send(:define_singleton_method, 'record_id') { inner_hash['recordId'] }
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
hash.merge!({ key => result['portalData'][key] })
|
167
|
-
end
|
168
|
-
hash
|
117
|
+
hash = Trophonius::Record.new(result, 'Single')
|
118
|
+
record.layout_name = @config[:layout_name]
|
119
|
+
record
|
169
120
|
end
|
170
121
|
|
171
122
|
def make_request(url_param, token, method, body, params = '')
|
@@ -184,7 +135,8 @@ module Trophonius
|
|
184
135
|
temp = request.run
|
185
136
|
begin
|
186
137
|
JSON.parse(temp.response_body)
|
187
|
-
rescue
|
138
|
+
rescue StandardError => e
|
139
|
+
puts e
|
188
140
|
close_connection(token)
|
189
141
|
Error.throw_error('1631')
|
190
142
|
end
|
@@ -217,7 +169,8 @@ module Trophonius
|
|
217
169
|
temp = request.run
|
218
170
|
begin
|
219
171
|
parsed = JSON.parse(temp.response_body)
|
220
|
-
rescue
|
172
|
+
rescue StandardError => e
|
173
|
+
puts e
|
221
174
|
Error.throw_error('1631')
|
222
175
|
end
|
223
176
|
Error.throw_error(parsed['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
|
@@ -244,7 +197,8 @@ module Trophonius
|
|
244
197
|
|
245
198
|
begin
|
246
199
|
parsed = JSON.parse(temp.response_body)
|
247
|
-
rescue
|
200
|
+
rescue StandardError => e
|
201
|
+
puts e
|
248
202
|
Error.throw_error('1631')
|
249
203
|
end
|
250
204
|
Error.throw_error(parsed['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
|
data/lib/translator.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# require 'time'
|
2
|
+
# require 'date_time'
|
3
|
+
# require 'date'
|
4
|
+
require 'active_support/inflector'
|
5
|
+
module Trophonius
|
6
|
+
module Translator
|
7
|
+
def methodize_field(field_name)
|
8
|
+
ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(field_name), separator: '_').downcase
|
9
|
+
end
|
10
|
+
|
11
|
+
def methodize_portal_field(field_name)
|
12
|
+
ActiveSupport::Inflector.parameterize(ActiveSupport::Inflector.underscore(field_name.gsub(/\w+::/, '').to_s), separator: '_')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/trophonius.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
|
5
|
-
require '
|
6
|
-
require '
|
1
|
+
require 'fm_time'
|
2
|
+
require 'fm_date_time'
|
3
|
+
require 'fm_date'
|
4
|
+
|
5
|
+
require 'connectors/database_request'
|
6
|
+
require 'connectors/connection_manager'
|
7
|
+
require 'model'
|
8
|
+
require 'config'
|
7
9
|
|
8
10
|
module Trophonius # :nodoc:
|
9
11
|
def self.configuration
|
@@ -13,11 +15,15 @@ module Trophonius # :nodoc:
|
|
13
15
|
|
14
16
|
def self.configure
|
15
17
|
yield configuration
|
18
|
+
@connection_manager ||= ConnectionManager.new
|
19
|
+
@configuration
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.connection_manager
|
23
|
+
@connection_manager
|
16
24
|
end
|
17
25
|
|
18
26
|
def self.config
|
19
27
|
@configuration
|
20
28
|
end
|
21
|
-
|
22
|
-
private
|
23
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trophonius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kempen Automatisering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -59,22 +59,25 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- lib/config.rb
|
63
|
+
- lib/connectors/connection.rb
|
64
|
+
- lib/connectors/connection_manager.rb
|
65
|
+
- lib/connectors/database_request.rb
|
66
|
+
- lib/connectors/redis_manager.rb
|
67
|
+
- lib/debug_printer.rb
|
68
|
+
- lib/error.rb
|
69
|
+
- lib/fm_date.rb
|
70
|
+
- lib/fm_date_time.rb
|
71
|
+
- lib/fm_time.rb
|
62
72
|
- lib/generators/trophonius_generator.rb
|
63
73
|
- lib/generators/trophonius_model_generator.rb
|
74
|
+
- lib/model.rb
|
75
|
+
- lib/query.rb
|
76
|
+
- lib/record.rb
|
77
|
+
- lib/recordset.rb
|
78
|
+
- lib/single.rb
|
79
|
+
- lib/translator.rb
|
64
80
|
- lib/trophonius.rb
|
65
|
-
- lib/trophonius_config.rb
|
66
|
-
- lib/trophonius_connection.rb
|
67
|
-
- lib/trophonius_date.rb
|
68
|
-
- lib/trophonius_date_time.rb
|
69
|
-
- lib/trophonius_error.rb
|
70
|
-
- lib/trophonius_model.rb
|
71
|
-
- lib/trophonius_query.rb
|
72
|
-
- lib/trophonius_record.rb
|
73
|
-
- lib/trophonius_recordset.rb
|
74
|
-
- lib/trophonius_redis_manager.rb
|
75
|
-
- lib/trophonius_request.rb
|
76
|
-
- lib/trophonius_single.rb
|
77
|
-
- lib/trophonius_time.rb
|
78
81
|
homepage: https://github.com/Willem-Jan/Trophonius
|
79
82
|
licenses:
|
80
83
|
- MIT
|
@@ -95,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
98
|
- !ruby/object:Gem::Version
|
96
99
|
version: '0'
|
97
100
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.5.5
|
99
102
|
signing_key:
|
100
103
|
specification_version: 4
|
101
104
|
summary: Link between Ruby (on Rails) and FileMaker.
|