Class: Usps::Imis::PartyData

Inherits:
BaseData
  • Object
show all
Defined in:
lib/usps/imis/party_data.rb

Overview

Convenience wrapper for accessing specific properties within an API data response for the Party Business Object, which has a different internal structure than others

Instance Method Summary collapse

Methods inherited from BaseData

#[]=, from_json, #inspect, #pretty_print

Instance Method Details

#[](property_name) ⇒ Object

Access an individual property value by name



29
# File 'lib/usps/imis/party_data.rb', line 29

def [](property_name) = properties[property_name]

#certificateObject

Access the certificate number



25
# File 'lib/usps/imis/party_data.rb', line 25

def certificate = self['AlternateIds'].find { it['IdType'] == 'MajorKey' }['Id']

#entityObject

The Business Object name



16
# File 'lib/usps/imis/party_data.rb', line 16

def entity = 'Party'

#imis_idObject Also known as: id

Access the iMIS ID property



20
# File 'lib/usps/imis/party_data.rb', line 20

def imis_id = self['Id'].to_i

#propertiesObject

Hash of all property names to values



33
34
35
# File 'lib/usps/imis/party_data.rb', line 33

def properties
  @properties ||= format_extracted(extract_hash(raw))
end