ncore 3.9.0 → 3.10.0

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: b9823810517052d731b6290cf93b9bd942f25164aed98940860be7c37b7514b5
4
- data.tar.gz: 851945716245d8308d5b14a7fc17afb4207ea25f4dff049779ab8e9f2d1a5a3e
3
+ metadata.gz: 8d3767002c121b2ee51fc04e98f0d4ff597caca6bfd5a161b2b8464e70b1dae2
4
+ data.tar.gz: a6f6376c0ecb38f1a6eb448b017da394bb76381b5ce65e5c22aac837bdcd1ef9
5
5
  SHA512:
6
- metadata.gz: 02103dd4eb28433b6311192c37f727e31708a2d5b4ccd2c46888d13a661f6916c906dbd90ad42e03f00592ab6c267fd46d560c69636070a6ee7ddf50c4f4c037
7
- data.tar.gz: ee2d1391f5042222d448aebb3ef96f521eb535d3d0e1d23f6bb715bd2cf836f64d6d8a72527d95efd0af05a2881556111000acb5e65082fa8289f605a90ed51d
6
+ metadata.gz: 196ec89b26c7502db2fd80139ad02027f6b7d3fd6308d74084d3d58a1f62e3cc5e469de4892495828c871a09443c49d17c504e455af7181c30146802ace1496b
7
+ data.tar.gz: 5baf3bf3e7086457a6e56dd913707ce373ba13b008ad8734896c3d2df34072b9ea8bbd8f19f76557630b1e247bf246d350866220bdb5c4901e05de5a61e19edc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ #### 3.10.0
2
+
3
+ - Allow Api.default_url and Api.credentials to be lazy loaded
4
+ - Fix detection of missing credentials
5
+ - Clarify Ruby 2.7 as minimum in gemspec; for earlier Rubies, lock to < 3.9
6
+
7
+ #### 3.9.1
8
+
9
+ - Fix clearing of memoized association when assoc_id changes
10
+
1
11
  #### 3.9.0
2
12
 
3
13
  - Add inspection filter for attributes
@@ -222,9 +222,13 @@ module NCore
222
222
  end
223
223
  P1
224
224
 
225
+ # private def parent_id=(val)
226
+ # if :parent_key changes, clear memoized association
225
227
  class_eval <<-P2, __FILE__, __LINE__+1
226
228
  def #{parent_key}=(v)
227
- @attribs[:#{assoc_name}] = nil unless @attribs[:#{parent_key}] == v
229
+ if @attribs[:#{parent_key}] != v and @attribs[:#{assoc_name}]&.id != v
230
+ @attribs[:#{assoc_name}] = nil
231
+ end
228
232
  @attribs[:#{parent_key}] = v
229
233
  end
230
234
  private :#{parent_key}=
@@ -201,7 +201,7 @@ module NCore
201
201
  args[:data].each do |k,v|
202
202
  if k=='metadata' || k=='errors'
203
203
  @attribs[k] = self.class.interpret_type(v, api_creds)
204
- elsif respond_to?("#{k}=")
204
+ elsif respond_to?("#{k}=", true)
205
205
  send "#{k}=", self.class.interpret_type(v, api_creds)
206
206
  else
207
207
  @attribs[k] = self.class.interpret_type(v, api_creds)
data/lib/ncore/client.rb CHANGED
@@ -58,7 +58,7 @@ module NCore
58
58
  private
59
59
 
60
60
  def retrieve_credentials
61
- if credentials.blank?
61
+ if credentials.blank? || credentials.all?{|_,v| v.blank? }
62
62
  raise module_parent::Error, credentials_error_message
63
63
  end
64
64
  credentials
@@ -10,7 +10,17 @@ module NCore
10
10
  module ClassMethods
11
11
 
12
12
  def init_config_options
13
- mattr_accessor :default_url
13
+ mattr_writer :default_url
14
+ class_eval <<-MTH
15
+ def self.default_url
16
+ self.default_url = @@default_url.call if @@default_url.respond_to? :call
17
+ @@default_url
18
+ end
19
+ def default_url
20
+ self.default_url = @@default_url.call if @@default_url.respond_to? :call
21
+ @@default_url
22
+ end
23
+ MTH
14
24
  self.default_url = 'https://api.example.com/v1/'
15
25
 
16
26
  mattr_accessor :default_headers
@@ -20,7 +30,17 @@ module NCore
20
30
  user_agent: "NCore/ruby v#{VERSION}"
21
31
  }
22
32
 
23
- mattr_accessor :credentials
33
+ mattr_writer :credentials
34
+ class_eval <<-MTH
35
+ def self.credentials
36
+ self.credentials = @@credentials.call if @@credentials.respond_to? :call
37
+ @@credentials
38
+ end
39
+ def credentials
40
+ self.credentials = @@credentials.call if @@credentials.respond_to? :call
41
+ @@credentials
42
+ end
43
+ MTH
24
44
 
25
45
  mattr_accessor :debug
26
46
  self.debug = false
data/lib/ncore/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module NCore
2
- VERSION = '3.9.0'
2
+ VERSION = '3.10.0'
3
3
  end
data/ncore.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.required_ruby_version = '>= 2.7'
22
+
21
23
  spec.add_dependency 'activemodel', '>= 5.2', '< 7.2'
22
24
  spec.add_dependency 'excon', '~> 0.32'
23
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncore
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Notioneer Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-27 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -136,14 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: '0'
139
+ version: '2.7'
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.5.3
146
+ rubygems_version: 3.5.11
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: NCore - Gem for building REST API clients