class SwaggerHubApiPusher::Configuration

Attributes

api_key[RW]
api_name[RW]
owner[RW]
swagger_file[RW]
version[RW]

Public Instance Methods

errors_messages() click to toggle source
# File lib/swagger_hub_api_pusher/configuration.rb, line 15
def errors_messages
  errors.map { |k, v| "#{k} #{v}" }.join(', ')
end
valid?() click to toggle source
# File lib/swagger_hub_api_pusher/configuration.rb, line 5
def valid?
  [:owner, :api_name, :api_key, :version, :swagger_file].each do |param|
    errors[param] = 'is blank' if is_blank?(public_send(param))
  end

  errors[:swagger_file] = 'not found' if !is_blank?(swagger_file) && file_not_found?

  errors.empty?
end

Private Instance Methods

errors() click to toggle source
# File lib/swagger_hub_api_pusher/configuration.rb, line 19
        def errors
  @errors ||= {}
end
file_not_found?() click to toggle source
# File lib/swagger_hub_api_pusher/configuration.rb, line 27
        def file_not_found?
  !File.exists?(swagger_file)
end
is_blank?(value) click to toggle source
# File lib/swagger_hub_api_pusher/configuration.rb, line 23
        def is_blank?(value)
  !value || value.empty?
end