sunstone 5.0.1.1 → 5.0.1.2

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
  SHA1:
3
- metadata.gz: 4d326ed16db84dece1b634834bc98d09d0cdf2fe
4
- data.tar.gz: d9ec597f5d530771eab3a92c4906282e8a9f1e38
3
+ metadata.gz: 454da86f331a53ed74c20c70a5e547d546adbf0a
4
+ data.tar.gz: b81a5734becd77136419a8816ef967624a20e9d1
5
5
  SHA512:
6
- metadata.gz: 65900429cd0dd1c1915e6ea3475c602042f80fb3f820f865fd6cd0938e487a4025e8b6b298c2df5819cf28aaa91c7b70929ff590a406d3058937821794f0a2e9
7
- data.tar.gz: 58aae239db789870bfdfc7d499ff3a32d45d4bac5b84a59b89c3242ca7dc0839af5df5d5e14b8f0f469e520976ad8e57713f961f0dc2fc2e392719bd8cce2ef9
6
+ metadata.gz: 563a3adbdd5e54577d7c69c621ad1d7122074faeae048973bf42e75bceae0a4cae0f640a4246964a05723b1b193644928cecfdcab4cc7206ad894868cad60d73
7
+ data.tar.gz: 62b6bd0e38e0f758bc72b9d5e6bbf381a3127a8a04ea4c58842d21ee8dabc4a6f1160cc8d630363dc551b3a4254820bc0090a5ea8bed7137cd7f404975e170c7
@@ -20,11 +20,18 @@ module ActiveRecord
20
20
  end
21
21
 
22
22
  def definition(table_name)
23
+ # TODO move @definitions to using @schema_cache
24
+ @definitions = {} if !defined?(@definitions)
25
+
26
+ if @definitions[table_name]
27
+ return @definitions[table_name]
28
+ end
29
+
23
30
  response = @connection.get("/#{table_name}/schema")
24
31
 
25
32
  version = Gem::Version.create(response['StandardAPI-Version'] || '5.0.0.4')
26
33
 
27
- if (version >= Gem::Version.create('5.0.0.5'))
34
+ @definitions[table_name] = if (version >= Gem::Version.create('5.0.0.5'))
28
35
  JSON.parse(response.body)
29
36
  else
30
37
  { 'columns' => JSON.parse(response.body), 'limit' => nil }
@@ -71,6 +71,11 @@ module ActiveRecord
71
71
  false
72
72
  end
73
73
 
74
+ def clear_cache!
75
+ # TODO move @definitions to using @schema_cache
76
+ @definitions = {}
77
+ end
78
+
74
79
  # Initializes and connects a SunstoneAPI adapter.
75
80
  def initialize(connection, logger, connection_parameters, config)
76
81
  super(connection, logger, config)
@@ -1,3 +1,3 @@
1
1
  module Sunstone
2
- VERSION = '5.0.1.1'
2
+ VERSION = '5.0.1.2'
3
3
  end
@@ -142,7 +142,7 @@ class ActiveRecord::PersistanceTest < Minitest::Test
142
142
  webmock(:get, "/sailors", where: {id: 1}, limit: 1).to_return(
143
143
  body: [{id: 1, name: 'Captain'}].to_json
144
144
  )
145
- webmock(:get, "/sailors", where: {sailors_ships: {ship_id: {eq: 1}}}).to_return(
145
+ webmock(:get, "/sailors", where: {sailors_ships: {ship_id: {eq: 1}}}, limit: 100, offset: 0).to_return(
146
146
  body: [].to_json
147
147
  )
148
148
  req_stub = webmock(:patch, '/ships/1').with(
@@ -163,7 +163,7 @@ class ActiveRecord::PersistanceTest < Minitest::Test
163
163
  webmock(:get, "/sailors", where: {id: 1}, limit: 1).to_return(
164
164
  body: [{id: 1, name: 'Captain'}].to_json
165
165
  )
166
- webmock(:get, "/sailors", where: {sailors_ships: {ship_id: {eq: 1}}}).to_return(
166
+ webmock(:get, "/sailors", where: {sailors_ships: {ship_id: {eq: 1}}}, limit: 100, offset: 0).to_return(
167
167
  body: [{id: 1, name: 'Captain'}].to_json
168
168
  )
169
169
  req_stub = webmock(:patch, '/ships/1').with(
@@ -181,7 +181,7 @@ class ActiveRecord::PersistanceTest < Minitest::Test
181
181
  webmock(:get, "/fleets", where: {id: 1}, limit: 1).to_return(
182
182
  body: [{id: 1, name: 'Armada Uno'}].to_json
183
183
  )
184
- webmock(:get, "/ships", where: {fleet_id: 1}).to_return(
184
+ webmock(:get, "/ships", where: {fleet_id: 1}, limit: 100, offset: 0).to_return(
185
185
  body: [{id: 1, name: 'Saucer Trio'}].to_json
186
186
  )
187
187
  req_stub = webmock(:patch, '/fleets/1').with(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1.1
4
+ version: 5.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-19 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake