docs/helpers/scope.md in evil-client-1.1.0 vs docs/helpers/scope.md in evil-client-2.0.0
- old
+ new
@@ -8,11 +8,14 @@
class CatsClient < Evil::Client
option :user, proc(&:to_s)
option :password, proc(&:to_s)
option :subdomain, proc(&:to_s)
- validate(:valid_subdomain) { %w[wild domestic].include? subdomain }
+ validate do
+ return if %w[wild domestic].include? subdomain
+ errors.add :invalid_subdomain, subdomain: subdomain
+ end
path { "https://#{subdomain}.example.com/" }
http_method "get"
security { basic_auth(user, password) }
end
@@ -37,10 +40,10 @@
scope :cats do
# scope-specific options
option :version, proc(&:to_i)
- validate(:supported_version) { version < 5 }
+ validate { errors.add :wrong_version unless version < 5 }
# scope-specific redefinition of the root settings
http_method { version.zero? ? :get : :post }
path { "cats/v#{version}" }
end