unimatrix 2.2.1 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/unimatrix/archivist/artifact.rb +4 -2
- data/lib/unimatrix/archivist/blueprint.rb +1 -1
- data/lib/unimatrix/authorization/client_credentials_grant.rb +2 -2
- data/lib/unimatrix/authorization/policy.rb +0 -3
- data/lib/unimatrix/authorization/response.rb +1 -1
- data/lib/unimatrix/blueprint_operation.rb +45 -0
- data/lib/unimatrix/blueprintable.rb +72 -0
- data/lib/unimatrix/cartographer/city.rb +6 -0
- data/lib/unimatrix/cartographer/continent.rb +6 -0
- data/lib/unimatrix/cartographer/country.rb +6 -0
- data/lib/unimatrix/cartographer/geographic_area.rb +19 -0
- data/lib/unimatrix/cartographer/realm.rb +15 -0
- data/lib/unimatrix/cartographer/region.rb +17 -0
- data/lib/unimatrix/cartographer/region_geographic_area.rb +14 -0
- data/lib/unimatrix/cartographer/territory.rb +6 -0
- data/lib/unimatrix/dynamic_resource.rb +11 -11
- data/lib/unimatrix/parser.rb +1 -1
- data/lib/unimatrix/resource.rb +4 -0
- data/lib/unimatrix/version.rb +1 -1
- data/lib/unimatrix.rb +13 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d3e2a1fbf8ecd5a6aed641bc96082a03073a941
|
4
|
+
data.tar.gz: 8b74c9770faa1cc09ce0a2abff7379535164a146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00a806353e993ccbc4ab872792d14757e1e2dd974e084df429cd7142c00c4c9123854fe30a219eec5072cff59557cba7a41ac9fd2acc178d320773e60e49342
|
7
|
+
data.tar.gz: 766f98f696db873f4e4d899c36595b754296396740c3d16cf50299e23e9906621422439e975472054cf114434ace190bff68832df471dbb4ccc3279bcbf73122
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Unimatrix::Archivist
|
2
2
|
|
3
|
-
class Artifact < Unimatrix::
|
3
|
+
class Artifact < Unimatrix::Resource
|
4
|
+
|
5
|
+
include Unimatrix::Blueprintable
|
4
6
|
|
5
7
|
field :id
|
6
8
|
field :creator_uuid
|
@@ -20,7 +22,7 @@ module Unimatrix::Archivist
|
|
20
22
|
field :uuid
|
21
23
|
field :realm_uuid
|
22
24
|
field :component_uuids
|
23
|
-
field relationships: [ :category ]
|
25
|
+
field relationships: [ :category, :cast, :season, :asset, :athlete ]
|
24
26
|
field :name
|
25
27
|
field :created_at
|
26
28
|
field :updated_at
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Unimatrix
|
2
|
+
|
3
|
+
class BlueprintOperation < Unimatrix::Operation
|
4
|
+
|
5
|
+
@@blueprints = {}
|
6
|
+
|
7
|
+
def initialize( realm_uuid, options = {} )
|
8
|
+
@realm_uuid = realm_uuid
|
9
|
+
super( "/realms/#{ realm_uuid }/blueprints", options )
|
10
|
+
end
|
11
|
+
|
12
|
+
def read
|
13
|
+
@@blueprints[ @realm_uuid ] ||= begin
|
14
|
+
blueprints = []
|
15
|
+
|
16
|
+
offset = 0
|
17
|
+
segment_count = 10
|
18
|
+
total = nil
|
19
|
+
errors = nil
|
20
|
+
|
21
|
+
while total.nil? || offset < total
|
22
|
+
operation = self.offset( offset ).include( 'blueprint_attributes' )
|
23
|
+
|
24
|
+
operation.read do | resources, response |
|
25
|
+
|
26
|
+
if !response.body[ 'errors' ].nil?
|
27
|
+
errors = response.body[ 'errors' ]
|
28
|
+
break
|
29
|
+
end
|
30
|
+
|
31
|
+
offset += segment_count
|
32
|
+
total = response.body[ '$this' ][ 'unlimited_count' ]
|
33
|
+
|
34
|
+
blueprints += resources
|
35
|
+
end
|
36
|
+
|
37
|
+
raise "Error requesting blueprints for realm #{ @realm_uuid }. Error: #{ errors }" if !errors.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
blueprints
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Unimatrix
|
2
|
+
|
3
|
+
module Blueprintable
|
4
|
+
|
5
|
+
@module_members = []
|
6
|
+
|
7
|
+
def self.included( klass )
|
8
|
+
@module_members << klass
|
9
|
+
|
10
|
+
class << klass
|
11
|
+
cattr_accessor :blueprints
|
12
|
+
|
13
|
+
def find_blueprint( class_type_name )
|
14
|
+
blueprint = nil
|
15
|
+
|
16
|
+
self.blueprints.each do | b |
|
17
|
+
if ( b.resource_type_name == class_type_name ) &&
|
18
|
+
( blueprint.nil? || blueprint.realm_uuid.nil? )
|
19
|
+
|
20
|
+
blueprint = b
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
blueprint
|
25
|
+
end
|
26
|
+
|
27
|
+
def build( attributes )
|
28
|
+
blueprint = find_blueprint( attributes[ 'type_name' ] ) rescue nil
|
29
|
+
klass = build_typed_class( attributes, blueprint )
|
30
|
+
klass.new( attributes ) rescue nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_typed_class( attributes, blueprint )
|
34
|
+
base_class = Class.new( self )
|
35
|
+
klass = base_class
|
36
|
+
|
37
|
+
if !blueprint.nil?
|
38
|
+
module_name = Unimatrix.const_get( self.name.split( '::' )[1].underscore.camelize )
|
39
|
+
entity_type_name = attributes[ 'type_name' ].camelize + attributes[ 'realm_uuid' ]
|
40
|
+
|
41
|
+
unless module_name.const_defined?( entity_type_name )
|
42
|
+
klass = module_name.const_set( entity_type_name, base_class )
|
43
|
+
|
44
|
+
default_attributes = [ "type_name", "relationships", "realm_uuid" ]
|
45
|
+
|
46
|
+
if blueprint.respond_to?( 'blueprint_attributes' )
|
47
|
+
permitted_attributes = blueprint.blueprint_attributes.map( &:name ) + default_attributes
|
48
|
+
|
49
|
+
klass.instance_eval do
|
50
|
+
permitted_attributes.each do | field_name |
|
51
|
+
field field_name.to_sym
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
else
|
57
|
+
klass = module_name.const_get( entity_type_name )
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
klass
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.assign_blueprints( blueprints )
|
67
|
+
@module_members.map{ | klass | klass.blueprints = blueprints }
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Unimatrix::Cartographer
|
2
|
+
|
3
|
+
class GeographicArea < Unimatrix::DynamicResource
|
4
|
+
|
5
|
+
field :id
|
6
|
+
field :type_name
|
7
|
+
field :name
|
8
|
+
field :uuid
|
9
|
+
field :parent_uuid
|
10
|
+
field :code
|
11
|
+
field :created_at
|
12
|
+
field :updated_at
|
13
|
+
|
14
|
+
has_many :regions
|
15
|
+
has_many :region_geographic_areas
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Unimatrix::Cartographer
|
2
|
+
|
3
|
+
class Region < Unimatrix::DynamicResource
|
4
|
+
|
5
|
+
field :id
|
6
|
+
field :uuid
|
7
|
+
field :name
|
8
|
+
field :realm_id
|
9
|
+
field :created_at
|
10
|
+
field :updated_at
|
11
|
+
|
12
|
+
has_many :geographic_areas
|
13
|
+
has_many :region_geographic_areas
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -2,18 +2,18 @@ module Unimatrix
|
|
2
2
|
|
3
3
|
class DynamicResource < Resource
|
4
4
|
|
5
|
-
class << self
|
6
|
-
|
5
|
+
class << self
|
6
|
+
|
7
7
|
alias old_new new
|
8
|
-
|
8
|
+
|
9
9
|
def new( attributes = {}, associations = {} )
|
10
|
-
Class.new( self ).old_new(
|
10
|
+
Class.new( self ).old_new(
|
11
11
|
{ type_name: self.name.split( '::' ).last.underscore }.
|
12
|
-
merge( attributes ),
|
13
|
-
associations
|
12
|
+
merge( attributes ),
|
13
|
+
associations
|
14
14
|
)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
end
|
18
18
|
|
19
19
|
def initialize( attributes = {}, associations = {} )
|
@@ -24,17 +24,17 @@ module Unimatrix
|
|
24
24
|
unless self.respond_to?( key.to_sym )
|
25
25
|
end
|
26
26
|
|
27
|
-
self.class_eval do
|
27
|
+
self.class_eval do
|
28
28
|
unsupported_attributes_names.each do | name |
|
29
|
-
field name
|
29
|
+
field name
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
super( attributes, associations )
|
33
|
+
super( attributes, associations )
|
34
34
|
yield self if block_given?
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
end
|
data/lib/unimatrix/parser.rb
CHANGED
@@ -99,7 +99,7 @@ module Unimatrix
|
|
99
99
|
if resource_attributes.present?
|
100
100
|
parse_nested_attributes( resource_attributes )
|
101
101
|
|
102
|
-
resource_class = find_resource_class_by_type_name(
|
102
|
+
resource_class = find_resource_class_by_type_name(
|
103
103
|
resource_attributes[ 'type_name' ],
|
104
104
|
options[ 'type_name' ]
|
105
105
|
)
|
data/lib/unimatrix/resource.rb
CHANGED
data/lib/unimatrix/version.rb
CHANGED
data/lib/unimatrix.rb
CHANGED
@@ -13,6 +13,9 @@ require 'unimatrix/serializer'
|
|
13
13
|
|
14
14
|
require 'unimatrix/resource'
|
15
15
|
require 'unimatrix/dynamic_resource'
|
16
|
+
require 'unimatrix/blueprintable'
|
17
|
+
require 'unimatrix/blueprint_operation'
|
18
|
+
|
16
19
|
require 'unimatrix/realm'
|
17
20
|
|
18
21
|
require 'unimatrix/error'
|
@@ -72,6 +75,16 @@ require 'unimatrix/authorization/resource'
|
|
72
75
|
require 'unimatrix/authorization/resource_owner'
|
73
76
|
require 'unimatrix/authorization/resource_server'
|
74
77
|
|
78
|
+
# cartographer
|
79
|
+
require 'unimatrix/cartographer/geographic_area'
|
80
|
+
require 'unimatrix/cartographer/city'
|
81
|
+
require 'unimatrix/cartographer/continent'
|
82
|
+
require 'unimatrix/cartographer/country'
|
83
|
+
require 'unimatrix/cartographer/realm'
|
84
|
+
require 'unimatrix/cartographer/region'
|
85
|
+
require 'unimatrix/cartographer/region_geographic_area'
|
86
|
+
require 'unimatrix/cartographer/territory'
|
87
|
+
|
75
88
|
# distributor
|
76
89
|
require 'unimatrix/distributor/destination'
|
77
90
|
require 'unimatrix/distributor/distribution'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jackson Souza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -126,6 +126,16 @@ files:
|
|
126
126
|
- lib/unimatrix/authorization/resource_server.rb
|
127
127
|
- lib/unimatrix/authorization/response.rb
|
128
128
|
- lib/unimatrix/bad_request_error.rb
|
129
|
+
- lib/unimatrix/blueprint_operation.rb
|
130
|
+
- lib/unimatrix/blueprintable.rb
|
131
|
+
- lib/unimatrix/cartographer/city.rb
|
132
|
+
- lib/unimatrix/cartographer/continent.rb
|
133
|
+
- lib/unimatrix/cartographer/country.rb
|
134
|
+
- lib/unimatrix/cartographer/geographic_area.rb
|
135
|
+
- lib/unimatrix/cartographer/realm.rb
|
136
|
+
- lib/unimatrix/cartographer/region.rb
|
137
|
+
- lib/unimatrix/cartographer/region_geographic_area.rb
|
138
|
+
- lib/unimatrix/cartographer/territory.rb
|
129
139
|
- lib/unimatrix/configuration.rb
|
130
140
|
- lib/unimatrix/curator/activity_reference.rb
|
131
141
|
- lib/unimatrix/curator/source.rb
|