Module: Evostream
- Defined in:
- lib/evostream/event.rb,
lib/evostream/cli/config.rb,
lib/evostream/cli/option.rb,
lib/evostream/cli/runner.rb,
lib/evostream/cli/search.rb,
lib/evostream/event/info.rb,
lib/evostream/event/event.rb,
lib/evostream/action/action.rb,
lib/evostream/event/service.rb,
lib/evostream/cli/code_error.rb,
lib/evostream/event/commands.rb,
lib/evostream/cli/option/help.rb,
lib/evostream/cli/option/host.rb,
lib/evostream/cli/option/port.rb,
lib/evostream/cli/option/config.rb,
lib/evostream/cli/option/search.rb,
lib/evostream/cli/option/command.rb,
lib/evostream/cli/option/version.rb,
lib/evostream/event/event/events.rb,
lib/evostream/cli/option/argument.rb,
lib/evostream/event/commands/error.rb,
lib/evostream/event/commands/create.rb,
lib/evostream/event/commands/destroy.rb,
lib/evostream/event/response/response.rb,
lib/evostream/event/commands/create/hls.rb,
lib/evostream/event/commands/create/dash.rb,
lib/evostream/event/commands/list_config.rb,
lib/evostream/event/commands/push_stream.rb,
lib/evostream/event/commands/list_streams.rb,
lib/evostream/event/commands/set_log_level.rb,
lib/evostream/event/commands/get_stream_info.rb,
lib/generators/evostream/initializer_generator.rb,
lib/evostream/event/event/events/in_stream_closed.rb,
lib/evostream/event/event/events/in_stream_created.rb,
lib/evostream/event/event/events/out_stream_created.rb
Overview
:reek:TooManyMethods
Defined Under Namespace
Modules: CLI, CodeError, Commands, Events, Generators Classes: Action, Event, Responses, Runner, Service
Constant Summary collapse
- VERSION =
Define version to gem
'1.0.2'
- GEM_NAME =
Name to gem
'evostream-event'
- AUTHORS =
Authors
['VAILLANT Jeremy'].freeze
- EMAILS =
Emails
['[email protected]'].freeze
- LICENSE =
Licence
'MIT'
- SUMMARY =
Define a summary description to gem
'EvoStream Event'
- DESCRIPTION =
Define a long description to gem
<<-DESC Manipulate event evostream and send actions to evostream server. DESC
- HOMEPAGE =
Define homepage
'https://github.com/Dev-Crea/evostream-event'
- POST_INSTALL =
Define a post install message
"# ====================================================== #\n" \ "# Thanks for installing EvoStream-Event ! #\n" \ "# #{HOMEPAGE}. #\n" \ "# ;;;;;;;;;;;:. #\n" \ "# ;;;;;;;;;;;;;;;;;; #\n" \ "# ;;;;;;;;;;;:;;;;;;;; #\n" \ "# ;;;;;;;;;;` ;;;;;;;; #\n" \ "# ;;;;;;;;; :;;;;;;;;. #\n" \ "# ;;;;;;;; :::::;;;;; #\n" \ "# ;;;;;;, ,;;;;;; #\n" \ "# ;;;;; ;;;;;;;; #\n" \ "# ;;;;;;;;; ;;;;;;;;, #\n" \ "# ;;;;;;;;; `;;;;;;;;; A ZZZZZZZ ZZZZZZZ LL #\n" \ "# ;;;;;;;;.:;;;;;;;;;; A A ZZZ ZZZ LL #\n" \ "# ;;;;;;;;;;;;;;;;; AAAAA ZZ ZZ LL #\n" \ "# ;;;;;;;;;;;;;, A A ZZZZZZZ ZZZZZZZ LLLLLLL #\n" \ '# ====================================================== #'
Class Method Summary collapse
- .find_fixture(command) ⇒ Object
- .logger(message) ⇒ Object
- .path_fixture ⇒ Object
- .prepare_request(cmd, uri_in = nil) ⇒ Object
- .prepare_request_real(url, cmd) ⇒ Object
- .request_real(uri) ⇒ Object
- .request_test(command) ⇒ Object
- .send_command(cmd, uri_in = nil) ⇒ Object
Class Method Details
.find_fixture(command) ⇒ Object
61 62 63 |
# File 'lib/evostream/event.rb', line 61 def find_fixture(command) File.join(path_fixture, "#{command.split('?')[0].underscore}.json") end |
.logger(message) ⇒ Object
22 23 24 25 |
# File 'lib/evostream/event.rb', line 22 def self.logger() Rails.logger.debug "[#{Evostream::GEM_NAME}] #{}" \ if Evostream::Service.environment.eql?('development') && defined?(Rails) end |
.path_fixture ⇒ Object
56 57 58 59 |
# File 'lib/evostream/event.rb', line 56 def path_fixture File.realpath(File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', 'fixtures')) end |
.prepare_request(cmd, uri_in = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/evostream/event.rb', line 27 def self.prepare_request(cmd, uri_in = nil) env = Evostream::Service.environment.to_sym Evostream.logger "ENV ------> #{env}" case env when :test Evostream.request_test(cmd) when :development, :production prepare_request_real(uri_in.nil? ? Evostream::Service.uri_in : uri_in, cmd) end end |
.prepare_request_real(url, cmd) ⇒ Object
39 40 41 |
# File 'lib/evostream/event.rb', line 39 def self.prepare_request_real(url, cmd) Evostream.request_real(URI.parse("#{url}/#{cmd}")) end |
.request_real(uri) ⇒ Object
51 52 53 54 |
# File 'lib/evostream/event.rb', line 51 def request_real(uri) http = Net::HTTP.new(uri.host, uri.port) http.request(Net::HTTP::Get.new(uri.request_uri)) end |
.request_test(command) ⇒ Object
46 47 48 49 |
# File 'lib/evostream/event.rb', line 46 def request_test(command) json = JSON.parse(File.read(find_fixture(command))) Net::HTTPSuccess.mock(json) end |