Class: LingutestClient::Examination

Inherits:
Base
  • Object
show all
Includes:
Api::Operations::Create, Api::Operations::Find, Api::Resource
Defined in:
lib/lingutest_client/examination.rb

Constant Summary collapse

OBJECT_NAME =
:examination
STATUSES =
%w[
  pending
  in_progress
  completed
  pending_review
  reviewed
].freeze
CreateSchema =
Dry::Schema.Params do
  required(:exam_id).filled(Types::Coercible::Integer)
  required(:candidate_id).filled(Types::Coercible::Integer)
  required(:expires_at).filled(Types::DateTime)
  optional(:redirect_url).filled(Types::Url)

  optional(:team_id).filled(Types::Coercible::String)
  optional(:team_group_id).filled(Types::Coercible::String)
  optional(:student_id).filled(Types::Coercible::String)
end
FilterSchema =
Dry::Schema.Params do
  config.validate_keys = true
  optional(:page).filled(Types::Coercible::Integer)
  optional(:per_page).filled(Types::Coercible::Integer)

  optional(:team_id_eq).filled(Types::Coercible::String)
  optional(:team_group_id_eq).filled(Types::Coercible::String)
  optional(:student_id_eq).filled(Types::Coercible::String)
  optional(:candidate_id_eq).filled(Types::Coercible::String)

  optional(:price_gteq).filled(Types::Coercible::Integer)
  optional(:created_at_gteq).filled(Types::DateTime)
  optional(:created_at_lteq).filled(Types::DateTime)
end

Instance Method Summary collapse

Methods included from Api::Operations::Find

included

Methods included from Api::Operations::Create

included

Methods included from Api::Resource

included

Methods inherited from Base

#to_hash

Instance Method Details

#result_urlObject



71
72
73
# File 'lib/lingutest_client/examination.rb', line 71

def result_url
  URI.join(LingutestClient.config.api_base.to_s, "/examinations/#{code}").to_s
end

#urlObject



67
68
69
# File 'lib/lingutest_client/examination.rb', line 67

def url
  URI.join(LingutestClient.config.api_base.to_s, "/#{code}").to_s
end