Skip to content

Commit

Permalink
fix: update validation logic to make input options less strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilias Tsangaris committed Jan 5, 2022
1 parent 3e9fb2d commit c469ebc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/ruby/lib/readme/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ def self.platform
PLATFORM = platform
DEFAULT_BUFFER_LENGTH = 1
ENDPOINT = "https://metrics.readme.io/v1/request"
USER_INFO_KEYS = [:api_key, :label, :email]
USER_INFO_KEYS_DEPRECATED = [:id, :label, :email]

def self.logger
@@logger
Expand Down Expand Up @@ -148,11 +146,9 @@ def is_a_boolean?(arg)
end

def user_info_valid?(user_info)
sorted_user_info_keys = user_info.keys.sort
!user_info.nil? &&
!user_info.values.any?(&:nil?) &&
(sorted_user_info_keys === USER_INFO_KEYS.sort ||
sorted_user_info_keys === USER_INFO_KEYS_DEPRECATED.sort)
user_info.has_key?(:api_key) || user_info.has_key?(:id)
end
end
end

0 comments on commit c469ebc

Please sign in to comment.