Commit 86c006f4 authored by Sergey Gernyak's avatar Sergey Gernyak

FIX: some styling 😄

parent 574c4cc2
......@@ -2,7 +2,6 @@ module BetfairApiNgRails
module Api
module Caching
module Helper
def createsig(body)
Digest::MD5.hexdigest sigflat(body)
end
......@@ -29,8 +28,7 @@ module BetfairApiNgRails
end
res || body
end
end
end
end
end
\ No newline at end of file
end
......@@ -6,7 +6,6 @@ module BetfairApiNgRails
module Caching
class ResponseCache
include Api::Caching::Helper
attr_reader :method, :sig_params
def initialize(method, params)
......@@ -31,7 +30,7 @@ module BetfairApiNgRails
cache_adapter.expire cache_key, expire_time
end
private
private
def cache_result
@_cache_result ||= cache_adapter.get cache_key
......@@ -52,8 +51,7 @@ module BetfairApiNgRails
def cache_key
"betfair_api_ng_rails:#{method}:#{sig_params}"
end
end
end
end
end
\ No newline at end of file
end
......@@ -4,7 +4,6 @@ module BetfairApiNgRails
module Api
module Concerns
module Errorable
def has_errors?
!error_info.nil?
end
......@@ -12,8 +11,7 @@ module BetfairApiNgRails
def error_info
@http_responser.try(:error_info?)
end
end
end
end
end
\ No newline at end of file
end
......@@ -4,18 +4,16 @@ module BetfairApiNgRails
module Api
class FormatterFactory
class << self
def initialize_formatter(name)
name.is_a?(Symbol) ? initialize_formatter_by(name: name) : name.try(:new)
end
private
private
def initialize_formatter_by(name: "")
"BetfairApiNgRails::Api::Formatters::#{name.to_s.camelize}Formatter".constantize.new
end
end
end
end
end
\ No newline at end of file
end
......@@ -5,14 +5,13 @@ module BetfairApiNgRails
module Api
module Formatters
class JsTreeFormatter
ALLOW_CHILDREN = [:event_types, :competitions]
def process(result, as: '')
result.map { |r| format_record(r, resource_from_method(as)) }
end
private
private
def resource_from_method(method)
method.underscore.gsub(/^list_/, '').to_sym
......@@ -31,8 +30,7 @@ module BetfairApiNgRails
}
}
end
end
end
end
end
\ No newline at end of file
end
......@@ -17,7 +17,7 @@ module BetfairApiNgRails
end
end
private
private
def hash_value(val)
need_to_hash?(val) ? hashing_val(val) : val
......@@ -34,7 +34,6 @@ module BetfairApiNgRails
def hash_key(key)
key.to_s.camelize(:lower)
end
end
end
end
\ No newline at end of file
end
......@@ -28,7 +28,7 @@ module BetfairApiNgRails
end
end
private
private
def create_http_requester(url = '', provider = true)
if !Api::Config.proxy_enable
......
......@@ -3,7 +3,6 @@ module BetfairApiNgRails
module Http
module Helpers
module InformationResponse
def self.included(base)
base.send :class_eval, <<-CODE
def has_error_with_info_response?
......@@ -18,7 +17,7 @@ module BetfairApiNgRails
result['result']
end
protected
protected
def info_response_error?
set_error_info(:API, result['error']) if check_info_response_status
......@@ -27,9 +26,8 @@ module BetfairApiNgRails
def check_info_response_status
result.has_key?('error')
end
end
end
end
end
end
\ No newline at end of file
end
......@@ -4,7 +4,7 @@ module BetfairApiNgRails
module Helpers
module KeepAliveResponse
include BetfairApiNgRails::Api::Constants
def self.included(base)
base.send :class_eval, <<-CODE
def has_error_with_keep_alive_response?
......@@ -15,7 +15,7 @@ module BetfairApiNgRails
CODE
end
protected
protected
def keep_alive_res_error?
set_error_info(:KEEP_ALIVE, result['status']) if check_keep_alive_status
......@@ -24,9 +24,8 @@ module BetfairApiNgRails
def check_keep_alive_status
result.fetch('status', SUCCESS_LOGIN) != SUCCESS_LOGIN
end
end
end
end
end
end
\ No newline at end of file
end
......@@ -4,7 +4,7 @@ module BetfairApiNgRails
module Helpers
module SessionResponse
include BetfairApiNgRails::Api::Constants
def self.included(base)
base.send :class_eval, <<-CODE
def has_error_with_session_response?
......@@ -19,7 +19,7 @@ module BetfairApiNgRails
result['sessionToken']
end
protected
protected
def session_res_error?
set_error_info(:SESSION, result['loginStatus']) if check_login_status
......@@ -28,9 +28,8 @@ module BetfairApiNgRails
def check_login_status
result.fetch('loginStatus', SUCCESS_LOGIN) != SUCCESS_LOGIN
end
end
end
end
end
end
\ No newline at end of file
end
......@@ -75,7 +75,7 @@ module BetfairApiNgRails
app_key: app_key,
session_token: session_key,
body: body
})
})
end
end
end
......
......@@ -27,7 +27,7 @@ module BetfairApiNgRails
include Api::Http::Helpers::KeepAliveResponse
include Api::Http::Helpers::SessionResponse
protected
protected
def http_error?
set_error_info(:HTTP, response.code) if check_response_code
......@@ -40,8 +40,7 @@ module BetfairApiNgRails
def set_error_info(type, info)
@error_info = { type: type, info: info }
end
end
end
end
end
\ No newline at end of file
end
......@@ -14,7 +14,7 @@ module BetfairApiNgRails
private
def run_request(method, params, account_name = '')
BetfairApiNgRails::Api::Connection.new(account_name).request build_request_type(method), params#, account_name
BetfairApiNgRails::Api::Connection.new(account_name).request build_request_type(method), params
end
def build_request_type(name)
......
module BetfairApiNgRails
class NoConnectionError < ::StandardError
end
......@@ -9,5 +8,4 @@ module BetfairApiNgRails
@info = info
end
end
end
\ No newline at end of file
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment