Skip to content

Conversation

@zhum
Copy link
Contributor

@zhum zhum commented Apr 17, 2018

simple and fast (but working well) support for http proxy.

@@ -1,3 +1,3 @@
class TelegramBotMiddleware
VERSION = "0.3.2"
VERSION = "0.3.3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/MutableConstant: Freeze mutable objects assigned to constants.

log_debug("Sending to chat: #{path} - #{query}")
self.class.post("/bot#{@config.token}/#{path}", query: query)
options=@def_options.clone
options[:query]=query

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.

def send_to_telegram(path, query)
log_debug("Sending to chat: #{path} - #{query}")
self.class.post("/bot#{@config.token}/#{path}", query: query)
options=@def_options.clone

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.

@def_options[:http_proxyport]=(@config.proxy_port || 1080).to_i
if ! @config.proxy_user.nil?
@def_options[:http_proxyuser]=@config.proxy_user
@def_options[:http_proxypass]=@config.proxy_pass || ''

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@def_options[:http_proxyaddr]=@config.proxy_addr
@def_options[:http_proxyport]=(@config.proxy_port || 1080).to_i
if ! @config.proxy_user.nil?
@def_options[:http_proxyuser]=@config.proxy_user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.

if ! @config.proxy_addr.nil?
@def_options[:http_proxyaddr]=@config.proxy_addr
@def_options[:http_proxyport]=(@config.proxy_port || 1080).to_i
if ! @config.proxy_user.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.
Layout/SpaceAfterNot: Do not leave space between ! and its argument.

@def_options={}
if ! @config.proxy_addr.nil?
@def_options[:http_proxyaddr]=@config.proxy_addr
@def_options[:http_proxyport]=(@config.proxy_port || 1080).to_i

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.

# proxy settings
@def_options={}
if ! @config.proxy_addr.nil?
@def_options[:http_proxyaddr]=@config.proxy_addr

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.


# proxy settings
@def_options={}
if ! @config.proxy_addr.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.
Layout/SpaceAfterNot: Do not leave space between ! and its argument.

raise ArgumentError.new("Config error: token can't be null || empty.") if @config.token.nil? || @config.token.empty?

# proxy settings
@def_options={}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Surrounding space missing for operator =.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 38.854% when pulling ec0ee2d on zhum:master into 8acd4da on MirkoMignini:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 38.854% when pulling ec0ee2d on zhum:master into 8acd4da on MirkoMignini:master.

@coveralls
Copy link

coveralls commented Apr 17, 2018

Coverage Status

Coverage decreased (-0.2%) to 38.854% when pulling ec0ee2d on zhum:master into 8acd4da on MirkoMignini:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants