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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3591cde5aa039445f5a07e48b3fc9818d9aed0a
4
- data.tar.gz: abd4244b737b74776b35ff975f1e18144188c88e
3
+ metadata.gz: d08bd66029b7bf948293c6fb8c0412e916c41a85
4
+ data.tar.gz: 04699949a62a1ad8d2b5992f2cebee23da50a9aa
5
5
  SHA512:
6
- metadata.gz: b31c75f458bd14949e9ef6b434b7931b853c4044686ea6e1a9b33d85e3ff0cfeffd144f86bf33211bceee3b1fd07520a73609dc8a7d80f770b0d921488875e8b
7
- data.tar.gz: 608b86df4e8fbf05bcbfdb44281c4098c2939e97cb8eff47082c9f9fcba4eaa1d8e958707b5531ed24781ebed0a344e97a50e59eb52cf1e21d7958b584ba7e1e
6
+ metadata.gz: 114888733376596a83884a7ca4e84ffc92d0f6275ffeca5e3b781707b91a7693437dc2d4e8436b4b3b2bdf7b2d4174e9b0b1b0520ef64625bb390a8c07ac8e2a
7
+ data.tar.gz: 0a7f271e236f55ed54cc805d76f47b65fa0762970053fc3f468b419da691c5017ec88e883356d2aee6e12a2a99a47ce07bef622100428be0001e13c2a3cca676
@@ -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
- klass = ( Unimatrix::Activist.const_get( type_name.camelize ) rescue nil ) \
94
- if type_name.present?
95
- if klass.nil?
96
- type_name = options[ 'type_name' ]
97
- klass = ( Unimatrix::Activist.const_get( type_name.camelize ) rescue nil ) \
98
- if type_name.present?
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,
@@ -15,6 +15,7 @@ module Unimatrix::Activist
15
15
  field :execute_at
16
16
 
17
17
  has_many :task
18
+ has_one :realm
18
19
  end
19
20
 
20
21
  end
@@ -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
- send( "#{ key }=", value ) if respond_to?( "#{ key }=" )
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
@@ -0,0 +1,7 @@
1
+ module Unimatrix::Activist
2
+
3
+ class Realm < Base
4
+ field :uuid
5
+ end
6
+
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Unimatrix
2
2
  module Activist
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  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.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-05-23 00:00:00.000000000 Z
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/stream_clip_creation_activity.rb
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
@@ -1,12 +0,0 @@
1
- module Unimatrix::Activist
2
-
3
- class StreamClipCreationActivity < Activity
4
- field :in_point
5
- field :out_point
6
- field :clip_name
7
- field :original_stream_id
8
- field :video_file_url
9
- field :video_id
10
- end
11
-
12
- end
@@ -1,11 +0,0 @@
1
- module Unimatrix::Activist
2
-
3
- class StreamClipCreationTask < Task
4
- field :in_point
5
- field :clip_name
6
- field :video_file_url
7
- field :out_point
8
- field :original_stream_id
9
- end
10
-
11
- end
@@ -1,9 +0,0 @@
1
- module Unimatrix::Activist
2
-
3
- class VideoIngestionTask < Task
4
- field :video_id
5
- field :clip_name
6
- field :video_file_url
7
- end
8
-
9
- end