trophonius 1.4.2.2 → 1.4.3.4
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.rb +1 -0
 - data/lib/trophonius_connection.rb +6 -3
 - data/lib/trophonius_date.rb +4 -0
 - data/lib/trophonius_model.rb +14 -8
 - data/lib/trophonius_query.rb +4 -3
 - data/lib/trophonius_record.rb +20 -7
 - data/lib/trophonius_request.rb +9 -5
 - data/lib/trophonius_single.rb +11 -6
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4d52cbe0f01bc7cb86fdd330790404ecf956631db54c0997b00a2418dfe681d9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e8f4d3da5dc60152dcd9ea8e88d6b6511b6bb62fc197158d4eadc63b3596fbf7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 97fbbbeacba35f6bd111a4ab3ec424954aa3e75a344f0afe508da30f2ec58b8ec5ed23e5be9bfb5051661d101edc13f99e65ae81b395766a6ca4ee584d4b6cc6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b80e60772da1d002dd648852231adff14195087ba96d4551095446e129e128073a9d54ecad69602ab47e66381e50954064f8f066b9a9fd81be2fdcfffde84073
         
     | 
    
        data/lib/trophonius.rb
    CHANGED
    
    
| 
         @@ -36,9 +36,10 @@ module Trophonius 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  end
         
     | 
| 
       37 
37 
     | 
    
         
             
                  ssl_verifyhost = Trophonius.config.local_network ? 0 : 2
         
     | 
| 
       38 
38 
     | 
    
         
             
                  ssl_verifypeer = !Trophonius.config.local_network
         
     | 
| 
      
 39 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       39 
40 
     | 
    
         
             
                  url =
         
     | 
| 
       40 
41 
     | 
    
         
             
                    URI(
         
     | 
| 
       41 
     | 
    
         
            -
                       
     | 
| 
      
 42 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       42 
43 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{Trophonius.config.database}/sessions"
         
     | 
| 
       43 
44 
     | 
    
         
             
                      )
         
     | 
| 
       44 
45 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -83,9 +84,10 @@ module Trophonius 
     | 
|
| 
       83 
84 
     | 
    
         
             
                # Disconnects from the FileMaker server
         
     | 
| 
       84 
85 
     | 
    
         
             
                #
         
     | 
| 
       85 
86 
     | 
    
         
             
                def self.disconnect
         
     | 
| 
      
 87 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       86 
88 
     | 
    
         
             
                  url =
         
     | 
| 
       87 
89 
     | 
    
         
             
                    URI(
         
     | 
| 
       88 
     | 
    
         
            -
                       
     | 
| 
      
 90 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       89 
91 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       90 
92 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       91 
93 
     | 
    
         
             
                        }/sessions/#{Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'token') : @token}"
         
     | 
| 
         @@ -137,9 +139,10 @@ module Trophonius 
     | 
|
| 
       137 
139 
     | 
    
         
             
                # Tests whether the FileMaker token is still valid
         
     | 
| 
       138 
140 
     | 
    
         
             
                # @return [Boolean] True if the token is valid False if invalid
         
     | 
| 
       139 
141 
     | 
    
         
             
                def self.test_connection
         
     | 
| 
      
 142 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       140 
143 
     | 
    
         
             
                  url =
         
     | 
| 
       141 
144 
     | 
    
         
             
                    URI(
         
     | 
| 
       142 
     | 
    
         
            -
                       
     | 
| 
      
 145 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       143 
146 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       144 
147 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       145 
148 
     | 
    
         
             
                        }/layouts/#{Trophonius.config.layout_name}/records?_limit=1"
         
     | 
    
        data/lib/trophonius_date.rb
    CHANGED
    
    
    
        data/lib/trophonius_model.rb
    CHANGED
    
    | 
         @@ -176,9 +176,10 @@ module Trophonius 
     | 
|
| 
       176 
176 
     | 
    
         
             
                # @return [Record] the created record
         
     | 
| 
       177 
177 
     | 
    
         
             
                #   Model.create(fieldOne: "Data")
         
     | 
| 
       178 
178 
     | 
    
         
             
                def self.create(fieldData, portalData: {})
         
     | 
| 
      
 179 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       179 
180 
     | 
    
         
             
                  url =
         
     | 
| 
       180 
181 
     | 
    
         
             
                    URI(
         
     | 
| 
       181 
     | 
    
         
            -
                       
     | 
| 
      
 182 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       182 
183 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       183 
184 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       184 
185 
     | 
    
         
             
                        }/layouts/#{layout_name}/records"
         
     | 
| 
         @@ -229,7 +230,7 @@ module Trophonius 
     | 
|
| 
       229 
230 
     | 
    
         
             
                  else
         
     | 
| 
       230 
231 
     | 
    
         
             
                    url =
         
     | 
| 
       231 
232 
     | 
    
         
             
                      URI(
         
     | 
| 
       232 
     | 
    
         
            -
                         
     | 
| 
      
 233 
     | 
    
         
            +
                        uri.escape(
         
     | 
| 
       233 
234 
     | 
    
         
             
                          "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       234 
235 
     | 
    
         
             
                            Trophonius.config.database
         
     | 
| 
       235 
236 
     | 
    
         
             
                          }/layouts/#{layout_name}/records/#{response['response']['recordId']}"
         
     | 
| 
         @@ -249,9 +250,10 @@ module Trophonius 
     | 
|
| 
       249 
250 
     | 
    
         
             
                # @return [Record] a Record object that correspond to FileMaker record fitting the find request
         
     | 
| 
       250 
251 
     | 
    
         
             
                #   Model.find_by(fieldOne: "Data")
         
     | 
| 
       251 
252 
     | 
    
         
             
                def self.find_by(fieldData)
         
     | 
| 
      
 253 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       252 
254 
     | 
    
         
             
                  url =
         
     | 
| 
       253 
255 
     | 
    
         
             
                    URI(
         
     | 
| 
       254 
     | 
    
         
            -
                       
     | 
| 
      
 256 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       255 
257 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       256 
258 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       257 
259 
     | 
    
         
             
                        }/layouts/#{self.layout_name}/_find?_limit=1"
         
     | 
| 
         @@ -292,9 +294,10 @@ module Trophonius 
     | 
|
| 
       292 
294 
     | 
    
         
             
                #
         
     | 
| 
       293 
295 
     | 
    
         
             
                # @return [Record] the record
         
     | 
| 
       294 
296 
     | 
    
         
             
                def self.find(record_id)
         
     | 
| 
      
 297 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       295 
298 
     | 
    
         
             
                  url =
         
     | 
| 
       296 
299 
     | 
    
         
             
                    URI(
         
     | 
| 
       297 
     | 
    
         
            -
                       
     | 
| 
      
 300 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       298 
301 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       299 
302 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       300 
303 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -317,9 +320,10 @@ module Trophonius 
     | 
|
| 
       317 
320 
     | 
    
         
             
                #
         
     | 
| 
       318 
321 
     | 
    
         
             
                # @return [Boolean] True if the delete was successful
         
     | 
| 
       319 
322 
     | 
    
         
             
                def self.delete(record_id)
         
     | 
| 
      
 323 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       320 
324 
     | 
    
         
             
                  url =
         
     | 
| 
       321 
325 
     | 
    
         
             
                    URI(
         
     | 
| 
       322 
     | 
    
         
            -
                       
     | 
| 
      
 326 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       323 
327 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       324 
328 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       325 
329 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -342,9 +346,10 @@ module Trophonius 
     | 
|
| 
       342 
346 
     | 
    
         
             
                #
         
     | 
| 
       343 
347 
     | 
    
         
             
                # @return [Boolean] True if the delete was successful
         
     | 
| 
       344 
348 
     | 
    
         
             
                def self.edit(record_id, fieldData)
         
     | 
| 
      
 349 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       345 
350 
     | 
    
         
             
                  url =
         
     | 
| 
       346 
351 
     | 
    
         
             
                    URI(
         
     | 
| 
       347 
     | 
    
         
            -
                       
     | 
| 
      
 352 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       348 
353 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       349 
354 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       350 
355 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -466,12 +471,13 @@ module Trophonius 
     | 
|
| 
       466 
471 
     | 
    
         
             
                #
         
     | 
| 
       467 
472 
     | 
    
         
             
                # @return [RecordSet]: a RecordSet containing all the Record objects that correspond to the FileMaker records.
         
     | 
| 
       468 
473 
     | 
    
         
             
                def self.all(sort: {})
         
     | 
| 
      
 474 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       469 
475 
     | 
    
         
             
                  results = Request.retrieve_all(layout_name, sort)
         
     | 
| 
       470 
476 
     | 
    
         
             
                  count = results['response']['scriptResult'].to_i
         
     | 
| 
       471 
477 
     | 
    
         
             
                  unless @limit.empty? || @offset.empty?
         
     | 
| 
       472 
478 
     | 
    
         
             
                    url =
         
     | 
| 
       473 
479 
     | 
    
         
             
                      URI(
         
     | 
| 
       474 
     | 
    
         
            -
                         
     | 
| 
      
 480 
     | 
    
         
            +
                        uri.escape(
         
     | 
| 
       475 
481 
     | 
    
         
             
                          "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       476 
482 
     | 
    
         
             
                            Trophonius.config.database
         
     | 
| 
       477 
483 
     | 
    
         
             
                          }/layouts/#{layout_name}/records?_offset=#{@offset}&_limit=#{@limit}"
         
     | 
| 
         @@ -480,7 +486,7 @@ module Trophonius 
     | 
|
| 
       480 
486 
     | 
    
         
             
                  else
         
     | 
| 
       481 
487 
     | 
    
         
             
                    url =
         
     | 
| 
       482 
488 
     | 
    
         
             
                      URI(
         
     | 
| 
       483 
     | 
    
         
            -
                         
     | 
| 
      
 489 
     | 
    
         
            +
                        uri.escape(
         
     | 
| 
       484 
490 
     | 
    
         
             
                          "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       485 
491 
     | 
    
         
             
                            Trophonius.config.database
         
     | 
| 
       486 
492 
     | 
    
         
             
                          }/layouts/#{layout_name}/records?_limit=#{count == 0 ? 1_000_000 : count}"
         
     | 
    
        data/lib/trophonius_query.rb
    CHANGED
    
    | 
         @@ -184,9 +184,10 @@ module Trophonius 
     | 
|
| 
       184 
184 
     | 
    
         
             
                #
         
     | 
| 
       185 
185 
     | 
    
         
             
                # @return Response of the called method
         
     | 
| 
       186 
186 
     | 
    
         
             
                def run_query(method, *args, &block)
         
     | 
| 
      
 187 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       187 
188 
     | 
    
         
             
                  url =
         
     | 
| 
       188 
189 
     | 
    
         
             
                    URI(
         
     | 
| 
       189 
     | 
    
         
            -
                       
     | 
| 
      
 190 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       190 
191 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       191 
192 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       192 
193 
     | 
    
         
             
                        }/layouts/#{@trophonius_model.layout_name}/_find"
         
     | 
| 
         @@ -221,12 +222,12 @@ module Trophonius 
     | 
|
| 
       221 
222 
     | 
    
         
             
                  end
         
     | 
| 
       222 
223 
     | 
    
         | 
| 
       223 
224 
     | 
    
         
             
                  if @prerequest_script.present?
         
     | 
| 
       224 
     | 
    
         
            -
                    body.merge!(script 
     | 
| 
      
 225 
     | 
    
         
            +
                    body.merge!("script.prerequest" => @prerequest_script)
         
     | 
| 
       225 
226 
     | 
    
         
             
                    body.merge!('script.prerequest.param' => @prerequest_scriptparam) if @prerequest_scriptparam.present?
         
     | 
| 
       226 
227 
     | 
    
         
             
                  end
         
     | 
| 
       227 
228 
     | 
    
         | 
| 
       228 
229 
     | 
    
         
             
                  if @presort_script.present?
         
     | 
| 
       229 
     | 
    
         
            -
                    body.merge!(script 
     | 
| 
      
 230 
     | 
    
         
            +
                    body.merge!("script.presort" => @presort_script)
         
     | 
| 
       230 
231 
     | 
    
         
             
                    body.merge!('script.presort.param' => @presort_scriptparam) if @presort_scriptparam.present?
         
     | 
| 
       231 
232 
     | 
    
         
             
                  end
         
     | 
| 
       232 
233 
     | 
    
         | 
    
        data/lib/trophonius_record.rb
    CHANGED
    
    | 
         @@ -32,9 +32,10 @@ module Trophonius 
     | 
|
| 
       32 
32 
     | 
    
         
             
                      layout = model.layout_name
         
     | 
| 
       33 
33 
     | 
    
         
             
                      model.create_translations if model.translations.keys.empty?
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
      
 35 
     | 
    
         
            +
                      uri = URI::RFC2396_Parser.new
         
     | 
| 
       35 
36 
     | 
    
         
             
                      url =
         
     | 
| 
       36 
37 
     | 
    
         
             
                        URI(
         
     | 
| 
       37 
     | 
    
         
            -
                           
     | 
| 
      
 38 
     | 
    
         
            +
                          uri.escape(
         
     | 
| 
       38 
39 
     | 
    
         
             
                            "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       39 
40 
     | 
    
         
             
                              Trophonius.config.database
         
     | 
| 
       40 
41 
     | 
    
         
             
                            }/layouts/#{layout}/_find"
         
     | 
| 
         @@ -94,9 +95,10 @@ module Trophonius 
     | 
|
| 
       94 
95 
     | 
    
         
             
                      layout = pk_model.layout_name
         
     | 
| 
       95 
96 
     | 
    
         
             
                      pk_model.create_translations if pk_model.translations.keys.empty?
         
     | 
| 
       96 
97 
     | 
    
         | 
| 
      
 98 
     | 
    
         
            +
                      uri = URI::RFC2396_Parser.new
         
     | 
| 
       97 
99 
     | 
    
         
             
                      url =
         
     | 
| 
       98 
100 
     | 
    
         
             
                        URI(
         
     | 
| 
       99 
     | 
    
         
            -
                           
     | 
| 
      
 101 
     | 
    
         
            +
                          uri.escape(
         
     | 
| 
       100 
102 
     | 
    
         
             
                            "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       101 
103 
     | 
    
         
             
                              Trophonius.config.database
         
     | 
| 
       102 
104 
     | 
    
         
             
                            }/layouts/#{layout}/_find"
         
     | 
| 
         @@ -150,6 +152,12 @@ module Trophonius 
     | 
|
| 
       150 
152 
     | 
    
         
             
                  else
         
     | 
| 
       151 
153 
     | 
    
         
             
                    super
         
     | 
| 
       152 
154 
     | 
    
         
             
                  end
         
     | 
| 
      
 155 
     | 
    
         
            +
                rescue NameError => e
         
     | 
| 
      
 156 
     | 
    
         
            +
                  if e.message.include?('constant')
         
     | 
| 
      
 157 
     | 
    
         
            +
                    Error.throw_error('102', e.message.split(' ')[-1], layout_name)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  else
         
     | 
| 
      
 159 
     | 
    
         
            +
                    raise e
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
       153 
161 
     | 
    
         
             
                end
         
     | 
| 
       154 
162 
     | 
    
         | 
| 
       155 
163 
     | 
    
         
             
                ##
         
     | 
| 
         @@ -161,9 +169,10 @@ module Trophonius 
     | 
|
| 
       161 
169 
     | 
    
         
             
                #
         
     | 
| 
       162 
170 
     | 
    
         
             
                # @return [String]: string representing the script result returned by FileMaker
         
     | 
| 
       163 
171 
     | 
    
         
             
                def run_script(script: '', scriptparameter: '')
         
     | 
| 
      
 172 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       164 
173 
     | 
    
         
             
                  url =
         
     | 
| 
       165 
174 
     | 
    
         
             
                    URI(
         
     | 
| 
       166 
     | 
    
         
            -
                       
     | 
| 
      
 175 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       167 
176 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       168 
177 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       169 
178 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}?script=#{script}&script.param=#{scriptparameter}"
         
     | 
| 
         @@ -188,9 +197,10 @@ module Trophonius 
     | 
|
| 
       188 
197 
     | 
    
         
             
                #
         
     | 
| 
       189 
198 
     | 
    
         
             
                # @return [True] if successful
         
     | 
| 
       190 
199 
     | 
    
         
             
                def save
         
     | 
| 
      
 200 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       191 
201 
     | 
    
         
             
                  url =
         
     | 
| 
       192 
202 
     | 
    
         
             
                    URI(
         
     | 
| 
       193 
     | 
    
         
            -
                       
     | 
| 
      
 203 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       194 
204 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       195 
205 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       196 
206 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -207,9 +217,10 @@ module Trophonius 
     | 
|
| 
       207 
217 
     | 
    
         
             
                #
         
     | 
| 
       208 
218 
     | 
    
         
             
                # @return [True] if successful
         
     | 
| 
       209 
219 
     | 
    
         
             
                def delete
         
     | 
| 
      
 220 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       210 
221 
     | 
    
         
             
                  url =
         
     | 
| 
       211 
222 
     | 
    
         
             
                    URI(
         
     | 
| 
       212 
     | 
    
         
            -
                       
     | 
| 
      
 223 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       213 
224 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       214 
225 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       215 
226 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -227,9 +238,10 @@ module Trophonius 
     | 
|
| 
       227 
238 
     | 
    
         
             
                #
         
     | 
| 
       228 
239 
     | 
    
         
             
                # @return [True] if successful
         
     | 
| 
       229 
240 
     | 
    
         
             
                def update(fieldData)
         
     | 
| 
      
 241 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       230 
242 
     | 
    
         
             
                  url =
         
     | 
| 
       231 
243 
     | 
    
         
             
                    URI(
         
     | 
| 
       232 
     | 
    
         
            -
                       
     | 
| 
      
 244 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       233 
245 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       234 
246 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       235 
247 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}"
         
     | 
| 
         @@ -265,9 +277,10 @@ module Trophonius 
     | 
|
| 
       265 
277 
     | 
    
         
             
                #
         
     | 
| 
       266 
278 
     | 
    
         
             
                # @return [True] if successful
         
     | 
| 
       267 
279 
     | 
    
         
             
                def upload(container_name:, container_repetition: 1, file:)
         
     | 
| 
      
 280 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       268 
281 
     | 
    
         
             
                  url =
         
     | 
| 
       269 
282 
     | 
    
         
             
                    URI(
         
     | 
| 
       270 
     | 
    
         
            -
                       
     | 
| 
      
 283 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       271 
284 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       272 
285 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       273 
286 
     | 
    
         
             
                        }/layouts/#{layout_name}/records/#{record_id}/containers/#{container_name}/#{container_repetition}"
         
     | 
    
        data/lib/trophonius_request.rb
    CHANGED
    
    | 
         @@ -83,9 +83,10 @@ module Trophonius 
     | 
|
| 
       83 
83 
     | 
    
         
             
                #
         
     | 
| 
       84 
84 
     | 
    
         
             
                # @return [JSON] The first record from FileMaker
         
     | 
| 
       85 
85 
     | 
    
         
             
                def self.retrieve_first(layout_name)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       86 
87 
     | 
    
         
             
                  url =
         
     | 
| 
       87 
88 
     | 
    
         
             
                    URI(
         
     | 
| 
       88 
     | 
    
         
            -
                       
     | 
| 
      
 89 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       89 
90 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       90 
91 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       91 
92 
     | 
    
         
             
                        }/layouts/#{layout_name}/records?_limit=1"
         
     | 
| 
         @@ -99,9 +100,10 @@ module Trophonius 
     | 
|
| 
       99 
100 
     | 
    
         
             
                #
         
     | 
| 
       100 
101 
     | 
    
         
             
                # @return [JSON] The fieldnames of a layout
         
     | 
| 
       101 
102 
     | 
    
         
             
                def self.get_layout_field_names(layout_name)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       102 
104 
     | 
    
         
             
                  url =
         
     | 
| 
       103 
105 
     | 
    
         
             
                    URI(
         
     | 
| 
       104 
     | 
    
         
            -
                       
     | 
| 
      
 106 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       105 
107 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       106 
108 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       107 
109 
     | 
    
         
             
                        }/layouts/#{layout_name}"
         
     | 
| 
         @@ -119,9 +121,10 @@ module Trophonius 
     | 
|
| 
       119 
121 
     | 
    
         
             
                #
         
     | 
| 
       120 
122 
     | 
    
         
             
                # @return [JSON] The script result from FileMaker
         
     | 
| 
       121 
123 
     | 
    
         
             
                def self.run_script(script, scriptparameter, layout_name)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       122 
125 
     | 
    
         
             
                  url =
         
     | 
| 
       123 
126 
     | 
    
         
             
                    URI(
         
     | 
| 
       124 
     | 
    
         
            -
                       
     | 
| 
      
 127 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       125 
128 
     | 
    
         
             
                        "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       126 
129 
     | 
    
         
             
                          Trophonius.config.database
         
     | 
| 
       127 
130 
     | 
    
         
             
                        }/layouts/#{layout_name}/records?_limit=1&script=#{script}&script.param=#{scriptparameter}"
         
     | 
| 
         @@ -135,11 +138,12 @@ module Trophonius 
     | 
|
| 
       135 
138 
     | 
    
         
             
                #
         
     | 
| 
       136 
139 
     | 
    
         
             
                # @return [JSON] The first 10000000 records from FileMaker
         
     | 
| 
       137 
140 
     | 
    
         
             
                def self.retrieve_all(layout_name, sort)
         
     | 
| 
      
 141 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       138 
142 
     | 
    
         
             
                  if !sort.empty?
         
     | 
| 
       139 
143 
     | 
    
         
             
                    sort_order = sort.to_json.to_s
         
     | 
| 
       140 
144 
     | 
    
         
             
                    url =
         
     | 
| 
       141 
145 
     | 
    
         
             
                      URI(
         
     | 
| 
       142 
     | 
    
         
            -
                         
     | 
| 
      
 146 
     | 
    
         
            +
                        uri.escape(
         
     | 
| 
       143 
147 
     | 
    
         
             
                          "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       144 
148 
     | 
    
         
             
                            Trophonius.config.database
         
     | 
| 
       145 
149 
     | 
    
         
             
                          }/layouts/#{layout_name}/records?_limit=10000000_sort=#{sort_order}#{
         
     | 
| 
         @@ -150,7 +154,7 @@ module Trophonius 
     | 
|
| 
       150 
154 
     | 
    
         
             
                  else
         
     | 
| 
       151 
155 
     | 
    
         
             
                    url =
         
     | 
| 
       152 
156 
     | 
    
         
             
                      URI(
         
     | 
| 
       153 
     | 
    
         
            -
                         
     | 
| 
      
 157 
     | 
    
         
            +
                        uri.escape(
         
     | 
| 
       154 
158 
     | 
    
         
             
                          "http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{
         
     | 
| 
       155 
159 
     | 
    
         
             
                            Trophonius.config.database
         
     | 
| 
       156 
160 
     | 
    
         
             
                          }/layouts/#{layout_name}/records?_limit=10000000#{
         
     | 
    
        data/lib/trophonius_single.rb
    CHANGED
    
    | 
         @@ -15,9 +15,10 @@ module Trophonius 
     | 
|
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def where(fieldData)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       18 
19 
     | 
    
         
             
                  url =
         
     | 
| 
       19 
20 
     | 
    
         
             
                    URI(
         
     | 
| 
       20 
     | 
    
         
            -
                       
     | 
| 
      
 21 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       21 
22 
     | 
    
         
             
                        "http#{@config[:ssl] == true ? 's' : ''}://#{@config[:host]}/fmi/data/v1/databases/#{@config[:database]}/layouts/#{
         
     | 
| 
       22 
23 
     | 
    
         
             
                          @config[:layout_name]
         
     | 
| 
       23 
24 
     | 
    
         
             
                        }/_find"
         
     | 
| 
         @@ -49,9 +50,10 @@ module Trophonius 
     | 
|
| 
       49 
50 
     | 
    
         
             
                end
         
     | 
| 
       50 
51 
     | 
    
         | 
| 
       51 
52 
     | 
    
         
             
                def first
         
     | 
| 
      
 53 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       52 
54 
     | 
    
         
             
                  url =
         
     | 
| 
       53 
55 
     | 
    
         
             
                    URI(
         
     | 
| 
       54 
     | 
    
         
            -
                       
     | 
| 
      
 56 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       55 
57 
     | 
    
         
             
                        "http#{@config[:ssl] == true ? 's' : ''}://#{@config[:host]}/fmi/data/v1/databases/#{@config[:database]}/layouts/#{
         
     | 
| 
       56 
58 
     | 
    
         
             
                          @config[:layout_name]
         
     | 
| 
       57 
59 
     | 
    
         
             
                        }/records?_limit=1"
         
     | 
| 
         @@ -81,9 +83,10 @@ module Trophonius 
     | 
|
| 
       81 
83 
     | 
    
         
             
                end
         
     | 
| 
       82 
84 
     | 
    
         | 
| 
       83 
85 
     | 
    
         
             
                def run_script(script:, scriptparameter:)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       84 
87 
     | 
    
         
             
                  url =
         
     | 
| 
       85 
88 
     | 
    
         
             
                    URI(
         
     | 
| 
       86 
     | 
    
         
            -
                       
     | 
| 
      
 89 
     | 
    
         
            +
                      uri.escape(
         
     | 
| 
       87 
90 
     | 
    
         
             
                        "http#{@config[:ssl] == true ? 's' : ''}://#{@config[:host]}/fmi/data/v1/databases/#{@config[:database]}/layouts/#{
         
     | 
| 
       88 
91 
     | 
    
         
             
                          @config[:layout_name]
         
     | 
| 
       89 
92 
     | 
    
         
             
                        }/records?_limit=1&script=#{script}&script.param=#{scriptparameter}"
         
     | 
| 
         @@ -91,7 +94,7 @@ module Trophonius 
     | 
|
| 
       91 
94 
     | 
    
         
             
                    )
         
     | 
| 
       92 
95 
     | 
    
         | 
| 
       93 
96 
     | 
    
         
             
                  token = setup_connection
         
     | 
| 
       94 
     | 
    
         
            -
                  result = make_request(url, " 
     | 
| 
      
 97 
     | 
    
         
            +
                  result = make_request(url, "#{token}", 'get', '{}')
         
     | 
| 
       95 
98 
     | 
    
         
             
                  ret_val = ''
         
     | 
| 
       96 
99 
     | 
    
         | 
| 
       97 
100 
     | 
    
         
             
                  if result['messages'][0]['code'] != '0'
         
     | 
| 
         @@ -189,7 +192,8 @@ module Trophonius 
     | 
|
| 
       189 
192 
     | 
    
         
             
                def setup_connection
         
     | 
| 
       190 
193 
     | 
    
         
             
                  ssl_verifyhost = @config[:local_network] ? 0 : 2
         
     | 
| 
       191 
194 
     | 
    
         
             
                  ssl_verifypeer = !@config[:local_network]
         
     | 
| 
       192 
     | 
    
         
            -
                   
     | 
| 
      
 195 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
      
 196 
     | 
    
         
            +
                  url = URI(uri.escape("http#{@config[:ssl] == true ? 's' : ''}://#{@config[:host]}/fmi/data/v1/databases/#{@config[:database]}/sessions"))
         
     | 
| 
       193 
197 
     | 
    
         
             
                  request =
         
     | 
| 
       194 
198 
     | 
    
         
             
                    Typhoeus::Request.new(
         
     | 
| 
       195 
199 
     | 
    
         
             
                      url,
         
     | 
| 
         @@ -220,8 +224,9 @@ module Trophonius 
     | 
|
| 
       220 
224 
     | 
    
         
             
                end
         
     | 
| 
       221 
225 
     | 
    
         | 
| 
       222 
226 
     | 
    
         
             
                def close_connection(token)
         
     | 
| 
      
 227 
     | 
    
         
            +
                  uri = URI::RFC2396_Parser.new
         
     | 
| 
       223 
228 
     | 
    
         
             
                  url =
         
     | 
| 
       224 
     | 
    
         
            -
                    URI( 
     | 
| 
      
 229 
     | 
    
         
            +
                    URI(uri.escape("http#{@config[:ssl] == true ? 's' : ''}://#{@config[:host]}/fmi/data/v1/databases/#{@config[:database]}/sessions/#{token}"))
         
     | 
| 
       225 
230 
     | 
    
         
             
                  ssl_verifyhost = @config[:local_network] ? 0 : 2
         
     | 
| 
       226 
231 
     | 
    
         
             
                  ssl_verifypeer = !@config[:local_network]
         
     | 
| 
       227 
232 
     | 
    
         | 
    
        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.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.4.3.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kempen Automatisering
         
     | 
| 
         @@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       94 
94 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       95 
95 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       96 
96 
     | 
    
         
             
            requirements: []
         
     | 
| 
       97 
     | 
    
         
            -
            rubygems_version: 3.0. 
     | 
| 
      
 97 
     | 
    
         
            +
            rubygems_version: 3.0.9
         
     | 
| 
       98 
98 
     | 
    
         
             
            signing_key:
         
     | 
| 
       99 
99 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       100 
100 
     | 
    
         
             
            summary: Link between Ruby (on Rails) and FileMaker.
         
     |