evostream-event 0.2.0.pre.22 → 0.2.1.pre.23

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: bda4544e052f192f291c65e4b6d322d68495b757
4
- data.tar.gz: b800163b0795c5a1d213868f63e6fbe0dabba642
3
+ metadata.gz: 09ddbacb69c0e6f8aee31a54a5863b9fc93bbfad
4
+ data.tar.gz: 4407bd52ef32bb40909e1475a34846574eb59c17
5
5
  SHA512:
6
- metadata.gz: 17eba235669fe35b255c18317626a0d99123a387b22d3b365d3589f9c775bd96ab2b4158c6f88ac327c44cda626ab11a979bbbaa641df4051eb3c09b6e4bcec3
7
- data.tar.gz: bb879900c41c7329e2d00b77613bcf11660444e7176f68ec038921aa45bb4081925853181a8622f992c2b2a6f917a0d9900ccdc148a110bfa772e131683e74e8
6
+ metadata.gz: 384523a3f1f1a01d89dfe0448b66ac4b2c19bc9470fd5e5372c66856159fea330a2fa97f4e033b7ff3cae59cd6e676d21d69e8faedd56c6eeb3a09cb6f60e662
7
+ data.tar.gz: d172ce9185021aa3a4921f927872082060806db40eaf84e3dba880d68c5a7c2984937812ed530aee762ddf374c3398b1665034546775c917201afa87d530fdcc
@@ -10,11 +10,9 @@ require 'net/http'
10
10
  # Primary command to gem
11
11
  module Evostream
12
12
  def self.send_command(cmd)
13
- uri = URI.parse(Evostream::Service.uri_in)
13
+ uri = URI.parse("#{Evostream::Service.uri_in}/#{cmd}")
14
14
  http = Net::HTTP.new(uri.host, uri.port)
15
- command_launch = "/#{cmd}"
16
- Evostream.logger "Command : #{command_launch}"
17
- http.request(Net::HTTP::Get.new(command_launch))
15
+ http.request(Net::HTTP::Get.new(uri))
18
16
  end
19
17
 
20
18
  def self.logger(message)
@@ -30,7 +28,7 @@ module Evostream
30
28
  def execute_action(command_name)
31
29
  cmd = command_name.sub(/^(\w)/, &:capitalize)
32
30
  klass = "Evostream::Commands::#{cmd}".constantize
33
- Evostream.send_command(klass.new(@payload))
31
+ Evostream.send_command(klass.new(@payload).cmd)
34
32
  end
35
33
  end
36
34
 
@@ -37,5 +37,8 @@ module Evostream
37
37
  "removeHlsHdsFiles=#{param} "
38
38
  end
39
39
  end
40
+
41
+ # Alias to Destroy class
42
+ RemoveConfig = Destroy
40
43
  end
41
44
  end
@@ -10,6 +10,10 @@ module Evostream
10
10
  super(commands)
11
11
  end
12
12
 
13
+ def cmd
14
+ "pushStream?params=#{Base64.urlsafe_encode64(command.join)}"
15
+ end
16
+
13
17
  private
14
18
 
15
19
  attr_reader :command
@@ -6,7 +6,7 @@
6
6
  # Define constant to gem.
7
7
  module Evostream
8
8
  # Define version to gem
9
- VERSION = '0.2.0'
9
+ VERSION = '0.2.1'
10
10
 
11
11
  # Name to gem
12
12
  GEM_NAME = 'evostream-event'
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Evostream::Commands::Destroy do
6
+ let(:command) { Evostream::Commands::PushStream.new(cmd) }
7
+
8
+ context 'uri' do
9
+ let(:arg_value) { 'rtmp://de.pscp.tv:80/x/31' }
10
+ let(:argument) { 'uri' }
11
+
12
+ include_examples 'command'
13
+ end
14
+
15
+ context 'local_stream_name' do
16
+ let(:arg_value) { Faker::Pokemon.name }
17
+ let(:argument) { 'local_stream_name' }
18
+
19
+ include_examples 'command'
20
+ end
21
+
22
+ context 'target_stream_name' do
23
+ let(:arg_value) { Faker::Pokemon.name }
24
+ let(:argument) { 'target_stream_name' }
25
+
26
+ include_examples 'command'
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Evostream::Action, type: :request do
6
+ let(:action) { Evostream::Action.new(payload) }
7
+ let(:payload) { {} }
8
+
9
+ it 'should be a hash' do
10
+ expect(action.instance_variable_get(:@payload)).to be_kind_of(Hash)
11
+ end
12
+
13
+ describe 'push_stream' do
14
+ let(:action_name) { 'pushStream' }
15
+ let(:payload) do
16
+ {
17
+ uri: 'rtmp://rtmp-api.facebook.com:80/rtmp',
18
+ target_stream_name: '151146928743762?ds=1&s_l=1&a=AThF12FC86-ffgS5',
19
+ local_stream_name: 'top'
20
+ }
21
+ end
22
+
23
+ include_examples 'test request action'
24
+ end
25
+
26
+ describe 'remove_config' do
27
+ let(:action_name) { 'removeConfig' }
28
+ let(:payload) { { id: Faker::Number.between(1, 999_999) } }
29
+
30
+ include_examples 'test request action'
31
+ end
32
+ end
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'test request action' do
4
+ let(:request) { action.execute_action(action_name) }
5
+
6
+ it { expect(request).to be_an_instance_of(Net::HTTPOK) }
7
+ 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.2.0.pre.22
4
+ version: 0.2.1.pre.23
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-30 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -258,12 +258,17 @@ files:
258
258
  - spec/evostream/commands/create_hls_spec.rb
259
259
  - spec/evostream/commands/create_spec.rb
260
260
  - spec/evostream/commands/destroy_spec.rb
261
+ - spec/evostream/commands/push_stream_spec.rb
261
262
  - spec/evostream/events/events_spec.rb
262
263
  - spec/evostream/events/request_in_stream_closed_spec.rb
263
264
  - spec/evostream/events/request_in_stream_created_spec.rb
264
265
  - spec/evostream/events/request_out_stream_created_spec.rb
266
+ - spec/evostream/evostream_event_action_spec.rb
267
+ - spec/evostream/evostream_event_event_spec.rb
268
+ - spec/evostream/evostream_event_method_spec.rb
265
269
  - spec/evostream/evostream_event_spec.rb
266
270
  - spec/spec_helper.rb
271
+ - spec/support/examples_actions.rb
267
272
  - spec/support/examples_commands.rb
268
273
  - spec/support/examples_events.rb
269
274
  homepage: https://github.com/Dev-Crea/evostream-event