index int64 0 0 | repo_id stringclasses 829
values | file_path stringlengths 34 254 | content stringlengths 6 5.38M |
|---|---|---|---|
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/mdot/configuration.rb | # frozen_string_literal: true
require 'common/client/configuration/rest'
module MDOT
class Configuration < Common::Client::Configuration::REST
self.open_timeout = Settings.mdot.timeout || 5
self.read_timeout = Settings.mdot.timeout || 5
def service_name
'MDOT'
end
def base_path
Set... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/mdot/address.rb | # frozen_string_literal: true
require 'vets/model'
module MDOT
class Address
include Vets::Model
attribute :street, String
attribute :street2, String
attribute :city, String
attribute :state, String
attribute :country, String
attribute :postal_code, String
attribute :is_military_bas... |
0 | code_files/vets-api-private/lib/mdot | code_files/vets-api-private/lib/mdot/exceptions/service_exception.rb | # frozen_string_literal: true
require 'common/exceptions/backend_service_exception'
module MDOT
module Exceptions
class ServiceException < Common::Exceptions::BackendServiceException
include Vets::SharedLogging
def initialize(exception, response_values = {}, original_status = nil, original_body = n... |
0 | code_files/vets-api-private/lib/mdot | code_files/vets-api-private/lib/mdot/exceptions/key.rb | # frozen_string_literal: true
module MDOT
class ExceptionKey
attr_reader :key, :i18n_key
def initialize(key)
@default_exception = 'default_exception'
@key = validate_key(key)
@i18n_key = "mdot.exceptions.#{@key}"
end
private
def key_exists?(key)
I18n.exists?("mdot.excep... |
0 | code_files/vets-api-private/lib/mdot | code_files/vets-api-private/lib/mdot/schemas/submit.json | {
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"required": ["useTemporaryAddress", "status", "orderId"],
"properties": {
"useTemporaryAddress": {
"type": "boolean"
},
"status": {
"type": "string"
},
"orderId": {
"type": "string"
},
"addi... |
0 | code_files/vets-api-private/lib/mdot | code_files/vets-api-private/lib/mdot/schemas/supplies.json | {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "",
"type": "object",
"required": ["supplies"],
"anyOf": [
{ "required": ["permanent_address"] },
{ "required": ["temporary_address"] }
],
"properties": {
"permanent_address": {
"type": ["object", "null"],
"stre... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/va_profile/stats.rb | # frozen_string_literal: true
require 'va_profile/service'
module VAProfile
class Stats
STATSD_KEY_PREFIX = 'api.va_profile'
FINAL_SUCCESS = %w[COMPLETED_SUCCESS COMPLETED_NO_CHANGES_DETECTED].freeze
FINAL_FAILURE = %w[REJECTED COMPLETED_FAILURE].freeze
class << self
# Triggers the associated... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/va_profile/response.rb | # frozen_string_literal: true
require 'common/client/concerns/service_status'
require 'vets/model'
module VAProfile
class Response
include Vets::Model
include Common::Client::Concerns::ServiceStatus
attribute :status, Integer
alias to_h attributes
alias to_hash attributes
def initialize(s... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/va_profile/configuration.rb | # frozen_string_literal: true
require 'common/client/configuration/rest'
require_relative 'models/base'
module VAProfile
class Configuration < Common::Client::Configuration::REST
SETTINGS = Rails.env.production? ? Settings.va_profile : Settings.vet360
def self.base_request_headers
super.merge('cufSys... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/va_profile/service.rb | # frozen_string_literal: true
require 'common/client/base'
require 'common/client/errors'
require 'common/exceptions/backend_service_exception'
require 'common/exceptions/forbidden'
require_relative 'exceptions/parser'
require_relative 'models/message'
require_relative 'stats'
module VAProfile
class Service < Commo... |
0 | code_files/vets-api-private/lib/va_profile/address_validation | code_files/vets-api-private/lib/va_profile/address_validation/v3/address_suggestions_response.rb | # frozen_string_literal: true
require 'va_profile/models/validation_address'
require_relative 'service'
module VAProfile
module AddressValidation
module V3
# Wrapper for response from VA profile address validation API.
# Contains address suggestions and validation key used to ignore suggested addres... |
0 | code_files/vets-api-private/lib/va_profile/address_validation | code_files/vets-api-private/lib/va_profile/address_validation/v3/configuration.rb | # frozen_string_literal: true
require 'va_profile/configuration'
module VAProfile
module AddressValidation
module V3
class Configuration < VAProfile::Configuration
def base_path
"https://#{VAProfile::Configuration::SETTINGS.address_validation.hostname}/services/address-validation/v3/"
... |
0 | code_files/vets-api-private/lib/va_profile/address_validation | code_files/vets-api-private/lib/va_profile/address_validation/v3/service.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/exceptions'
require_relative 'configuration'
require_relative 'address_suggestions_response'
require 'va_profile/service'
require 'va_profile/stats'
module VAProfile
module AddressValidation
module V3
# Wrapper for t... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/person/service.rb | # frozen_string_literal: true
require 'common/client/base'
require 'common/client/concerns/monitoring'
require 'va_profile/contact_information/v2/configuration'
require 'va_profile/contact_information/v2/transaction_response'
require 'va_profile/service'
require 'va_profile/stats'
require 'identity/parsers/gc_ids_cons... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/demographics/gender_identity_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/gender_identity'
module VAProfile
module Demographics
class GenderIdentityResponse < VAProfile::Response
attribute :gender_identity, VAProfile::Models::GenderIdentity
def code
gender_identity&.code
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/demographics/preferred_name_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/preferred_name'
module VAProfile
module Demographics
class PreferredNameResponse < VAProfile::Response
attribute :preferred_name, VAProfile::Models::PreferredName
def text
preferred_name&.text
end
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/demographics/configuration.rb | # frozen_string_literal: true
require 'va_profile/configuration'
module VAProfile
module Demographics
class Configuration < VAProfile::Configuration
self.read_timeout = VAProfile::Configuration::SETTINGS.demographics.timeout || 30
def base_path
"#{VAProfile::Configuration::SETTINGS.url}/dem... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/demographics/demographic_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/demographic'
module VAProfile
module Demographics
class DemographicResponse < VAProfile::Response
attribute :demographics, VAProfile::Models::Demographic
def self.from(opts = {})
status = opts[:status]
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/demographics/service.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
require 'va_profile/stats'
require_relative 'configuration'
require_relative 'demographic_response'
require_relative 'preferred_name_response'
require_relative 'gender_identity_response... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/prefill/military_information.rb | # frozen_string_literal: true
require 'va_profile/military_personnel/service'
module VAProfile
module Prefill
class MilitaryInformation
PREFILL_METHODS = %w[
currently_active_duty
currently_active_duty_hash
discharge_type
guard_reserve_service_history
hca_last_servi... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/base.rb | # frozen_string_literal: true
require 'vets/model'
module VAProfile
module Models
class Base
include Vets::Model
SOURCE_SYSTEM = 'VETSGOV'
alias to_h attributes
alias to_hash attributes
end
end
end
|
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/gender_identity.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'vets/model'
module VAProfile
module Models
class GenderIdentity < Base
include VAProfile::Concerns::Defaultable
include Vets::Model
CODES = %w[M F TM TF B N O].freeze
OPTIONS = {
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/validation_address.rb | # frozen_string_literal: true
require_relative 'base_address'
require 'common/hash_helpers'
module VAProfile
module Models
# Model for addresses sent and received from the VA profile address validation API
# AddressValidationV is used for ProfileServiceV3 and ContactInformationV2
class ValidationAddress... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/military_occupation.rb | # frozen_string_literal: true
require_relative 'base'
module VAProfile
module Models
class MilitaryOccupation < Base
attribute :service_segment_sequence, Integer
attribute :occupation_segment_sequence, Integer
attribute :occupation_type_code, String
attribute :occupation_type_text, Strin... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/communication_item.rb | # frozen_string_literal: true
require_relative 'communication_base'
require_relative 'communication_channel'
module VAProfile
module Models
class CommunicationItem < CommunicationBase
attr_accessor :id, :name, :communication_channels
attr_reader :communication_channel
validates :id, :communic... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/person_option.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'va_profile/concerns/expirable'
module VAProfile
module Models
class PersonOption < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
attribute :id, Integ... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/veteran_status.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
module VAProfile
module Models
class VeteranStatus < Base
include VAProfile::Concerns::Defaultable
attribute :title38_status_code, String
validates :title38_status_code, presence: true, length: { ma... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/communication_base.rb | # frozen_string_literal: true
module VAProfile
module Models
class CommunicationBase
include ActiveModel::Model
end
end
end
|
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/email.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'va_profile/concerns/expirable'
module VAProfile
module Models
class Email < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
VALID_EMAIL_REGEX = /.+@.+\.... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/demographic.rb | # frozen_string_literal: true
require_relative 'base'
require_relative 'gender_identity'
require_relative 'preferred_name'
module VAProfile
module Models
class Demographic < Base
attribute :id, String
attribute :type, String
attribute :gender, String
attribute :birth_date, String
a... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/preferred_name.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
module VAProfile
module Models
class PreferredName < Base
include ActiveModel::Validations::Callbacks
include VAProfile::Concerns::Defaultable
attribute :text, String
attribute :source_system... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/base_address.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'va_profile/concerns/expirable'
module VAProfile
module Models
class BaseAddress < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
VALID_ALPHA_REGEX = /... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/communication_channel.rb | # frozen_string_literal: true
require_relative 'communication_base'
require_relative 'communication_permission'
module VAProfile
module Models
class CommunicationChannel < CommunicationBase
attr_accessor :id, :name, :description, :default_send_indicator
attr_reader :communication_permission
v... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/message.rb | # frozen_string_literal: true
require_relative 'base'
module VAProfile
module Models
class Message < Base
SEVERITY_LEVELS = %w[
INFO
WARN
ERROR
FATAL
].freeze
attribute :code, String
attribute :key, String
attribute :retryable, Bool
attribute ... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/transaction.rb | # frozen_string_literal: true
require_relative 'base'
require_relative 'message'
module VAProfile
module Models
class Transaction < Base
STATUSES = %w[
REJECTED
RECEIVED
RECEIVED_ERROR_QUEUE
RECEIVED_DEAD_LETTER_QUEUE
COMPLETED_SUCCESS
COMPLETED_NO_CHANGES_D... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/service_history.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
module VAProfile
module Models
class ServiceHistory < Base
include VAProfile::Concerns::Defaultable
MILITARY_SERVICE = 'Military Service'
MILITARY_SERVICE_EPISODE = 'military_service_episodes'
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/communication_permission.rb | # frozen_string_literal: true
require_relative 'communication_base'
module VAProfile
module Models
class CommunicationPermission < CommunicationBase
attr_accessor :allowed
attr_reader :id
validates :allowed, inclusion: { in: [true, false], message: 'must be set' }
def id=(val)
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/communication_item_group.rb | # frozen_string_literal: true
require_relative 'communication_base'
require_relative 'communication_item'
module VAProfile
module Models
class CommunicationItemGroup < CommunicationBase
attr_accessor :name, :description, :communication_items, :id
def self.create_groups(items_res, permission_res)
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/telephone.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'va_profile/concerns/expirable'
module VAProfile
module Models
class Telephone < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
VALID_COUNTRY_CODE_REGE... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/associated_person.rb | # frozen_string_literal: true
require_relative 'base'
module VAProfile
module Models
class AssociatedPerson < Base
EMERGENCY_CONTACT = 'Emergency Contact'
OTHER_EMERGENCY_CONTACT = 'Other emergency contact'
PRIMARY_NEXT_OF_KIN = 'Primary Next of Kin'
OTHER_NEXT_OF_KIN = 'Other Next of Ki... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/person.rb | # frozen_string_literal: true
require_relative 'address'
require_relative 'base'
require_relative 'email'
require_relative 'telephone'
module VAProfile
module Models
class Person < Base
attribute :addresses, Address, array: true
attribute :created_at, Vets::Type::ISO8601Time
attribute :emails,... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/permission.rb | # frozen_string_literal: true
require_relative 'base'
require 'va_profile/concerns/defaultable'
require 'va_profile/concerns/expirable'
module VAProfile
module Models
class Permission < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
TEXT = 'TextPermission... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/models/address.rb | # frozen_string_literal: true
require_relative 'base_address'
module VAProfile
module Models
class Address < BaseAddress
attribute :bad_address, Bool
validates(:source_date, presence: true)
# Converts a decoded JSON response from VAProfile to an instance of the Address model
# @param b... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/exceptions/builder.rb | # frozen_string_literal: true
require 'yaml'
require 'csv'
require_relative 'parser'
module VAProfile
module Exceptions
class Builder
attr_reader :known_exceptions, :stats, :error_codes, :needs_title, :needs_detail, :title, :detail, :status
def initialize
@known_exceptions = VAProfile::Exce... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/exceptions/parser.rb | # frozen_string_literal: true
require 'singleton'
module VAProfile
module Exceptions
# This class parses all of the VAProfile exception keys from config/locales/exceptions.en.yml
# and saves them to an instance variable. For performance reasons, the Singleton Pattern
# is used. This allows the file sy... |
0 | code_files/vets-api-private/lib/va_profile/contact_information | code_files/vets-api-private/lib/va_profile/contact_information/v2/person_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/person'
module VAProfile
module ContactInformation
module V2
class PersonResponse < VAProfile::Response
attribute :person, VAProfile::Models::Person
attr_reader :response_body
def self.from(raw... |
0 | code_files/vets-api-private/lib/va_profile/contact_information | code_files/vets-api-private/lib/va_profile/contact_information/v2/transaction_response.rb | # frozen_string_literal: true
require 'va_profile/models/transaction'
require 'va_profile/response'
require 'vets/shared_logging'
# rubocop:disable ThreadSafety/ClassInstanceVariable
module VAProfile
module ContactInformation
module V2
class TransactionResponse < VAProfile::Response
extend Vets::S... |
0 | code_files/vets-api-private/lib/va_profile/contact_information | code_files/vets-api-private/lib/va_profile/contact_information/v2/configuration.rb | # frozen_string_literal: true
require 'va_profile/configuration'
module VAProfile
module ContactInformation
module V2
class Configuration < VAProfile::Configuration
self.read_timeout = VAProfile::Configuration::SETTINGS.contact_information.timeout || 30
def base_path
"#{VAProfil... |
0 | code_files/vets-api-private/lib/va_profile/contact_information | code_files/vets-api-private/lib/va_profile/contact_information/v2/service.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
require 'va_profile/stats'
require_relative 'configuration'
require_relative 'transaction_response'
require_relative 'person_response'
module VAProfile
module ContactInformation
... |
0 | code_files/vets-api-private/lib/va_profile/profile | code_files/vets-api-private/lib/va_profile/profile/v3/bio_path_builder.rb | # frozen_string_literal: true
module VAProfile
module Profile
module V3
class BioPathBuilder
BIO_PATHS = {
military_admin_decisions: 'militaryPerson.adminDecisions',
military_admin_eposides: 'militaryPerson.adminEpisodes',
military_dental_indicators: 'militaryPerson.de... |
0 | code_files/vets-api-private/lib/va_profile/profile | code_files/vets-api-private/lib/va_profile/profile/v3/military_occupation_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/military_occupation'
module VAProfile::Profile::V3
class MilitaryOccupationResponse < VAProfile::Response
attribute :military_occupations, VAProfile::Models::MilitaryOccupation, array: true, default: []
attribute :message... |
0 | code_files/vets-api-private/lib/va_profile/profile | code_files/vets-api-private/lib/va_profile/profile/v3/configuration.rb | # frozen_string_literal: true
require 'common/client/configuration/rest'
module VAProfile
module Profile
module V3
##
# HTTP client configuration for the {VAProfile::Profile::V3::Service},
# sets the base path, the base request headers, and a service name for breakers and metrics.
#
... |
0 | code_files/vets-api-private/lib/va_profile/profile | code_files/vets-api-private/lib/va_profile/profile/v3/health_benefit_bio_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/associated_person'
require 'va_profile/models/message'
module VAProfile
module Profile
module V3
class HealthBenefitBioResponse < VAProfile::Response
attribute :code, String
attribute :contacts, VAProfil... |
0 | code_files/vets-api-private/lib/va_profile/profile | code_files/vets-api-private/lib/va_profile/profile/v3/service.rb | # frozen_string_literal: true
require_relative 'bio_path_builder'
require_relative 'configuration'
require_relative 'health_benefit_bio_response'
require_relative 'military_occupation_response'
require 'digest'
module VAProfile
module Profile
module V3
# NOTE: This controller is used for discovery purpose... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/veteran_status/va_profile_error.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
module VAProfile
module VeteranStatus
class VAProfileError < StandardError
attr_reader :status
# @param status [Integer] An HTTP status code
#
def initia... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/veteran_status/veteran_status_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require_relative '../models/veteran_status'
module VAProfile
module VeteranStatus
class VeteranStatusResponse < VAProfile::Response
attribute :title38_status_code, VAProfile::Models::VeteranStatus
def self.from(_, response = nil)
b... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/veteran_status/configuration.rb | # frozen_string_literal: true
require 'va_profile/configuration'
module VAProfile
module VeteranStatus
class Configuration < VAProfile::Configuration
self.read_timeout = 30
def base_path
"#{VAProfile::Configuration::SETTINGS.url}/profile-service/profile/v3"
end
def service_name... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/veteran_status/service.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
require 'va_profile/stats'
require 'va_profile/models/veteran_status'
require_relative 'configuration'
require_relative 'veteran_status_response'
require 'va_profile/veteran_status/va_p... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/communication/configuration.rb | # frozen_string_literal: true
module VAProfile
module Communication
class Configuration < VAProfile::Configuration
def base_path
"#{VAProfile::Configuration::SETTINGS.url}/communication-hub/communication/v1/"
end
def service_name
'VAProfile/Communication'
end
end
en... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/communication/service.rb | # frozen_string_literal: true
require_relative 'configuration'
require 'va_profile/models/communication_item_group'
module VAProfile
module Communication
class Service < VAProfile::Service
include Common::Client::Concerns::Monitoring
STATSD_KEY_PREFIX = "#{VAProfile::Service::STATSD_KEY_PREFIX}.com... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/military_personnel/service_history_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/service_history'
module VAProfile
module MilitaryPersonnel
class ServiceHistoryResponse < VAProfile::Response
attribute :episodes, VAProfile::Models::ServiceHistory, array: true, default: []
attribute :uniformed_s... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/military_personnel/configuration.rb | # frozen_string_literal: true
require 'va_profile/configuration'
module VAProfile
module MilitaryPersonnel
class Configuration < VAProfile::Configuration
self.read_timeout = VAProfile::Configuration::SETTINGS.military_personnel.timeout || 30
def base_path
"#{VAProfile::Configuration::SETTIN... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/military_personnel/service.rb | # frozen_string_literal: true
require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
require 'va_profile/stats'
require 'va_profile/models/service_history'
require_relative 'configuration'
require_relative 'service_history_response'
##
# @see https://qa.vaprofile.va.go... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/concerns/defaultable.rb | # frozen_string_literal: true
module VAProfile
module Concerns
module Defaultable
extend ActiveSupport::Concern
# Sets the included default values
#
# @param user [User] The user associated with the transaction
# @return [VAProfile::Models::Base] A VAProfile::Models::Base instance,... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/concerns/expirable.rb | # frozen_string_literal: true
module VAProfile
module Concerns
module Expirable
extend ActiveSupport::Concern
included do
validate :effective_end_date_has_passed
end
private
# Raises validation error if the model's effective_end_date is past
#
# @param user [U... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/person_settings/configuration.rb | # frozen_string_literal: true
module VAProfile
module PersonSettings
class Configuration < VAProfile::Configuration
self.read_timeout = 30
def base_path
"#{VAProfile::Configuration::SETTINGS.url}/settings-hub/"
end
def service_name
'VAProfile/PersonSettings'
end
... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/person_settings/person_options_response.rb | # frozen_string_literal: true
require 'va_profile/response'
require 'va_profile/models/person_option'
module VAProfile
module PersonSettings
class PersonOptionsResponse < VAProfile::Response
attribute :person_options, Array
def self.from(raw_response = nil)
response_body = raw_response&.bod... |
0 | code_files/vets-api-private/lib/va_profile | code_files/vets-api-private/lib/va_profile/person_settings/service.rb | # frozen_string_literal: true
# Service layer for interacting with VAProfile Person Settings API. This service is still under
# development and not fully integrated, gated behind the profile_scheduling_preferences
# feature flag via the SchedulingPreferencesController.
require 'va_profile/person_settings/person_optio... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/file_helpers.rb | # frozen_string_literal: true
module Common
module FileHelpers
module_function
def delete_file_if_exists(path)
File.delete(path) if path && File.exist?(path)
end
def random_file_path(file_ext = '')
"tmp/#{SecureRandom.hex}#{file_ext}"
end
def generate_random_file(file_body, fil... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/virus_scan.rb | # frozen_string_literal: true
require 'clamav/commands/patch_scan_command'
require 'clamav/patch_client'
module Common
module VirusScan
module_function
def scan(file_path)
# `clamd` runs within service group, needs group read
raise 'Failed to create temp file' unless File.exist?(file_path)
... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/pdf_helpers.rb | # frozen_string_literal: true
require 'hexapdf'
require 'vets/shared_logging'
module Common
module PdfHelpers
extend Vets::SharedLogging
def self.unlock_pdf(input_file, password, output_file)
doc = HexaPDF::Document.open(input_file, decryption_opts: { password: })
doc.encrypt(name: nil)
d... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/exceptions.rb | # frozen_string_literal: true
module Common
module Exceptions
end
end
# require each exception file`
Dir['lib/common/exceptions/**/*.rb'].each { |file| require file.gsub('lib/', '') }
|
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/README.md | ## Common::Exceptions
Common::Exceptions is a library intended to help make exception classes serializable.
It is particularly suited for helping to render JSONAPI style errors. It is divided into
two types, `internal` exceptions that are raised within the various models and controllers
of your Rails application and ... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/convert_to_pdf.rb | # frozen_string_literal: true
require 'common/file_helpers'
module Common
class ConvertToPdf
def initialize(file)
@file = file
end
def run
in_file = Common::FileHelpers.generate_clamav_temp_file(@file.read)
return in_file if @file.content_type == Mime[:pdf].to_s
unless @file.co... |
0 | code_files/vets-api-private/lib | code_files/vets-api-private/lib/common/hash_helpers.rb | # frozen_string_literal: true
module Common
module HashHelpers
module_function
def deep_transform_parameters!(val, &)
# rails 5.1 no longer has deep_transform_keys!
# because params are no longer inheriting from HashWithIndifferentAccess
case val
when Array
val.map { |v| deep... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/models/base.rb | # frozen_string_literal: true
require 'active_model'
require 'common/models/attribute_types/utc_time'
module Common
# This is a base serialization class
class Base
extend ActiveModel::Naming
include ActiveModel::Serialization
include Comparable
include Virtus.model(nullify_blank: true)
attr_a... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/models/collection.rb | # frozen_string_literal: true
require 'forwardable'
require 'common/models/comparable/ascending'
require 'common/models/comparable/descending'
require 'common/exceptions'
module Common
# Wrapper for collection to keep aggregates
class Collection
include ActiveModel::Serialization
extend ActiveModel::Namin... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/models/redis_store.rb | # frozen_string_literal: true
module Common
class RedisStore
extend ActiveModel::Naming
extend ActiveModel::Callbacks
include ActiveModel::Serialization
include ActiveModel::Validations
include Virtus.model(nullify_blank: true)
define_model_callbacks :initialize, only: :after
REQ_CLASS... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/models/resource.rb | # frozen_string_literal: true
require 'dry-types'
require 'dry-struct'
module Types
include Dry.Types(default: :nominal)
end
module Common
class Resource < Dry::Struct
end
end
|
0 | code_files/vets-api-private/lib/common/models | code_files/vets-api-private/lib/common/models/comparable/ascending.rb | # frozen_string_literal: true
# This is just a wrapper around an object to compare in descending order
# This is invoked by collection.rb
module Common
class Ascending
include Comparable
attr_reader :obj
def initialize(obj)
@obj = obj
end
# This will always force nil values to the end
... |
0 | code_files/vets-api-private/lib/common/models | code_files/vets-api-private/lib/common/models/comparable/descending.rb | # frozen_string_literal: true
# This is just a wrapper around an object to compare in descending order
# This is invoked by collection.rb
module Common
class Descending
include Comparable
attr_reader :obj
def initialize(obj)
@obj = obj
end
# This will always force nil values to the end
... |
0 | code_files/vets-api-private/lib/common/models | code_files/vets-api-private/lib/common/models/attribute_types/utc_time.rb | # frozen_string_literal: true
module Common
# This is a custom type class for ensuring Time is always coerced as UTC
class UTCTime < Virtus::Attribute
def coerce(value)
return nil if value.to_s.empty?
return Time.parse(value).utc if value.is_a?(String)
value.utc
end
end
end
|
0 | code_files/vets-api-private/lib/common/models | code_files/vets-api-private/lib/common/models/concerns/cache_aside.rb | # frozen_string_literal: true
require 'common/models/redis_store'
module Common
# Cache Aside pattern for caching responses in redis.
# Requires the class mixing it in to be a Common::RedisStore and the
# cached response class to implement a #cache? method.
module CacheAside
extend ActiveSupport::Concern... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/invalid_field.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# InvalidField - field is invalid
class InvalidField < BaseError
attr_reader :field, :type
def initialize(field, type)
@field = field
... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/invalid_filters_syntax.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# InvalidFiltersSyntax - filter keys are invalid
class InvalidFiltersSyntax < BaseError
attr_reader :filters
def initialize(filters, options = {})
... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/token_validation_error.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# Validation Error - an ActiveModel having validation errors, can be sent to this exception
class TokenValidationError < BaseError
attr_reader :code, :det... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/unexpected_forbidden.rb | # frozen_string_literal: true
require 'common/exceptions/forbidden'
module Common
module Exceptions
# Forbidden is excluded from Sentry logging. This exception is a duplicate
# that IS NOT excluded from Sentry logging
class UnexpectedForbidden < Forbidden
def i18n_key
"common.exceptions.#{... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/invalid_pagination_params.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# Invalid Pagination Params - if page or per_page params are invalid
class InvalidPaginationParams < BaseError
attr_reader :pagination_params
def i... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/forbidden.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# Forbidden - We may eventually want different variations on this with distinct MinorCodes
class Forbidden < BaseError
def initialize(options = {})
... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/timeout_error.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
module Common
module Exceptions
class Timeout < BaseError
def errors
Array(SerializableError.new(i18n_data))
end
end
end
end
|
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/parameter_missing.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# Parameter Missing - required parameter was not provided
class ParameterMissing < BaseError
attr_reader :param
def initialize(param, options = {})... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/invalid_sort_criteria.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
# InvalidSortCriteria - sort criteria is invalid
class InvalidSortCriteria < BaseError
attr_reader :resource, :sort_criteria
def initialize(resourc... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/failed_dependency.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
require 'common/exceptions/serializable_error'
module Common
module Exceptions
class FailedDependency < BaseError
def initialize(detail: nil)
@detail = detail
super
end
def errors
data = @detail.prese... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/validation_errors_bad_request.rb | # frozen_string_literal: true
require 'common/exceptions/validation_errors'
module Common
module Exceptions
class ValidationErrorsBadRequest < ValidationErrors
def status_code
400
end
private
def error_attributes(key, message, _full_message)
i18n_data.merge(
t... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/base_error.rb | # frozen_string_literal: true
module Common
module Exceptions
# Base error class all others inherit from
class BaseError < StandardError
def errors
raise NotImplementedError, 'Subclass of Error must implement errors method'
end
def status_code
return if errors&.first.blank?... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/client_disconnected.rb | # frozen_string_literal: true
require 'common/exceptions/service_error'
module Common
module Exceptions
class ClientDisconnected < ServiceError
end
end
end
|
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/service_error.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
module Common
module Exceptions
class ServiceError < BaseError
attr_writer :source
def initialize(options = {})
@detail = options[:detail]
@source = options[:source]
@errors = options[:errors]
end
... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/unprocessable_entity.rb | # frozen_string_literal: true
require 'common/exceptions/service_error'
module Common
module Exceptions
class UnprocessableEntity < ServiceError
end
end
end
|
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/serializable_error.rb | # frozen_string_literal: true
require 'active_model'
module Common
module Exceptions
# This class is used to construct the JSON API SPEC errors object used for exceptions
class SerializableError
include ActiveModel::Model
include ActiveModel::Serialization
include ActiveModel::Attributes
... |
0 | code_files/vets-api-private/lib/common | code_files/vets-api-private/lib/common/exceptions/routing_error.rb | # frozen_string_literal: true
require 'common/exceptions/base_error'
module Common
module Exceptions
# Routing Error - if route is invalid
class RoutingError < BaseError
attr_reader :path
def initialize(path = nil)
@path = path
end
def errors
Array(SerializableError... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.