Sha256: bc0bc7499c45a40c66b4f65abbe070716bc90425aee8739a504443e94d7649d9

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

require 'pgit'

module PGit
  module Validators
    class ProjectValidator < ActiveModel::Validator
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 lib/pgit/validators/project_validator.rb