mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
depp now rubocop ready
This commit is contained in:
parent
c0b6604ba9
commit
ce52e6e097
6 changed files with 23 additions and 32 deletions
4
vendor/gems/depp/Rakefile
vendored
4
vendor/gems/depp/Rakefile
vendored
|
@ -17,11 +17,8 @@ end
|
||||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
load 'rails/tasks/engine.rake'
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
load 'rails/tasks/statistics.rake'
|
load 'rails/tasks/statistics.rake'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bundler::GemHelper.install_tasks
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
|
@ -33,5 +30,4 @@ Rake::TestTask.new(:test) do |t|
|
||||||
t.verbose = false
|
t.verbose = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
task default: :test
|
task default: :test
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Depp
|
||||||
|
|
||||||
helper_method :depp_current_user
|
helper_method :depp_current_user
|
||||||
|
|
||||||
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |exception|
|
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception|
|
||||||
redirect_to login_url, alert: t(:no_connection_to_registry)
|
redirect_to login_url, alert: t(:no_connection_to_registry)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
22
vendor/gems/depp/app/models/depp/contact.rb
vendored
22
vendor/gems/depp/app/models/depp/contact.rb
vendored
|
@ -17,6 +17,9 @@ module Depp
|
||||||
]
|
]
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
attr_reader :epp_xml, :user
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/MethodLength
|
||||||
def new_from_params(params)
|
def new_from_params(params)
|
||||||
new(
|
new(
|
||||||
id: params[:code],
|
id: params[:code],
|
||||||
|
@ -36,9 +39,10 @@ module Depp
|
||||||
city: params[:city],
|
city: params[:city],
|
||||||
zip: params[:zip],
|
zip: params[:zip],
|
||||||
state: params[:state],
|
state: params[:state],
|
||||||
country_code: params[:country_code],
|
country_code: params[:country_code]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
|
||||||
def find_by_id(id)
|
def find_by_id(id)
|
||||||
data = info_xml(id)
|
data = info_xml(id)
|
||||||
|
@ -77,14 +81,6 @@ module Depp
|
||||||
@epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag)
|
@epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
def epp_xml
|
|
||||||
@epp_xml
|
|
||||||
end
|
|
||||||
|
|
||||||
def user
|
|
||||||
@user
|
|
||||||
end
|
|
||||||
|
|
||||||
def info_xml(id, password = nil)
|
def info_xml(id, password = nil)
|
||||||
xml = epp_xml.info(
|
xml = epp_xml.info(
|
||||||
id: { value: id },
|
id: { value: id },
|
||||||
|
@ -172,6 +168,7 @@ module Depp
|
||||||
handle_errors(data)
|
handle_errors(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/MethodLength
|
||||||
def update_attributes(params)
|
def update_attributes(params)
|
||||||
self.ident_country_code = params[:ident_country_code]
|
self.ident_country_code = params[:ident_country_code]
|
||||||
self.ident_type = params[:ident_type]
|
self.ident_type = params[:ident_type]
|
||||||
|
@ -215,6 +212,7 @@ module Depp
|
||||||
data = Depp::Contact.user.request(update_xml)
|
data = Depp::Contact.user.request(update_xml)
|
||||||
handle_errors(data)
|
handle_errors(data)
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/MethodLength
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
delete_xml = Contact.epp_xml.delete(
|
delete_xml = Contact.epp_xml.delete(
|
||||||
|
@ -275,18 +273,14 @@ module Depp
|
||||||
def handle_errors(data)
|
def handle_errors(data)
|
||||||
data.css('result').each do |x|
|
data.css('result').each do |x|
|
||||||
success_codes = %(1000, 1300, 1301)
|
success_codes = %(1000, 1300, 1301)
|
||||||
|
next if success_codes.include?(x['code'])
|
||||||
|
|
||||||
unless success_codes.include?(x['code'])
|
|
||||||
message = "#{x.css('msg').text} #{x.css('value').text}"
|
message = "#{x.css('msg').text} #{x.css('value').text}"
|
||||||
|
|
||||||
attr = message.split('[').last.strip.sub(']', '') if message.include?('[')
|
attr = message.split('[').last.strip.sub(']', '') if message.include?('[')
|
||||||
|
|
||||||
attr = :base if attr.nil?
|
attr = :base if attr.nil?
|
||||||
attr = 'phone' if attr == 'voice'
|
attr = 'phone' if attr == 'voice'
|
||||||
|
|
||||||
errors.add(attr, message)
|
errors.add(attr, message)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
errors.blank?
|
errors.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
3
vendor/gems/depp/bin/rails
vendored
3
vendor/gems/depp/bin/rails
vendored
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
# This command will automatically be run
|
||||||
|
# when you run "rails" with Rails 4 gems installed from the root of your application.
|
||||||
|
|
||||||
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
||||||
ENGINE_PATH = File.expand_path('../../lib/depp/engine', __FILE__)
|
ENGINE_PATH = File.expand_path('../../lib/depp/engine', __FILE__)
|
||||||
|
|
2
vendor/gems/depp/depp.gemspec
vendored
2
vendor/gems/depp/depp.gemspec
vendored
|
@ -1,4 +1,4 @@
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
# Maintain your gem's version:
|
# Maintain your gem's version:
|
||||||
require "depp/version"
|
require "depp/version"
|
||||||
|
|
2
vendor/gems/depp/lib/depp/sorted_country.rb
vendored
2
vendor/gems/depp/lib/depp/sorted_country.rb
vendored
|
@ -9,7 +9,7 @@ class SortedCountry
|
||||||
quick_options = options_for_select(quick_list + [['---', '']], selected)
|
quick_options = options_for_select(quick_list + [['---', '']], selected)
|
||||||
|
|
||||||
# no double select
|
# no double select
|
||||||
selected = quick_list.map{ |c| c.second }.include?(selected) ? '' : selected
|
selected = quick_list.map(&:second).include?(selected) ? '' : selected
|
||||||
|
|
||||||
all_options = options_for_select(all_sorted_truncated, selected)
|
all_options = options_for_select(all_sorted_truncated, selected)
|
||||||
quick_options + all_options
|
quick_options + all_options
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue