Class: EVSS::PCIUAddress::AddressResponse

Inherits:
Response show all
Defined in:
lib/evss/pciu_address/address_response.rb

Overview

Model for PCIU address response

Constant Summary

Constants included from Common::Client::Concerns::ServiceStatus

Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Response

#cache?, #metadata, #ok?, #response_status

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes

Constructor Details

#initialize(status, response = nil) ⇒ AddressResponse

Returns a new instance of AddressResponse.



24
25
26
27
28
29
30
31
# File 'lib/evss/pciu_address/address_response.rb', line 24

def initialize(status, response = nil)
  attributes = {}
  if response
    attributes[:address] = response.body['cnp_mailing_address']
    attributes[:control_information] = response.body['control_information']
  end
  super(status, attributes)
end

Instance Attribute Details

#addressEVSS::PCIUAddress

Returns The address data returned by the service.

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/evss/pciu_address/address_response.rb', line 20

class AddressResponse < EVSS::Response
  attribute :address, EVSS::PCIUAddress
  attribute :control_information, EVSS::PCIUAddress::ControlInformation

  def initialize(status, response = nil)
    attributes = {}
    if response
      attributes[:address] = response.body['cnp_mailing_address']
      attributes[:control_information] = response.body['control_information']
    end
    super(status, attributes)
  end

  def address=(attrs)
    super EVSS::PCIUAddress.build_address(attrs)
  end
end

#control_informationObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/evss/pciu_address/address_response.rb', line 20

class AddressResponse < EVSS::Response
  attribute :address, EVSS::PCIUAddress
  attribute :control_information, EVSS::PCIUAddress::ControlInformation

  def initialize(status, response = nil)
    attributes = {}
    if response
      attributes[:address] = response.body['cnp_mailing_address']
      attributes[:control_information] = response.body['control_information']
    end
    super(status, attributes)
  end

  def address=(attrs)
    super EVSS::PCIUAddress.build_address(attrs)
  end
end