Skip to content

Commit d18a969

Browse files
refactored
1 parent 2272e9e commit d18a969

8 files changed

+17
-8
lines changed

app/controllers/admin/bsa_protected_domains_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def release_to_auction
6767
private
6868

6969
def bsa_protected_domain_params
70-
# params.require(:bsa_protected_domain).permit(:domain_name, :registration_code, :order_id, :suborder_id, :create_date, :state)
71-
7270
params.require(:bsa_protected_domain).permit(:domain_name, :registration_code,
7371
:order_id, :suborder_id, :create_date, :state).tap do |whitelisted|
7472
whitelisted[:state] = whitelisted[:state].to_i if whitelisted[:state].is_a?(String)

app/jobs/fetch_godaddy_bsa_block_order_list_job.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def perform(status_name = QUEUED_FOR_ACTIVATION)
1313
fetch_block_order_list(offset: 0, status_name: status_name)
1414
end
1515

16+
# rubocop:disable Metrics/CognitiveComplexity
17+
# rubocop:disable Rails::SkipsModelValidations
1618
def fetch_block_order_list(offset:, status_name:)
1719
res = Bsa::BlockOrderListService.call(offset: offset, limit: LIMIT,
1820
q: { 'blockOrderStatus.name' => status_name })
@@ -28,6 +30,8 @@ def fetch_block_order_list(offset:, status_name:)
2830
offset += 1
2931
fetch_block_order_list(offset: offset, status_name: status_name)
3032
end
33+
# rubocop:enable Metrics/CognitiveComplexity
34+
# rubocop:enable Rails::SkipsModelValidations
3135

3236
def collect_bsa_values(res)
3337
res.body.list.map do |block_order|
@@ -39,8 +43,10 @@ def collect_bsa_values(res)
3943
registration_code: SecureRandom.hex,
4044
create_date: DateTime.parse(block_order['createdDt']),
4145
created_at: Time.zone.now,
42-
updated_at: Time.zone.now
46+
updated_at: Time.zone.now,
4347
}
4448
end
4549
end
4650
end
51+
52+
# rubocop:enable

app/jobs/update_godaddy_domains_status_job.rb

+2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ def serialize_suborders_block(suborders_block:, state:)
2828
end
2929
end
3030

31+
# rubocop:disable Rails::SkipsModelValidations
3132
def refresh_statuses(suborders_block:, state:)
3233
suborders_block.update_all(state: state)
3334
end
35+
# rubocop:enable Rails::SkipsModelValidations
3436
end

app/models/bsa_protected_domain.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BsaProtectedDomain < ApplicationRecord
1818
ACTIVE => 4,
1919
QUEUED_FOR_RELEASE => 5,
2020
RELEASE_IN_PROGRESS => 6,
21-
CLOSED => 7
21+
CLOSED => 7,
2222
}
2323

2424
class << self

app/models/bsa_protected_domain/ransackable.rb

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ def ransackable_attributes(*)
1010
authorizable_ransackable_attributes
1111
end
1212
end
13-
1413
end

app/services/bsa/application_service.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def connect(url:)
1818

1919
def headers(content_type: 'x-www-form-urlencoded')
2020
{
21-
'Content-Type' => "application/#{content_type}"
21+
'Content-Type' => "application/#{content_type}",
2222
}
2323
end
2424

2525
def token_format(token)
2626
{
27-
'Authorization' => "Bearer #{token}"
27+
'Authorization' => "Bearer #{token}",
2828
}
2929
end
3030

@@ -54,8 +54,10 @@ def expire_token_at(token)
5454
Time.at(payload['exp']).utc.in_time_zone
5555
end
5656

57+
# rubocop:disable Style/GlobalVars
5758
def redis
5859
@redis ||= Rails.env.test? ? $mock_redis : Redis.new(host: redist_host, port: redis_port, db: redis_db)
5960
end
61+
# rubocop:enable Style/GlobalVars
6062
end
6163
end

app/services/bsa/auth_service.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def check_for_expired_token
5151
def payload
5252
{
5353
'apiKey' => api_key,
54-
'space' => bsa
54+
'space' => bsa,
5555
}
5656
end
5757

app/services/bsa/block_order_list_service.rb

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class BlockOrderListService
55

66
attr_reader :sort_by, :order, :offset, :limit, :q
77

8+
# rubocop:disable Naming/UncommunicativeMethodParamName
89
def self.call(sort_by: nil, order: nil, offset: nil, limit: nil, q: {})
910
new(sort_by: sort_by, order: order, offset: offset, limit: limit, q: q).call
1011
end
@@ -16,6 +17,7 @@ def initialize(sort_by:, order:, offset:, limit:, q:)
1617
@limit = limit
1718
@q = q
1819
end
20+
# rubocop:enable Naming/UncommunicativeMethodParamName
1921

2022
def call
2123
http = connect(url: base_url)

0 commit comments

Comments
 (0)