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

#headers, #initialize, #perform, service_is_up?

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

#with_monitoring

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Methods included from SentryLogging

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

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"
    



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

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:



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

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"
    



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

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"
    



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

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:



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

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"
    



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

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