Class: UspsApi::AdditionalClaims
- Defined in:
- lib/usps_api/models/additional_claims.rb
Overview
Claims collected and assertions made about an authenticated user and USPS customer. Additional, USPS-specific claims collected and asserted about a USPS customer.
Instance Attribute Summary collapse
-
#mail_owners ⇒ Array[MailOwner]
The mail owner claims belonging to the resource owner/user.
-
#payment_accounts ⇒ PaymentAccounts
A list of payment accounts which have been authorized by the USPS customer for use by the third-party application for payment of USPS goods and services.
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(payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) ⇒ AdditionalClaims
constructor
A new instance of AdditionalClaims.
-
#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(payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) ⇒ AdditionalClaims
Returns a new instance of AdditionalClaims.
45 46 47 48 49 50 51 52 53 |
# File 'lib/usps_api/models/additional_claims.rb', line 45 def initialize(payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @payment_accounts = payment_accounts unless payment_accounts == SKIP @mail_owners = mail_owners unless mail_owners == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#mail_owners ⇒ Array[MailOwner]
The mail owner claims belonging to the resource owner/user.
22 23 24 |
# File 'lib/usps_api/models/additional_claims.rb', line 22 def mail_owners @mail_owners end |
#payment_accounts ⇒ PaymentAccounts
A list of payment accounts which have been authorized by the USPS customer for use by the third-party application for payment of USPS goods and services. An EPS payment account or a permit may be used for payment.
18 19 20 |
# File 'lib/usps_api/models/additional_claims.rb', line 18 def payment_accounts @payment_accounts end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/usps_api/models/additional_claims.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_accounts = PaymentAccounts.from_hash(hash['payment_accounts']) if hash['payment_accounts'] # Parameter is an array, so we need to iterate through it mail_owners = nil unless hash['mail_owners'].nil? mail_owners = [] hash['mail_owners'].each do |structure| mail_owners << (MailOwner.from_hash(structure) if structure) end end mail_owners = SKIP unless hash.key?('mail_owners') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. AdditionalClaims.new(payment_accounts: payment_accounts, mail_owners: mail_owners, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/usps_api/models/additional_claims.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['payment_accounts'] = 'payment_accounts' @_hash['mail_owners'] = 'mail_owners' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/usps_api/models/additional_claims.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 38 |
# File 'lib/usps_api/models/additional_claims.rb', line 33 def self.optionals %w[ payment_accounts mail_owners ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
94 95 96 97 98 |
# File 'lib/usps_api/models/additional_claims.rb', line 94 def inspect class_name = self.class.name.split('::').last "<#{class_name} payment_accounts: #{@payment_accounts.inspect}, mail_owners:"\ " #{@mail_owners.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
87 88 89 90 91 |
# File 'lib/usps_api/models/additional_claims.rb', line 87 def to_s class_name = self.class.name.split('::').last "<#{class_name} payment_accounts: #{@payment_accounts}, mail_owners: #{@mail_owners},"\ " additional_properties: #{@additional_properties}>" end |