Class: UspsApi::PaymentAccounts
- Defined in:
- lib/usps_api/models/payment_accounts.rb
Overview
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.
Instance Attribute Summary collapse
-
#accounts ⇒ String
A list of EPS payment account identifiers.
-
#permits ⇒ Array[PermitNumber]
A list of permit numbers, each assigned to a ZIP code.
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(accounts: SKIP, permits: SKIP) ⇒ PaymentAccounts
constructor
A new instance of PaymentAccounts.
-
#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(accounts: SKIP, permits: SKIP) ⇒ PaymentAccounts
Returns a new instance of PaymentAccounts.
43 44 45 46 |
# File 'lib/usps_api/models/payment_accounts.rb', line 43 def initialize(accounts: SKIP, permits: SKIP) @accounts = accounts unless accounts == SKIP @permits = permits unless permits == SKIP end |
Instance Attribute Details
#accounts ⇒ String
A list of EPS payment account identifiers.
16 17 18 |
# File 'lib/usps_api/models/payment_accounts.rb', line 16 def accounts @accounts end |
#permits ⇒ Array[PermitNumber]
A list of permit numbers, each assigned to a ZIP code.
20 21 22 |
# File 'lib/usps_api/models/payment_accounts.rb', line 20 def permits @permits end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/usps_api/models/payment_accounts.rb', line 49 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. accounts = hash.key?('accounts') ? hash['accounts'] : SKIP # Parameter is an array, so we need to iterate through it permits = nil unless hash['permits'].nil? permits = [] hash['permits'].each do |structure| permits << (PermitNumber.from_hash(structure) if structure) end end permits = SKIP unless hash.key?('permits') # Create object from extracted values. PaymentAccounts.new(accounts: accounts, permits: permits) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 |
# File 'lib/usps_api/models/payment_accounts.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['accounts'] = 'accounts' @_hash['permits'] = 'permits' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/usps_api/models/payment_accounts.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 36 |
# File 'lib/usps_api/models/payment_accounts.rb', line 31 def self.optionals %w[ accounts permits ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
77 78 79 80 |
# File 'lib/usps_api/models/payment_accounts.rb', line 77 def inspect class_name = self.class.name.split('::').last "<#{class_name} accounts: #{@accounts.inspect}, permits: #{@permits.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
71 72 73 74 |
# File 'lib/usps_api/models/payment_accounts.rb', line 71 def to_s class_name = self.class.name.split('::').last "<#{class_name} accounts: #{@accounts}, permits: #{@permits}>" end |