unimatrix-activist 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/unimatrix-activist.rb +0 -4
- data/lib/unimatrix/activist/parser.rb +13 -9
- data/lib/unimatrix/activist/resources/activity.rb +1 -0
- data/lib/unimatrix/activist/resources/base.rb +25 -1
- data/lib/unimatrix/activist/resources/realm.rb +7 -0
- data/lib/unimatrix/activist/version.rb +1 -1
- metadata +3 -5
- data/lib/unimatrix/activist/resources/stream_clip_creation_activity.rb +0 -12
- data/lib/unimatrix/activist/resources/stream_clip_creation_task.rb +0 -11
- data/lib/unimatrix/activist/resources/video_ingestion_task.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d08bd66029b7bf948293c6fb8c0412e916c41a85
|
4
|
+
data.tar.gz: 04699949a62a1ad8d2b5992f2cebee23da50a9aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 114888733376596a83884a7ca4e84ffc92d0f6275ffeca5e3b781707b91a7693437dc2d4e8436b4b3b2bdf7b2d4174e9b0b1b0520ef64625bb390a8c07ac8e2a
|
7
|
+
data.tar.gz: 0a7f271e236f55ed54cc805d76f47b65fa0762970053fc3f468b419da691c5017ec88e883356d2aee6e12a2a99a47ce07bef622100428be0001e13c2a3cca676
|
data/lib/unimatrix-activist.rb
CHANGED
@@ -15,7 +15,3 @@ require 'unimatrix/activist/resources/base'
|
|
15
15
|
require 'unimatrix/activist/resources/error'
|
16
16
|
require 'unimatrix/activist/resources/activity'
|
17
17
|
require 'unimatrix/activist/resources/task'
|
18
|
-
|
19
|
-
require 'unimatrix/activist/resources/stream_clip_creation_activity'
|
20
|
-
require 'unimatrix/activist/resources/stream_clip_creation_task'
|
21
|
-
require 'unimatrix/activist/resources/video_ingestion_task'
|
@@ -80,7 +80,7 @@ module Unimatrix::Activist
|
|
80
80
|
@resources_index[ name ][ key ] ||= begin
|
81
81
|
|
82
82
|
# lock the resource index for this name/key combination
|
83
|
-
# note: this prevents Unimatrix::Activist objects that are associated with
|
83
|
+
# note: this prevents Unimatrix::Activist objects that are associated with
|
84
84
|
# themselves from causing a stack overflow
|
85
85
|
return nil if @resource_index_mutex[ name ].include?( key )
|
86
86
|
@resource_index_mutex[ name ].push( key )
|
@@ -88,15 +88,19 @@ module Unimatrix::Activist
|
|
88
88
|
result = nil
|
89
89
|
resource_attributes = resource_attribute_index[ name ][ key ]
|
90
90
|
if resource_attributes.present?
|
91
|
-
type_name = resource_attributes[ 'type_name' ]
|
92
|
-
klass = nil
|
93
|
-
|
94
|
-
|
95
|
-
if
|
96
|
-
|
97
|
-
klass =
|
98
|
-
|
91
|
+
type_name = resource_attributes[ 'type_name' ].camelize
|
92
|
+
klass = ( Unimatrix::Activist.const_get( options[ 'type_name' ].camelize ) rescue nil )
|
93
|
+
|
94
|
+
#Create specific class if not already defined
|
95
|
+
if type_name.present? && !Unimatrix::Activist.const_defined?( type_name )
|
96
|
+
typed_klass = Class.new( klass )
|
97
|
+
klass = Unimatrix::Activist.const_set( type_name , typed_klass )
|
98
|
+
|
99
|
+
elsif Unimatrix::Activist.const_defined?( type_name )
|
100
|
+
klass = Unimatrix::Activist.const_get( type_name )
|
101
|
+
|
99
102
|
end
|
103
|
+
|
100
104
|
if klass.present?
|
101
105
|
result = klass.new(
|
102
106
|
resource_attributes,
|
@@ -55,7 +55,11 @@ module Unimatrix::Activist
|
|
55
55
|
self.type_name = self.class.name.gsub( /Unimatrix::Activist::/, '' ).underscore
|
56
56
|
|
57
57
|
attributes.each do | key, value |
|
58
|
-
|
58
|
+
if !respond_to?( "#{ key }=" )
|
59
|
+
field( key )
|
60
|
+
end
|
61
|
+
|
62
|
+
send( "#{ key }=", value )
|
59
63
|
end
|
60
64
|
|
61
65
|
associations.each do | key, value |
|
@@ -65,6 +69,26 @@ module Unimatrix::Activist
|
|
65
69
|
yield self if block_given?
|
66
70
|
end
|
67
71
|
|
72
|
+
def field( name, options = {} )
|
73
|
+
self.fields[ name.to_sym ] = options.merge( name: name )
|
74
|
+
|
75
|
+
class_eval(
|
76
|
+
"def #{ name }(); " +
|
77
|
+
"@#{ name }.is_a?( FalseClass ) ? @#{ name } : (" +
|
78
|
+
"@#{ name } || " +
|
79
|
+
( options[ :default ].nil? ?
|
80
|
+
"nil" :
|
81
|
+
( options[ :default ].is_a?( String ) ?
|
82
|
+
"'#{ options[ :default ] }'" :
|
83
|
+
"#{ options[ :default ] }" ) ) + ");" +
|
84
|
+
"end;" +
|
85
|
+
" " +
|
86
|
+
"attr_writer :#{ name };",
|
87
|
+
__FILE__,
|
88
|
+
__LINE__
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
68
92
|
end
|
69
93
|
|
70
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimatrix-activist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Yang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -96,10 +96,8 @@ files:
|
|
96
96
|
- lib/unimatrix/activist/resources/activity.rb
|
97
97
|
- lib/unimatrix/activist/resources/base.rb
|
98
98
|
- lib/unimatrix/activist/resources/error.rb
|
99
|
-
- lib/unimatrix/activist/resources/
|
100
|
-
- lib/unimatrix/activist/resources/stream_clip_creation_task.rb
|
99
|
+
- lib/unimatrix/activist/resources/realm.rb
|
101
100
|
- lib/unimatrix/activist/resources/task.rb
|
102
|
-
- lib/unimatrix/activist/resources/video_ingestion_task.rb
|
103
101
|
- lib/unimatrix/activist/response.rb
|
104
102
|
- lib/unimatrix/activist/serializer.rb
|
105
103
|
- lib/unimatrix/activist/version.rb
|