Class: PGit::Validators::ProjectValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/pgit/validators/project_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(project) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pgit/validators/project_validator.rb', line 6

def validate(project)
  project.get!

  unless project.respond_to?(:kind)
    project.errors[:curl] << "is not able to do the request. Please check your internet connection."
  end
#
  if project.respond_to?(:kind) && project.kind == 'error'
    project.errors[:base] << "Project api_token or id is not valid."
    puts project.errors.full_messages
  end
end