Class: UspsApi::ResourceOwnerUserClaims
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::ResourceOwnerUserClaims
- Defined in:
- lib/usps_api/models/resource_owner_user_claims.rb
Overview
The claims collected for the user when they have authorized access to a third-party client application. The claims collected for each application may be unique, based on default and optional claims.
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.
-
#sub ⇒ String
The unique identifier of the user’s account.
-
#updated_at ⇒ Date
The date and time that the user’s account information has been updated.
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(sub:, updated_at: SKIP, payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) ⇒ ResourceOwnerUserClaims
constructor
A new instance of ResourceOwnerUserClaims.
-
#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(sub:, updated_at: SKIP, payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) ⇒ ResourceOwnerUserClaims
Returns a new instance of ResourceOwnerUserClaims.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 56 def initialize(sub:, updated_at: SKIP, payment_accounts: SKIP, mail_owners: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @sub = sub @updated_at = updated_at unless updated_at == SKIP @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.
30 31 32 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 30 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.
26 27 28 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 26 def payment_accounts @payment_accounts end |
#sub ⇒ String
The unique identifier of the user’s account.
16 17 18 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 16 def sub @sub end |
#updated_at ⇒ Date
The date and time that the user’s account information has been updated.
20 21 22 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 20 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. sub = hash.key?('sub') ? hash['sub'] : nil updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP 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. ResourceOwnerUserClaims.new(sub: sub, updated_at: updated_at, 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.
33 34 35 36 37 38 39 40 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['sub'] = 'sub' @_hash['updated_at'] = 'updated_at' @_hash['payment_accounts'] = 'payment_accounts' @_hash['mail_owners'] = 'mail_owners' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 43 def self.optionals %w[ updated_at payment_accounts mail_owners ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 117 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} sub: #{@sub.inspect}, updated_at: #{@updated_at.inspect}, 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.
104 105 106 107 108 109 |
# File 'lib/usps_api/models/resource_owner_user_claims.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} sub: #{@sub}, updated_at: #{@updated_at}, payment_accounts:"\ " #{@payment_accounts}, mail_owners: #{@mail_owners}, additional_properties:"\ " #{@additional_properties}>" end |