trophonius 1.2.4 → 1.2.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a314aa079b0dc7fca08f9796cfed19723f93006d2fef258b59517e9b20dd8c7a
4
- data.tar.gz: f75dccd8b89ef66f69f15289f41e0389d946a9c25a96fdc7a19391eb296aa19f
3
+ metadata.gz: ec0214fb6fc5a8cd1fd4d994cb7c5fee184a682199b5adf0120dd385cb31766d
4
+ data.tar.gz: 44ac6914a04de0e5662c38359073bad47b0db6033241b332ce54185c7149ab30
5
5
  SHA512:
6
- metadata.gz: 88e13826eb573c46ad06bc4b6eb63a23769231a5a1134820b3b3a5c6e8ca208a5c7c95756eaf549d5a8c4e44e6be5f5a1fa2a3fdec86b3d80cdc60fab34c237b
7
- data.tar.gz: cde2425883080994637eda7c571f3bfa4196c65118d798630e55bc1b7108d45a74a37dafe8f23dc7906becae35bcd39b36635ea4459fa125316655df8d0807b2
6
+ metadata.gz: 97a534c6e3453bdfbfa134af4dae74713537f035a4f45bc2a71ae7b9e54197feecdbcb812024e203a02772f177e3b61cc93ca377b74b97f25be61da7640c6b03
7
+ data.tar.gz: 8acb6b48dc37c6834c6b26e1abbdf135a8693b499dac8deddec8e17f365d43fd9e9f4759c6d11872723eea7e311d1cf3d1254ab460da75eaa74594ce02697422
@@ -70,18 +70,17 @@ module Trophonius
70
70
 
71
71
  begin
72
72
  parsed = JSON.parse(temp.response_body)
73
- Error.throw_error(response['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
74
- return parsed['response']['token']
75
73
  rescue Exception => e
76
74
  Error.throw_error('1631')
77
75
  end
76
+ Error.throw_error(parsed['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
77
+ return parsed['response']['token']
78
78
  end
79
79
 
80
80
  ##
81
81
  # Returns the last received token
82
82
  # @return [String] the last valid *token* used to connect with the FileMaker data api
83
83
  def self.token
84
- token = Trophonius::RedisManager.get_key(key: 'token')
85
84
  return Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'token') : @token
86
85
  end
87
86
 
@@ -89,7 +88,7 @@ module Trophonius
89
88
  # Returns the receive time of the last received token
90
89
  # @return [Time] Returns the receive time of the last received token
91
90
  def self.last_connection
92
- last = Trophonius::RedisManager.get_key(key: 'last_connection')
91
+ last = Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'last_connection') : nil
93
92
  last = last.nil? ? nil : Time.parse(last)
94
93
  Trophonius.config.redis_connection ? last : @last_connection
95
94
  end
@@ -68,7 +68,7 @@ module Trophonius
68
68
  # @param [args] arguments containing the limit and offset
69
69
  # @return [Trophonius::Model] updated base model
70
70
  def paginate(args)
71
- @offset = args[0]
71
+ @offset = ((args[0] * args[1] - args[1]) + 1)
72
72
  @limit = args[1]
73
73
  args[2]
74
74
  end
@@ -136,8 +136,8 @@ module Trophonius
136
136
  response = Request.make_request(url, "Bearer #{Request.get_token}", 'post', body)
137
137
  if response['messages'][0]['code'] != '0'
138
138
  if response['messages'][0]['code'] == '101' || response['messages'][0]['code'] == '401'
139
- RecordSet.new(@trophonius_model.layout_name, @trophonius_model.non_modifiable_fields).send(method, *args, &block)
140
- return
139
+ resp = RecordSet.new(@trophonius_model.layout_name, @trophonius_model.non_modifiable_fields).send(method, *args, &block)
140
+ return resp
141
141
  else
142
142
  if response['messages'][0]['code'] == '102'
143
143
  results = Request.retrieve_first(@trophonius_model.layout_name)
@@ -2,10 +2,12 @@ module Trophonius
2
2
  # the RedisManager module is used to create a (single) connection to a redis store.
3
3
  module Trophonius::RedisManager
4
4
  def self.connect
5
- if ENV['REDIS_URL'] && ENV['REDIS_URL'] != ''
6
- @redis ||= Redis.new(url: ENV['REDIS_URL'])
7
- else
8
- @redis ||= Redis.new
5
+ if Trophonius.config.redis_connection
6
+ if ENV['REDIS_URL'] && ENV['REDIS_URL'] != ''
7
+ @redis ||= Redis.new(url: ENV['REDIS_URL'])
8
+ else
9
+ @redis ||= Redis.new
10
+ end
9
11
  end
10
12
  return nil
11
13
  end
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
4
+ version: 1.2.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kempen Automatisering
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.2'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 6.x
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '5.2'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 6.x
55
61
  description: An easy to use link between Ruby (on Rails) and FileMaker using the FileMaker
56
62
  Data-API.
57
63
  email: