Class: UspsApi::ChangeOfAddressSubscriptionEventInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::ChangeOfAddressSubscriptionEventInformation
- Defined in:
- lib/usps_api/models/change_of_address_subscription_event_information.rb
Overview
Change Of Address Subscription Event Information
Instance Attribute Summary collapse
-
#business_name ⇒ String
Business Name.
-
#first_name ⇒ String
First Name.
-
#last_name ⇒ String
Last Name.
-
#links ⇒ Array[SubscriptionsNcoaHypermediaLink]
Hypermedia links to related resources.
-
#middle_inital ⇒ String
Middle Initial.
-
#new_address ⇒ SubscriptionsNcoaChangeOfAddressDetailFields1
Shared attributes between internal and external requests.
-
#original_address ⇒ SubscriptionsNcoaChangeOfAddressDetailFields
Shared attributes between internal and external requests.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(links: SKIP, first_name: SKIP, middle_inital: SKIP, last_name: SKIP, business_name: SKIP, original_address: SKIP, new_address: SKIP) ⇒ ChangeOfAddressSubscriptionEventInformation
constructor
A new instance of ChangeOfAddressSubscriptionEventInformation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(links: SKIP, first_name: SKIP, middle_inital: SKIP, last_name: SKIP, business_name: SKIP, original_address: SKIP, new_address: SKIP) ⇒ ChangeOfAddressSubscriptionEventInformation
Returns a new instance of ChangeOfAddressSubscriptionEventInformation.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 71 def initialize(links: SKIP, first_name: SKIP, middle_inital: SKIP, last_name: SKIP, business_name: SKIP, original_address: SKIP, new_address: SKIP) @links = links unless links == SKIP @first_name = first_name unless first_name == SKIP @middle_inital = middle_inital unless middle_inital == SKIP @last_name = last_name unless last_name == SKIP @business_name = business_name unless business_name == SKIP @original_address = original_address unless original_address == SKIP @new_address = new_address unless new_address == SKIP end |
Instance Attribute Details
#business_name ⇒ String
Business Name.
30 31 32 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 30 def business_name @business_name end |
#first_name ⇒ String
First Name.
18 19 20 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 18 def first_name @first_name end |
#last_name ⇒ String
Last Name.
26 27 28 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 26 def last_name @last_name end |
#links ⇒ Array[SubscriptionsNcoaHypermediaLink]
Hypermedia links to related resources.
14 15 16 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 14 def links @links end |
#middle_inital ⇒ String
Middle Initial.
22 23 24 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 22 def middle_inital @middle_inital end |
#new_address ⇒ SubscriptionsNcoaChangeOfAddressDetailFields1
Shared attributes between internal and external requests.
38 39 40 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 38 def new_address @new_address end |
#original_address ⇒ SubscriptionsNcoaChangeOfAddressDetailFields
Shared attributes between internal and external requests.
34 35 36 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 34 def original_address @original_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 84 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (SubscriptionsNcoaHypermediaLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') first_name = hash.key?('firstName') ? hash['firstName'] : SKIP middle_inital = hash.key?('middleInital') ? hash['middleInital'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP business_name = hash.key?('businessName') ? hash['businessName'] : SKIP if hash['originalAddress'] original_address = SubscriptionsNcoaChangeOfAddressDetailFields.from_hash(hash['originalAddress']) end new_address = SubscriptionsNcoaChangeOfAddressDetailFields1.from_hash(hash['newAddress']) if hash['newAddress'] # Create object from extracted values. ChangeOfAddressSubscriptionEventInformation.new(links: links, first_name: first_name, middle_inital: middle_inital, last_name: last_name, business_name: business_name, original_address: original_address, new_address: new_address) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['links'] = 'links' @_hash['first_name'] = 'firstName' @_hash['middle_inital'] = 'middleInital' @_hash['last_name'] = 'lastName' @_hash['business_name'] = 'businessName' @_hash['original_address'] = 'originalAddress' @_hash['new_address'] = 'newAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 54 def self.optionals %w[ links first_name middle_inital last_name business_name original_address new_address ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} links: #{@links.inspect}, first_name: #{@first_name.inspect},"\ " middle_inital: #{@middle_inital.inspect}, last_name: #{@last_name.inspect}, business_name:"\ " #{@business_name.inspect}, original_address: #{@original_address.inspect}, new_address:"\ " #{@new_address.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 |
# File 'lib/usps_api/models/change_of_address_subscription_event_information.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} links: #{@links}, first_name: #{@first_name}, middle_inital:"\ " #{@middle_inital}, last_name: #{@last_name}, business_name: #{@business_name},"\ " original_address: #{@original_address}, new_address: #{@new_address}>" end |