ncore 2.3.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -23
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/example/lib/my_api/api_config.rb +8 -0
- data/example/lib/my_api/rails/railtie.rb +4 -0
- data/lib/ncore/associations.rb +13 -13
- data/lib/ncore/attributes.rb +34 -15
- data/lib/ncore/base.rb +5 -3
- data/lib/ncore/client.rb +35 -33
- data/lib/ncore/client_cache.rb +48 -0
- data/lib/ncore/configuration.rb +17 -25
- data/lib/ncore/exceptions.rb +7 -2
- data/lib/ncore/identity.rb +27 -0
- data/lib/ncore/lifecycle.rb +3 -3
- data/lib/ncore/methods/all.rb +3 -7
- data/lib/ncore/methods/build.rb +2 -2
- data/lib/ncore/methods/count.rb +1 -1
- data/lib/ncore/methods/create.rb +4 -5
- data/lib/ncore/methods/delete.rb +6 -7
- data/lib/ncore/methods/delete_bulk.rb +4 -4
- data/lib/ncore/methods/delete_single.rb +4 -5
- data/lib/ncore/methods/find.rb +5 -6
- data/lib/ncore/methods/find_single.rb +5 -9
- data/lib/ncore/methods/update.rb +6 -7
- data/lib/ncore/rails/active_model.rb +24 -14
- data/lib/ncore/rails/module_fix.rb +5 -3
- data/lib/ncore/singleton_base.rb +4 -3
- data/lib/ncore/ssl/ca-certificates.crt +3287 -0
- data/lib/ncore/util.rb +10 -2
- data/lib/ncore/version.rb +1 -1
- data/lib/ncore.rb +30 -3
- data/ncore.gemspec +1 -1
- metadata +13 -11
data/lib/ncore/util.rb
CHANGED
@@ -38,10 +38,18 @@ module NCore
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
def factory(parsed, api_creds)
|
42
|
+
if key = (parsed[:data] || parsed)[:object]
|
43
|
+
discover_class(key, self).new(parsed, api_creds)
|
44
|
+
else
|
45
|
+
new(parsed, api_creds)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
41
49
|
|
42
50
|
private
|
43
51
|
|
44
|
-
def discover_class(key, default_klass=
|
52
|
+
def discover_class(key, default_klass=module_parent::GenericObject)
|
45
53
|
klass_name = key.to_s.camelize.singularize
|
46
54
|
begin
|
47
55
|
"#{module_name}::#{klass_name}".constantize
|
@@ -54,7 +62,7 @@ module NCore
|
|
54
62
|
|
55
63
|
|
56
64
|
def inspect
|
57
|
-
"#<#{self.class}:0x#{self.object_id
|
65
|
+
"#<#{self.class}:0x#{'%016x'%self.object_id} id: #{id.inspect}, attribs: #{@attribs.except(:id).inspect}, metadata: #{metadata.inspect}>"
|
58
66
|
end
|
59
67
|
|
60
68
|
end
|
data/lib/ncore/version.rb
CHANGED
data/lib/ncore.rb
CHANGED
@@ -1,15 +1,42 @@
|
|
1
1
|
require 'active_support/all'
|
2
|
+
require 'active_model'
|
2
3
|
require 'excon'
|
3
4
|
require 'pp'
|
4
5
|
|
5
|
-
%w(
|
6
|
+
%w(
|
7
|
+
version
|
8
|
+
builder
|
9
|
+
configuration
|
10
|
+
associations
|
11
|
+
attributes
|
12
|
+
client
|
13
|
+
client_cache
|
14
|
+
collection
|
15
|
+
exceptions
|
16
|
+
identity
|
17
|
+
lifecycle
|
18
|
+
util
|
19
|
+
base
|
20
|
+
singleton_base
|
21
|
+
).each do |f|
|
6
22
|
require "ncore/#{f}"
|
7
23
|
end
|
8
24
|
|
9
|
-
%w(
|
25
|
+
%w(
|
26
|
+
all
|
27
|
+
build
|
28
|
+
count
|
29
|
+
create
|
30
|
+
delete
|
31
|
+
delete_bulk
|
32
|
+
delete_single
|
33
|
+
find
|
34
|
+
find_single
|
35
|
+
update
|
36
|
+
).each do |f|
|
10
37
|
require "ncore/methods/#{f}"
|
11
38
|
end
|
12
39
|
|
13
40
|
require 'ncore/rails/action_controller' if defined?(::ActionController)
|
14
|
-
require 'ncore/rails/active_model'
|
41
|
+
require 'ncore/rails/active_model'
|
15
42
|
require 'ncore/rails/module_fix'
|
data/ncore.gemspec
CHANGED
@@ -18,7 +18,7 @@ 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.add_dependency '
|
21
|
+
spec.add_dependency 'activemodel', '>= 4.2', '< 6.1'
|
22
22
|
spec.add_dependency 'excon', '~> 0.32'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Notioneer Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activemodel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '4.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: excon
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/ncore/base.rb
|
98
98
|
- lib/ncore/builder.rb
|
99
99
|
- lib/ncore/client.rb
|
100
|
+
- lib/ncore/client_cache.rb
|
100
101
|
- lib/ncore/collection.rb
|
101
102
|
- lib/ncore/configuration.rb
|
102
103
|
- lib/ncore/exceptions.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- lib/ncore/rails/log_subscriber.rb
|
118
119
|
- lib/ncore/rails/module_fix.rb
|
119
120
|
- lib/ncore/singleton_base.rb
|
121
|
+
- lib/ncore/ssl/ca-certificates.crt
|
120
122
|
- lib/ncore/util.rb
|
121
123
|
- lib/ncore/version.rb
|
122
124
|
- ncore.gemspec
|
@@ -124,7 +126,7 @@ homepage: https://notioneer.com/
|
|
124
126
|
licenses:
|
125
127
|
- MIT
|
126
128
|
metadata: {}
|
127
|
-
post_install_message:
|
129
|
+
post_install_message:
|
128
130
|
rdoc_options: []
|
129
131
|
require_paths:
|
130
132
|
- lib
|
@@ -139,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
141
|
- !ruby/object:Gem::Version
|
140
142
|
version: '0'
|
141
143
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
143
|
-
signing_key:
|
144
|
+
rubygems_version: 3.0.6
|
145
|
+
signing_key:
|
144
146
|
specification_version: 4
|
145
147
|
summary: NCore - Gem for building REST API clients
|
146
148
|
test_files: []
|