trophonius 1.2.4.9 → 1.2.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trophonius_model.rb +34 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00a7c14bd030e2f9556582beaf62ed25cb47ee8472493d92d11780e110c9c001
4
- data.tar.gz: d0d288c28853421f8e224a834b476b3997872dbb9d7d606ece5cfa0e00864671
3
+ metadata.gz: c79101c445307adbbb319a9cf07fed8e2b0fb3ae6d17a213833452ff9252f6cd
4
+ data.tar.gz: 21e0bc3a18a443f3576699100c48cf4f1db6b9efe4a031d5c52a26c95a4cb464
5
5
  SHA512:
6
- metadata.gz: f18b0ceb2b54cd6bbacfd3edcc84f1c3897aaa8dfbcc8041c5ab7dc9c45290667704ee79d9086a3bc895356bba1a6dd9af26580e0ed633c059b74601023aad38
7
- data.tar.gz: ba7160a9f94509edb74ca0ab267cdf76e670dbf76013c190ed636395573637099d6e12cc84a51a394c8982f28cd46eac9c495f4df79358044874f500d19b8388
6
+ metadata.gz: cfef37d5c0ddca6ac545d76ed5b62df8b8f1514f247cdf6749ab0925ac33a0d889fe6f11ba9a75985164c81e7b8ffb91c24c13df79ba53e4475aa53f3e27ec37
7
+ data.tar.gz: 6afb02d5bc0d8d8a33853ffc1eff5f1f7cceb4026a665e74f6ff01d3b7189a616e9cc127b8e9962ea8fa23abb381661d5c8dbb4602588668abf8168d2784be7d
@@ -32,6 +32,40 @@ module Trophonius
32
32
  @limit = ''
33
33
  end
34
34
 
35
+ ##
36
+ # Sets up the configuration for the model.
37
+ #
38
+ # @param [Hash] configuration: the hash containing the config to setup the model correctly.
39
+ # configuration = {layout_name: "theFileMakerLayoutForThisModel", non_modifiable_fields: ["an", "array", "containing", "calculation_fields", "etc."]}
40
+ def self.config(configuration)
41
+ @configuration ||= Configuration.new
42
+ @configuration.layout_name = configuration[:layout_name]
43
+ @configuration.non_modifiable_fields = configuration[:non_modifiable_fields]
44
+ @configuration.all_fields = {}
45
+ @configuration.translations = {}
46
+ @offset = ''
47
+ @limit = ''
48
+ end
49
+
50
+ ##
51
+ # Add a has many relationship.
52
+ #
53
+ # @param [Symbol] model_name: the name of the model to build a relation with
54
+ # @param [String] primary_key: the name of the field containing the primary to build the relation over
55
+ # @param [String] foreign_key: the name of the field containing the primary to build the relation over
56
+ #
57
+ # @return [Trophonius::Model] Self
58
+ def self.has_many(model_name, primary_key:, foreign_key:)
59
+ @configuration ||= Configuration.new
60
+ @configuration.layout_name = configuration[:layout_name]
61
+ @configuration.non_modifiable_fields = configuration[:non_modifiable_fields]
62
+ @configuration.all_fields = {}
63
+ @configuration.translations = {}
64
+ @offset = ''
65
+ @limit = ''
66
+ self
67
+ end
68
+
35
69
  ##
36
70
  # Limits the found record set.
37
71
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophonius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4.9
4
+ version: 1.2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kempen Automatisering