Class: EVSS::PCIU::Service

Inherits:
Service show all
Defined in:
lib/evss/pciu/service.rb

Overview

EVSS::PCIU endpoints for a user’s mailing address, email address, primary/secondary phone numbers, and countries

Constant Summary

Constants inherited from Service

Service::STATSD_KEY_PREFIX

Instance Attribute Summary

Attributes inherited from Service

#transaction_id

Instance Method Summary collapse

Methods inherited from Service

#handle_error, #headers, #initialize, #perform, #save_error_details, service_is_up?, #with_monitoring_and_error_handling

Methods included from Common::Client::Concerns::Monitoring

#increment, #increment_failure, #increment_total, #with_monitoring

Methods inherited from Common::Client::Base

#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Constructor Details

This class inherits a constructor from EVSS::Service

Instance Method Details

#get_alternate_phoneEVSS::PCIU::PhoneNumberResponse

Returns a response object containing the user’s alternate phone number, extension, and country code

Returns:

  • (EVSS::PCIU::PhoneNumberResponse)

    Sample response.phone:

    "country_code" => "1",
    "extension" => "",
    "number" => "4445551212",
    "effective_date" => "2018-02-27T14:41:32.283Z"
    



68
69
70
71
72
73
74
# File 'lib/evss/pciu/service.rb', line 68

def get_alternate_phone
  with_monitoring_and_error_handling do
    raw_response = perform(:get, 'secondaryPhoneNumber')

    EVSS::PCIU::PhoneNumberResponse.new(raw_response.status, raw_response)
  end
end

#get_email_addressEVSS::PCIU::EmailAddressResponse

Returns a response object containing the user’s email address and its effective date

Returns:



30
31
32
33
34
35
36
# File 'lib/evss/pciu/service.rb', line 30

def get_email_address
  with_monitoring_and_error_handling do
    raw_response = perform(:get, 'emailAddress')

    EVSS::PCIU::EmailAddressResponse.new(raw_response.status, raw_response)
  end
end

#get_primary_phoneEVSS::PCIU::PhoneNumberResponse

Returns a response object containing the user’s primary phone number, extension, and country code

Returns:

  • (EVSS::PCIU::PhoneNumberResponse)

    Sample response.phone:

    "country_code" => "1",
    "extension" => "",
    "number" => "4445551212",
    "effective_date" => "2018-02-27T14:41:32.283Z"
    



49
50
51
52
53
54
55
# File 'lib/evss/pciu/service.rb', line 49

def get_primary_phone
  with_monitoring_and_error_handling do
    raw_response = perform(:get, 'primaryPhoneNumber')

    EVSS::PCIU::PhoneNumberResponse.new(raw_response.status, raw_response)
  end
end

#post_alternate_phone(phone_attrs) ⇒ EVSS::PCIU::PhoneNumberResponse

POST’s the passed phone attributes to the EVSS::PCIU service. Returns a response object containing the user’s alternate phone number, extension, and country code

Parameters:

Returns:

  • (EVSS::PCIU::PhoneNumberResponse)

    Sample response.phone:

    "country_code" => "1",
    "extension" => "",
    "number" => "4445551212"
    "effective_date" => "2018-02-27T14:41:32.283Z"
    



115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/evss/pciu/service.rb', line 115

def post_alternate_phone(phone_attrs)
  with_monitoring_and_error_handling do
    raw_response = perform(
      :post,
      'secondaryPhoneNumber',
      RequestBody.new(phone_attrs, pciu_key: 'cnpPhone').set,
      headers
    )

    EVSS::PCIU::PhoneNumberResponse.new(raw_response.status, raw_response)
  end
end

#post_email_address(email_attrs) ⇒ EVSS::PCIU::EmailAddressResponse

POST’s the passed email attributes to the EVSS::PCIU service. Returns a response object containing the user’s email and effective date.

Parameters:

Returns:



138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/evss/pciu/service.rb', line 138

def post_email_address(email_attrs)
  with_monitoring_and_error_handling do
    raw_response = perform(
      :post,
      'emailAddress',
      { value: email_attrs.email }.to_json,
      headers
    )

    EVSS::PCIU::EmailAddressResponse.new(raw_response.status, raw_response)
  end
end

#post_primary_phone(phone_attrs) ⇒ EVSS::PCIU::PhoneNumberResponse

POST’s the passed phone attributes to the EVSS::PCIU service. Returns a response object containing the user’s primary phone number, extension, and country code

Parameters:

Returns:

  • (EVSS::PCIU::PhoneNumberResponse)

    Sample response.phone:

    "country_code" => "1",
    "extension" => "",
    "number" => "4445551212"
    "effective_date" => "2018-02-27T14:41:32.283Z"
    



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/evss/pciu/service.rb', line 89

def post_primary_phone(phone_attrs)
  with_monitoring_and_error_handling do
    raw_response = perform(
      :post,
      'primaryPhoneNumber',
      RequestBody.new(phone_attrs, pciu_key: 'cnpPhone').set,
      headers
    )

    EVSS::PCIU::PhoneNumberResponse.new(raw_response.status, raw_response)
  end
end