evostream-event 0.1.0 → 0.1.1.pre.17

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
  SHA1:
3
- metadata.gz: a9e5b803c4107cf6c2e183546b37136f0cd9e162
4
- data.tar.gz: 14ef30216559d59c8527cb6b46d6708b3420791c
3
+ metadata.gz: ffe09ccc5690bcbe5d2641260fe090fdf15ea0df
4
+ data.tar.gz: 7dd9ae6bd7c5e6c31196d23794a958c7430e0d91
5
5
  SHA512:
6
- metadata.gz: 0bb413120c095c034394a54fdc9f012d135a432059e332189df4aa53c3756af13851419b9446ad16ccb59911739b409d68b6a6103ed2da0f2fd52f726c806c1e
7
- data.tar.gz: 4343867836d9b24944c0912c7e23cb463cc5640f95e2ceef32e652f9dd6bf5b996138b947494e5c9f9ee2df7a98f95108782ab8b56f68eb1e009dd58254446ff
6
+ metadata.gz: f22870ed112b95152b992bc02d95b0aba49fa6f72c7d51abe67ad9763bea4f3f8022d0a35e580903cb69a11582fdab01bc0e23b83cf66cb76a67e6fc99320801
7
+ data.tar.gz: e015525331f9954cf1f725531159e882827f3d97ec1c72c3157626080af6612770852c2cfac71629c8708d31afa85093285c22972ce99ea733ef9041533bf292
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support'
4
- require 'evostream/info'
5
- require 'evostream/service'
6
- require 'evostream/commands'
7
- require 'evostream/events'
4
+ require 'evostream/event/info'
5
+ require 'evostream/event/service'
6
+ require 'evostream/event/commands'
7
+ require 'evostream/event/events'
8
8
 
9
9
  # Primary command to gem
10
10
  module Evostream
@@ -17,7 +17,7 @@ module Evostream
17
17
  end
18
18
 
19
19
  def self.logger(message)
20
- Rails.logger.debug "[#{Evostream::GEM_NAME}] #{message}"
20
+ Rails.logger.debug "[#{Evostream::GEM_NAME}] #{message}" if defined?(Rails)
21
21
  end
22
22
 
23
23
  # Endpoint to gem
@@ -15,5 +15,5 @@ module Evostream
15
15
  end
16
16
  end
17
17
 
18
- require 'evostream/commands/create'
19
- require 'evostream/commands/destroy'
18
+ require 'evostream/event/commands/create'
19
+ require 'evostream/event/commands/destroy'
@@ -93,5 +93,5 @@ module Evostream
93
93
  end
94
94
  end
95
95
 
96
- require 'evostream/commands/create/dash'
97
- require 'evostream/commands/create/hls'
96
+ require 'evostream/event/commands/create/dash'
97
+ require 'evostream/event/commands/create/hls'
@@ -31,6 +31,6 @@ module Evostream
31
31
  end
32
32
  end
33
33
 
34
- require 'evostream/events/in_stream_created'
35
- require 'evostream/events/in_stream_closed'
36
- require 'evostream/events/out_stream_created'
34
+ require 'evostream/event/events/in_stream_created'
35
+ require 'evostream/event/events/in_stream_closed'
36
+ require 'evostream/event/events/out_stream_created'
@@ -6,7 +6,7 @@
6
6
  # Define constant to gem.
7
7
  module Evostream
8
8
  # Define version to gem
9
- VERSION = '0.1.0'
9
+ VERSION = '0.1.1'
10
10
 
11
11
  # Name to gem
12
12
  GEM_NAME = 'evostream-event'
File without changes
@@ -8,8 +8,6 @@ module Evostream
8
8
  INITIALIZER = <<-INIT
9
9
  # frozen_string_literal: true
10
10
 
11
- require 'evostream_event'
12
-
13
11
  Evostream::Service.configuration do |config|
14
12
  config.uri_in = 'http://server_stream.local:80'
15
13
  config.uri_out = 'http://server_stream.local:7777'
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Evostream::Events::InStreamClosed do
6
+ let(:body) do
7
+ {
8
+ id: Faker::Number.between(1, 999_999),
9
+ payload: {
10
+ PID: Faker::Number.between(1, 999_999),
11
+ appName: 'evostreamms',
12
+ audio: {
13
+ bytesCount: Faker::Number.between(1, 999_999),
14
+ codec: 'AAAC',
15
+ codecNumeric: Faker::Number.between(1, 999_999),
16
+ droppedBytesCount: 0,
17
+ droppedPacketsCount: 0,
18
+ packetsCount: Faker::Number.between(1, 999_999)
19
+ },
20
+ bandwidth: Faker::Number.between(1, 999_999),
21
+ connectionType: 0,
22
+ creationTimestamp: Faker::Number.decimal(2),
23
+ customData: nil,
24
+ farIp: Faker::Internet.ip_v4_address,
25
+ farPort: Faker::Number.between(1, 65_536),
26
+ ip: Faker::Internet.ip_v4_address,
27
+ name: "#{Faker::Zelda.character}_#{Faker::Number.between(1, 999)}",
28
+ nearIp: Faker::Internet.ip_v4_address,
29
+ nearPort: Faker::Number.between(1, 65_536),
30
+ outStreamsUniqueIds: [
31
+ 4,
32
+ 5
33
+ ],
34
+ port: Faker::Number.between(1, 65_536),
35
+ processId: Faker::Number.between(1, 999),
36
+ processType: 'origin',
37
+ queryTimestamp: Faker::Number.decimal(3),
38
+ type: 'INP',
39
+ typeNumeric: Faker::Number.between(1, 999_999_999),
40
+ uniqueId: 2,
41
+ upTime: Faker::Number.decimal(3),
42
+ userAgent: 'Lavf56.40.101',
43
+ video: {
44
+ bytesCount: Faker::Number.between(1, 999_999),
45
+ codec: 'VH264',
46
+ codecNumeric: Faker::Number.between(1, 999_999_999),
47
+ droppedBytesCount: 0,
48
+ droppedPacketsCount: 0,
49
+ height: Faker::Number.between(1, 999),
50
+ level: Faker::Number.between(1, 999),
51
+ packetsCount: Faker::Number.between(1, 999),
52
+ profile: Faker::Number.between(1, 999),
53
+ width: Faker::Number.between(1, 999)
54
+ }
55
+ },
56
+ processId: Faker::Number.between(1, 999_999),
57
+ timestamp: Faker::Number.between(1, 999_999),
58
+ type: 'inStreamClosed'
59
+ }
60
+ end
61
+
62
+ let(:type_default) { 'inStreamClosed' }
63
+
64
+ context 'payload is correct' do
65
+ let(:type) { body[:type] }
66
+ let(:payload) { body[:payload].to_json }
67
+
68
+ include_examples 'payload is correct'
69
+ end
70
+
71
+ context 'payload isn\'t correct' do
72
+ let(:body) { Faker::Lorem.paragraph }
73
+ let(:type) { Faker::Zelda.character }
74
+ let(:payload) { Faker::Zelda.game }
75
+
76
+ include_examples 'payload isn\'t correct'
77
+ end
78
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Evostream::Events::InStreamCreated do
6
+ let(:body) do
7
+ {
8
+ id: Faker::Number.between(1, 999_999),
9
+ payload: {
10
+ PID: Faker::Number.between(1, 999_999),
11
+ appName: 'evostreamms',
12
+ audio: {
13
+ bytesCount: Faker::Number.between(1, 999_999),
14
+ codec: 'AAAC',
15
+ codecNumeric: Faker::Number.between(1, 999_999),
16
+ droppedBytesCount: 0,
17
+ droppedPacketsCount: 0,
18
+ packetsCount: Faker::Number.between(1, 999_999)
19
+ },
20
+ bandwidth: Faker::Number.between(1, 999_999),
21
+ connectionType: 0,
22
+ creationTimestamp: Faker::Number.decimal(2),
23
+ customData: nil,
24
+ farIp: Faker::Internet.ip_v4_address,
25
+ farPort: Faker::Number.between(1, 65_536),
26
+ ip: Faker::Internet.ip_v4_address,
27
+ name: "#{Faker::Zelda.character}_#{Faker::Number.between(1, 999)}",
28
+ nearIp: Faker::Internet.ip_v4_address,
29
+ nearPort: Faker::Number.between(1, 65_536),
30
+ outStreamsUniqueIds: nil,
31
+ port: Faker::Number.between(1, 65_536),
32
+ processId: Faker::Number.between(1, 999),
33
+ processType: 'origin',
34
+ queryTimestamp: Faker::Number.decimal(3),
35
+ type: 'INP',
36
+ typeNumeric: Faker::Number.between(1, 999_999_999),
37
+ uniqueId: 2,
38
+ upTime: Faker::Number.decimal(3),
39
+ userAgent: 'Lavf56.40.101',
40
+ video: {
41
+ bytesCount: Faker::Number.between(1, 999_999),
42
+ codec: 'VH264',
43
+ codecNumeric: Faker::Number.between(1, 999_999_999),
44
+ droppedBytesCount: 0,
45
+ droppedPacketsCount: 0,
46
+ height: Faker::Number.between(1, 999),
47
+ level: Faker::Number.between(1, 999),
48
+ packetsCount: Faker::Number.between(1, 999),
49
+ profile: Faker::Number.between(1, 999),
50
+ width: Faker::Number.between(1, 999)
51
+ }
52
+ },
53
+ processId: Faker::Number.between(1, 999_999),
54
+ timestamp: Faker::Number.between(1, 999_999),
55
+ type: 'inStreamCreated'
56
+ }
57
+ end
58
+
59
+ let(:type_default) { 'inStreamCreated' }
60
+
61
+ context 'payload is correct' do
62
+ let(:type) { body[:type] }
63
+ let(:payload) { body[:payload].to_json }
64
+
65
+ include_examples 'payload is correct'
66
+ end
67
+
68
+ context 'payload isn\'t correct' do
69
+ let(:body) { Faker::Lorem.paragraph }
70
+ let(:type) { Faker::Zelda.character }
71
+ let(:payload) { Faker::Zelda.game }
72
+
73
+ include_examples 'payload isn\'t correct'
74
+ end
75
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Evostream::Events::OutStreamCreated do
6
+ context 'HLS Flux' do
7
+ let(:body) do
8
+ {
9
+ id: Faker::Number.between(1, 999_999),
10
+ payload: {
11
+ PID: Faker::Number.between(1, 999_999),
12
+ appName: 'evostreamms',
13
+ audio: {
14
+ bytesCount: Faker::Number.between(1, 999_999),
15
+ codec: 'AAAC',
16
+ codecNumeric: Faker::Number.between(1, 999_999),
17
+ droppedBytesCount: 0,
18
+ droppedPacketsCount: 0,
19
+ packetsCount: Faker::Number.between(1, 999_999)
20
+ },
21
+ bandwidth: Faker::Number.between(1, 999_999),
22
+ connectionType: 0,
23
+ creationTimestamp: Faker::Number.decimal(2),
24
+ customData: nil,
25
+ farIp: Faker::Internet.ip_v4_address,
26
+ farPort: Faker::Number.between(1, 65_536),
27
+ hlsSettings: {
28
+ AESKeyCount: Faker::Number.between(1, 99),
29
+ audioOnly: false,
30
+ bandwidth: 0,
31
+ chunkBaseName: 'segment',
32
+ chunkLength: 1,
33
+ chunkOnIDR: true,
34
+ cleanupDestination: false,
35
+ cleanupOnClose: true,
36
+ configId: 1,
37
+ createMasterPlaylist: true,
38
+ drmType: 'none',
39
+ fileLength: 0,
40
+ groupName: Faker::Lorem.word,
41
+ groupTargetFolder: Faker::File.file_name(Faker::Lorem.word),
42
+ hlsResume: false,
43
+ hlsVersion: 3,
44
+ keepAlive: true,
45
+ localStreamName: Faker::GameOfThrones.house,
46
+ masterPlaylistPath: Faker::File.file_name(Faker::Lorem.word,
47
+ Faker::GameOfThrones.city,
48
+ Faker::Color.color_name),
49
+ maxChunkLength: 0,
50
+ offsetTime: 0,
51
+ operationType: 3,
52
+ overwriteDestination: true,
53
+ playlistLength: 5,
54
+ playlistName: "#{Faker::Lorem.word}.#{Faker::Lorem.word}",
55
+ playlistType: %w(rolling appending).sample,
56
+ staleRetentionCount: 5,
57
+ startOffset: 0,
58
+ targetFolder: Faker::File.file_name(Faker::Lorem.word,
59
+ Faker::GameOfThrones.city,
60
+ Faker::Color.color_name),
61
+ timestamp: Faker::Number.decimal(1),
62
+ useByteRange: false,
63
+ useSystemTime: false
64
+ },
65
+ ip: Faker::Internet.ip_v4_address,
66
+ name: "#{Faker::Zelda.character}_#{Faker::Number.between(1, 999)}",
67
+ nearIp: Faker::Internet.ip_v4_address,
68
+ nearPort: Faker::Number.between(1, 65_536),
69
+ outStreamsUniqueIds: nil,
70
+ port: Faker::Number.between(1, 65_536),
71
+ processId: Faker::Number.between(1, 999),
72
+ processType: 'origin',
73
+ queryTimestamp: Faker::Number.decimal(3),
74
+ type: 'INP',
75
+ typeNumeric: Faker::Number.between(1, 999_999_999),
76
+ uniqueId: 2,
77
+ upTime: Faker::Number.decimal(3),
78
+ userAgent: 'Lavf56.40.101',
79
+ video: {
80
+ bytesCount: Faker::Number.between(1, 999_999),
81
+ codec: 'VH264',
82
+ codecNumeric: Faker::Number.between(1, 999_999_999),
83
+ droppedBytesCount: 0,
84
+ droppedPacketsCount: 0,
85
+ height: Faker::Number.between(1, 999),
86
+ level: Faker::Number.between(1, 999),
87
+ packetsCount: Faker::Number.between(1, 999),
88
+ profile: Faker::Number.between(1, 999),
89
+ width: Faker::Number.between(1, 999)
90
+ }
91
+ },
92
+ processId: Faker::Number.between(1, 999_999),
93
+ timestamp: Faker::Number.between(1, 999_999),
94
+ type: 'outStreamCreated'
95
+ }
96
+ end
97
+
98
+ let(:type_default) { 'outStreamCreated' }
99
+
100
+ context 'payload is correct' do
101
+ let(:type) { body[:type] }
102
+ let(:payload) { body[:payload].to_json }
103
+
104
+ include_examples 'payload is correct'
105
+ end
106
+
107
+ context 'payload isn\'t correct' do
108
+ let(:body) { Faker::Lorem.paragraph }
109
+ let(:type) { Faker::Zelda.character }
110
+ let(:payload) { Faker::Zelda.game }
111
+
112
+ include_examples 'payload isn\'t correct'
113
+ end
114
+ end
115
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support'
4
- require 'evostream_event'
4
+ require 'evostream/event'
5
5
  require 'faker'
6
+ require 'json'
6
7
 
7
8
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
8
9
 
File without changes
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'payload is correct' do
4
+ include_examples 'body type'
5
+ include_examples 'evostream::event new'
6
+ include_examples 'instance variable model'
7
+ it { expect(type).to eql(type_default) }
8
+ end
9
+
10
+ RSpec.shared_examples 'payload isn\'t correct' do
11
+ include_examples 'body type'
12
+ include_examples 'evostream::event new'
13
+ include_examples 'instance variable model'
14
+ it { expect(type).not_to eql(type_default) }
15
+ end
16
+
17
+ RSpec.shared_examples 'body type' do
18
+ it { expect(body.to_json).to be_kind_of(String) }
19
+ end
20
+
21
+ RSpec.shared_examples 'evostream::event new' do
22
+ it { expect(Evostream::Event.new(type, payload)).not_to be nil }
23
+ end
24
+
25
+ RSpec.shared_examples 'instance variable model' do
26
+ let(:model) { type.sub(/^(\w)/, &:capitalize) }
27
+ let(:evo) { Evostream::Event.new(type, payload) }
28
+
29
+ it { expect(evo.instance_variable_get(:@model)).to eql(model) }
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evostream-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1.pre.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,27 +220,31 @@ files:
220
220
  - LICENSE
221
221
  - README.md
222
222
  - Rakefile
223
- - lib/evostream/commands.rb
224
- - lib/evostream/commands/create.rb
225
- - lib/evostream/commands/create/dash.rb
226
- - lib/evostream/commands/create/hls.rb
227
- - lib/evostream/commands/destroy.rb
228
- - lib/evostream/events.rb
229
- - lib/evostream/events/in_stream_closed.rb
230
- - lib/evostream/events/in_stream_created.rb
231
- - lib/evostream/events/out_stream_created.rb
232
- - lib/evostream/info.rb
233
- - lib/evostream/service.rb
234
- - lib/evostream_event.rb
223
+ - lib/evostream/event.rb
224
+ - lib/evostream/event/commands.rb
225
+ - lib/evostream/event/commands/create.rb
226
+ - lib/evostream/event/commands/create/dash.rb
227
+ - lib/evostream/event/commands/create/hls.rb
228
+ - lib/evostream/event/commands/destroy.rb
229
+ - lib/evostream/event/events.rb
230
+ - lib/evostream/event/events/in_stream_closed.rb
231
+ - lib/evostream/event/events/in_stream_created.rb
232
+ - lib/evostream/event/events/out_stream_created.rb
233
+ - lib/evostream/event/info.rb
234
+ - lib/evostream/event/service.rb
235
235
  - lib/generators/evostream/initializer_generator.rb
236
236
  - spec/evostream/commands/create_dash_spec.rb
237
237
  - spec/evostream/commands/create_hls_spec.rb
238
238
  - spec/evostream/commands/create_spec.rb
239
239
  - spec/evostream/commands/destroy_spec.rb
240
- - spec/evostream/events_spec.rb
240
+ - spec/evostream/events/events_spec.rb
241
+ - spec/evostream/events/request_in_stream_closed_spec.rb
242
+ - spec/evostream/events/request_in_stream_created_spec.rb
243
+ - spec/evostream/events/request_out_stream_created_spec.rb
241
244
  - spec/evostream/evostream_event_spec.rb
242
245
  - spec/spec_helper.rb
243
- - spec/support/commands.rb
246
+ - spec/support/examples_commands.rb
247
+ - spec/support/examples_events.rb
244
248
  homepage: https://github.com/dazzl-tv/evostream-event
245
249
  licenses:
246
250
  - MIT
@@ -273,9 +277,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
277
  version: '0'
274
278
  required_rubygems_version: !ruby/object:Gem::Requirement
275
279
  requirements:
276
- - - ">="
280
+ - - ">"
277
281
  - !ruby/object:Gem::Version
278
- version: '0'
282
+ version: 1.3.1
279
283
  requirements: []
280
284
  rubyforge_project:
281
285
  rubygems_version: 2.4.5